QuantConnect Documentation - Writing Algorithms

Created on 05/17/2023

Copyright QuantConnect 2023

 

Table of Content

 

1 Key Concepts

1.1 Getting Started

Introduction

Quantitative trading is a method of trading where computer programs execute a set of defined trading rules in an automated fashion. Quants take a scientific approach to trading, applying concepts from mathematics, time series analysis, statistics, computer science, and machine learning. Compared to discretionary traders, quants can respond faster to new information and are at less risk to their emotions during trades. Since quants can concurrently trade many strategies while discretionary traders only have the mental bandwidth to trade a small number of concurrent strategies, quant traders can have more diversified portfolios.

Learn Programming

We aim to make it as easy as possible to use QuantConnect, but you still need to be able to program. The following table provides some resources to get you started:

Language Type Name Producer
C# Video C# Fundamentals for Absolute Beginners Microsoft
C# Text C# Jump Start - Advanced Concepts Microsoft
C# Video Top 20 C# Questions Microsoft
C# Text C# Tutorial tutorialspoint
Python Text Introduction to Financial Python QuantConnect
Python Text/Video Introduction to Python Google
Python Interactive Code Academy - Python Code Academy
Python Text Python Pandas Tutorial tutorialspoint

Enroll in Bootcamp

Bootcamp is an online coding experience where QuantConnect team and community members teach you to write your first algorithms. Bootcamp gives you step-by-step instructions on practical and beginner-friendly topics, so it's a great way to learn LEAN. The lessons cover many topics that you use as you write your own algorithms, including universe selection , indicators , and consolidators . To get started, check out the course library .

Example Algorithm

The following video demonstrates how to implement an algorithm that buys and holds an S&P 500 index ETF:

Example python algorithm coding Example C# algorithm coding
// Import all the functionality you need to run algorithms
using QuantConnect.Data;

// Define a trading algorithm that is a subclass of QCAlgorithm
namespace QuantConnect.Algorithm.CSharp
{
    public class MyAlgorithm : QCAlgorithm
    {
        // Define an Initialize method.
        // This method is the entry point of your algorithm where you define a series of settings.
        // LEAN only calls this method one time, at the start of your algorithm.
        public override void Initialize()
        {
            // Set the start and end dates
            SetStartDate(2018, 1, 1);
            SetEndDate(2022, 6, 1);
            // Set the starting cash balance to $100,000 USD
            SetCash(100000);
            // Add data for the S&P500 index ETF
            AddEquity("SPY");
        }

        // Define an OnData method. 
        // This method receives all the data you subscribe to in discrete time slices.
        // It's where you make trading decisions.
        public override void OnData(Slice slice)
        {
            // Allocate 100% of the portfolio to SPY
            if (!Portfolio.Invested)
            {
                SetHoldings("SPY", 1);
            }
        }
    }
}
# Import all the functionality you need to run algorithms
from AlgorithmImports import *

# Define a trading algorithm that is a subclass of QCAlgorithm
class MyAlgorithm(QCAlgorithm):
    # Define an Initialize method.
    # This method is the entry point of your algorithm where you define a series of settings.
    # LEAN only calls this method one time, at the start of your algorithm.
    def Initialize(self) -> None:
        # Set start and end dates
        self.SetStartDate(2018, 1, 1)
        self.SetEndDate(2022, 6, 1)
        # Set the starting cash balance to $100,000 USD
        self.SetCash(100000)
        # Add data for the S&P500 index ETF
        self.AddEquity("SPY")

    # Define an OnData method. 
    # This method receives all the data you subscribe to in discrete time slices.
    # It's where you make trading decisions.
    def OnData(self, slice: Slice) -> None:
        # Allocate 100% of the portfolio to SPY
        if not self.Portfolio.Invested:
            self.SetHoldings("SPY", 1)

 

1.2 Algorithm Engine

Introduction

LEAN Engine is an open-source algorithmic trading engine built for easy strategy research, backtesting, and live trading. We integrate with common data providers and brokerages, so you can quickly deploy algorithmic trading strategies. The core of the LEAN Engine is written in C#, but it operates seamlessly on Linux, Mac and Windows operating systems. To use it, you can write algorithms in Python 3.8 or C#. QuantConnect maintains the LEAN project and uses it to drive the web-based algorithmic trading platform on the website.

Since LEAN is open-source, you aren't locked-in to the QuantConnect platform. You can run LEAN with your own infrastructure, data, and brokerage connections. If you use QuantConnect, our team of engineers manage the infrastructure, you can run the latest version of LEAN with all of its brokerage connections, and you can utilize the datasets in the Dataset Market .

Your Algorithm and LEAN

To create a trading algorithm with LEAN, define a subclass of the QCAlgorithm class. LEAN loads your algorithm into the engine during the building and compilation process. LEAN runs an algorithm manager that synchronizes the data your algorithm requests, injects the data into your algorithm so you can place trades, processes your orders, and then updates your algorithm state.

The LEAN engine manages your portfolio and data feeds, so you focus on your algorithm strategy and execution. We automatically provide basic portfolio management and reality modeling underneath the hood. The QCAlgorithm class provides some key helper properties for you to use, including the Security Manager, Portfolio Manager, Transactions Manager, Notification Manager, and Scheduling Manager. The class also has hundreds of helper methods to make the API easy to use.

The Securities property is a dictionary of Security objects. Each asset (Equity, Forex pair, etc) in your algorithm has a Security object. All the models for a security live on these objects. For example, Securities["IBM"].FeeModel and Securities["IBM"].Price self.Securities["IBM"].FeeModel and self.Securities["IBM"].Price return the fee model and price of IBM, respectively.

The Portfolio is a dictionary of SecurityHolding objects. These classes track the profits, losses, fees, and quantity of individual portfolio holdings. For example, Portfolio["IBM"].LastTradeProfit self.Portfolio["IBM"].LastTradeProfit returns the profit of your last IBM trade.

Other helpers like Transactions , Schedule , Notify , and Universe have their own helper methods.

public class QCAlgorithm
{
    SecurityManager Securities;               // Array of Security objects.
    SecurityPortfolioManager Portfolio;       // Array of SecurityHolding objects
    SecurityTransactionManager Transactions;  // Transactions helper
    ScheduleManager Schedule;                 // Scheduling helper
    NotificationManager Notify;               // Email, SMS helper
    UniverseManager Universe;                 // Universe helper

    // Set up Requested Data, Cash, Time Period.
    public virtual void Initialize() { ... };

    // Event Handlers:
    public virtual void OnData(Slice slice) { ... };
    public virtual void OnEndOfDay(Symbol symbol) { ... };
    public virtual void OnEndOfAlgorithm() { ... };

    // Indicator Helpers
    public SimpleMovingAverage SMA(Symbol symbol, int period) { ... };
}
class QCAlgorithm:
    Securities   # Array of Security objects.
    Portfolio    # Array of SecurityHolding objects
    Transactions # Transactions helper
    Schedule     # Scheduling helper
    Notify       # Email, SMS helper
    Universe     # Universe helper

    # Set up Requested Data, Cash, Time Period.
    def Initialize(self) -> None:

    # Other Event Handlers
    def OnData(self, slice: Slice) -> None:
    def OnEndOfDay(self, symbol: Symbol) -> None:
    def OnEndOfAlgorithm(self) -> None:

    # Indicator Helpers
    def SMA(self, symbol: Symbol, period: int) -> SimpleMovingAverage:

Threads in LEAN

LEAN is multi-threaded and attempts to consume as much CPU as possible to perform given work as quickly as possible. The analysis engine loads data parallel and synchronizes it to generate the requested security information.

The client algorithm is plugged into LEAN, and has its events triggered synchronously in backtesting. The primary bottle neck to LEAN execution is executing client code.

In live trading, most events are synchronous as in backtesting, however order events are triggered immediately from the brokerage thread (asynchronously) to ensure the lowest latency. For example; a strategy using hourly data, with a limit order could fill between data bars. This fill event is triggered when it occurs in live trading.

We recommend using thread safe collections when possible, or locks around collections to ensure they are thread-safe.

Batch vs Stream Analysis

Backtesting platforms come in two general varieties, batch processing and event streaming. Batch processing backtesting is much simpler. It loads all data into an array and passes it to your algorithm for analysis. Because your algorithm has access to future data points, it is easy to introduce look-ahead bias . Most home-grown analysis tools are batch systems.

QuantConnect/LEAN is a streaming analysis system. In live trading, your algorithm receives data points one after another over time. QuantConnect models this in backtesting, streaming data to your algorithm in fast-forward mode. Because of this, you can't access price data beyond the Time Frontier . Although streaming analysis is slightly trickier to understand, it allows your algorithm to seamlessly work in backtests and live trading with no code changes.

Event Flow

When you deploy an algorithm, LEAN first calls the Initialize method. In live mode, the engine loads your holdings and open orders from your brokerage account to add data subscriptions and populate the Securities , Portfolio , and Transactions objects. LEAN receives the data from the subscriptions, synchronizes the data to create a timeslice , and then performs the following steps. Your algorithm can spend up to 10 minutes on each timeslice unless you call the Train method.

  1. If it's a backtest, check if there are Scheduled Events in the past that didn't fire because there was no data between the previous slice and the current slice. LEAN automatically creates a Scheduled Event to call the OnEndOfDay method at the end of each day.
  2. In live mode, Scheduled Events occur in a separate thread from the algorithm manager, so they run at the correct time.

  3. Update the algorithm time.
  4. Update the CurrentSlice .
  5. Cancel all open orders for securities that changed their ticker .
  6. Add a Security object to the Securities collection for each new security in the universe.
  7. Update the Security objects with the latest data.
  8. Update the Cash objects in the CashBook with the latest data.
  9. Process fill models for non-market orders.
  10. Submit market on open orders to liquidate Equity Option contracts if the underlying Equity has a split warning .
  11. Process margin calls .
  12. If it's time to settle unsettled cash , perform settlement.
  13. Call the OnSecuritiesChanged method with the latest security changes.
  14. Apply dividends to the portfolio.
  15. For securities that have a split warning, update their portfolio holdings and adjust their open orders to account for the split.
  16. Update consolidators with the latest data.
  17. Pass custom data to the OnData method.
  18. Pass Dividends to the OnData method.
  19. Pass Splits to the OnData method.
  20. Pass Delistings to the OnData method.
  21. Pass TradeBars to the OnData method.
  22. Pass QuoteBars to the OnData method.
  23. Pass OptionChains to the OnData method.
  24. Pass Ticks to the OnData method.
  25. Pass the Slice to the OnData method.
  26. Perform universe selection .
  27. Pass the Slice to the Update method of each Alpha model .
  28. Pass the Insight objects from the Alpha model to the Portfolio Construction model .
  29. Pass the PortfolioTarget objects from the Portfolio Construction model to each Risk Management model .
  30. Pass the risk-adjusted PortfolioTarget objects from the Risk Management models to the Execution model .

When your algorithm stops executing, LEAN calls the OnEndOfAlgorithm method .

Python Support

The LEAN engine is written in C#, but you can create algorithms in C# or Python. If you program in Python, LEAN uses Python.Net to bridge between the C# engine and your algorithm. As a result of the bridge, QCAlgorithm class members are in camel case, not snake case. It can be slow to move from Python to C#. If you access C# objects in your Python algorithm, it's fastest to only access them once and save a reference if you need to access them again.

# Do this:
security_holding = self.Portfolio[self.symbol]
avg_price = security_holding.AveragePrice
quantity = security_holding.Quantity

# Avoid this:
avg_price = self.Portfolio[self.symbol].AveragePrice
quantity = self.Portfolio[self.symbol].Quantity

 

1.3 Multi-Asset Modeling

Introduction

We designed LEAN as a multi-asset platform with out-of-the-box support for multiple securities, so you can model complex portfolios like hedge funds.

Asset Portfolio

The portfolio manages the individual securities it contains. It tracks the cost of holding each security. It aggregates the performance of the individual securities in the portfolio to produce statistics like net profit and drawdown . The portfolio also holds information about each currency in its cashbook.

Cashbooks

We designed LEAN to be a multi-currency platform. LEAN can trade Forex, Cryptocurrencies, and other assets that are quoted in other currencies. A benefit of supporting multiple currencies is that as we add new asset classes from new countries, LEAN is already prepared to transact in those assets by using their quote currency. For instance, we added the India Equity market, which quotes assets in the INR currency.

The portfolio manages your currencies in its cashbook, which models the cash as a ledger of transactions. When you buy assets, LEAN uses the currencies in your cashbook to purchase the asset and pay the transaction fees. For more information about the cashbook, see Cashbook .

Buying Power

We model the margin requirements of each asset and reflect that in the buying power available to the algorithm. We source Futures margins from CME SPAN margins. Equity margin is 2x for standard margin accounts and 4x intraday for Pattern Day Trading accounts. For more information about buying power modeling, see Buying Power .

 

1.4 Time Modeling

1.4.1 Periods

Introduction

Data comes in two different "shapes" according to the time period it covers: point values or period values. In QuantConnect, ticks are point values, and bars are a period values. These data formats have different properties, which control when LEAN emits them into your algorithm.

Start time vs end time for tick and bar data

Start and End Time

Bars have a start and end time that represent the time period of which the bar aggregates data. LEAN passes the bar to your algorithm at the end time so that you don't receive the bar before it was actually available. Other data providers commonly timestamp their bars to the start time of the bar. This can cause one-off errors when you import the data into QC or compare indicator values across different platforms.

Period Values

Bars aggregate data across a period of time into a single object. We make this easy for you by pre-aggregating billions of raw trade-ticks into TradeBar objects and quote-ticks into QuoteBar objects.

We don't know the close of a bar until the start of the next bar, which can sometimes be confusing. For example, a price bar for Friday will include all the ticks from Friday 00:00:00 to Friday 23:59:59.99999, but LEAN will emit it to your algorithm on Saturday at midnight. As a result, if you analyze the Friday data and then place an order, LEAN sends the order to your brokerage on Saturday.

Time of receiving bar data via OnData handler

When there are no ticks during a period, LEAN emits the previous bar. This is the default behavior for bar data and it's referred to as "filling the data forward". You can enable and disable this setting when you create the security subscription .

We provide bar data in second, minute, hour, and daily bar formats. To create other periods of bars, see Consolidating Data .

Daily Periods

LEAN emits daily bars at midnight. To be notified when a security has finished trading for the day, add an OnEndOfDay method to your algorithm. LEAN calls this method for each security every day.

def OnEndOfDay(self, symbol: Symbol) -> None:
    pass
public override void OnEndOfDay(Symbol symbol)
{
    
}

Point Values

Point values have no period because they occur at a singular point in time. Examples of point data includes ticks, open interest, and news releases. Tick data represents a single trade or quote in the market. It's a discrete event with no period, so the Time and EndTime properties are the same. LEAN emits ticks as soon as they arrive and doesn't fill them forward.

Time of receiving tick data via OnData handler

 

1.4.2 Timeslices

Introduction

The core technology behind QuantConnect algorithmic trading is an event-based, streaming analysis system called LEAN . LEAN attempts to model the stream of time as accurately as possible, presenting data ("events") to your algorithms in the order it arrives, as you would experience in reality.

All QuantConnect algorithms have this time-stream baked in as the primary event handler, OnData . The Slice object this method receives represents all of the data at a moment of time, a time-slice . No matter what data you request, you receive it in the order created according to simulated algorithm time. By only letting your algorithm see the present and past moments, we can prevent the most common quantitative-analysis error, look-ahead bias .

Time Frontier

If you request data for multiple securities and multiple resolutions, it can create a situation where one of your data subscriptions is ready to emit, but another subscription with a longer period is still be constructing its bar. Furthermore, if you request multiple datasets that have different time zones, your algorithm will receive the daily bars of each dataset at midnight in the respective time zone. To coordinate the data in these situations, we use the EndTime of each data point to signal when LEAN should transmit it to your algorithm.

Time frontier as backtest progress

Once your algorithm reaches the EndTime of a data point, LEAN sends the data to your OnData method. For bar data, this is the beginning of the next period. To avoid look-ahead bias, you can only access data from before this Time Frontier. The Time property of your algorithm is always equal to the Time Frontier.

Properties

Slice objects have the following properties:

Get Time Slices

To get the current Slice object, define an OnData method or use the CurrentSlice property of your algorithm. The Slice contains all the data for a given moment in time. The TradeBars and QuoteBars properties are Symbol /string indexed dictionaries. The Ticks property is a list of ticks for that moment of time, indexed by the Symbol . To check which data formats are available for each asset class, see the Data Formats page in the Asset Classes chapter.

The Slice object gives you the following ways to access your data:

Strongly typed access gives you compile-time safety, but dynamic type access can sometimes simplify coding. We recommend static types since they are easier to debug.

Check if the Slice contains the data you're looking for before you index it. If there is little trading, or you are in the same time loop as when you added the security, it may not have any data. Even if you enabled fill-forward for a security subscription, you should check if the data exists in the dictionary before you try to index it. To check if the Slice contains for a security, call the ContainsKey method. Note: if the Slice object doesn't contain any market data but it contains auxiliary data, the slice.ContainsKey(symbol) method can return true while slice[symbol] returns None null .

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.symbol) and slice[self.symbol] is not None:
        data = slice[self.symbol]
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_symbol))
    {
        var data = slice[_symbol];
    }
}

 

1.4.3 Time Zones

Introduction

LEAN is an international trading engine, so it can operate across time zones. The exchange, your algorithm, and the data in your algorithm can all have different time zones.

Exchange Time Zone

Exchanges are located in different areas, so they can have different time zones. To get the time zone of the exchange that a Security trades on, use its Exchange.Hours.TimeZone property.

var timeZone = Securities[_symbol].Exchange.Hours.TimeZone;
time_zone = self.Securities[self.symbol].Exchange.Hours.TimeZone

Algorithm Time Zone

LEAN supports international trading across multiple time zones and markets, so it needs a reference time zone for the algorithm to set the Time . The default time zone is Eastern Time (ET), which is UTC-4 in summer and UTC-5 in winter. To set a different time zone, call the SetTimeZone method. This method accepts either a string following the IANA Time Zone database convention or a NodaTime .DateTimeZone object. If you pass a string, the method converts it to a NodaTime.DateTimeZone object. The TimeZones class provides the following helper attributes to create NodaTime.DateTimeZone objects:

SetTimeZone("Europe/London");
SetTimeZone(NodaTime.DateTimeZone.Utc);
SetTimeZone(TimeZones.Chicago);
self.SetTimeZone("Europe/London")
self.SetTimeZone(TimeZones.Chicago)

To get the time zone of your algorithm, use the TimeZone property.

time_zone = self.TimeZone
var timeZone = TimeZone;

To get the algorithm time in Coordinated Universal Time (UTC), use the UtcTime property.

utc_time = self.UtcTime
var utcTime = UtcTime;

The Time and UtcTime objects have no time zone. LEAN maintains their state to be consistent.

Data Time Zone

Datasets can have different time zones because the time zone is up to the data provider, where they are located, and where they collect the data. LEAN tracks the time zone of each dataset so that you receive the correct data at the right point in time in your algorithm. If you have multiple datasets in your algorithm from different time zones, LEAN synchronizes them to your algorithm time. Furthermore, if you set up time period consolidators , LEAN consolidates the data based on the data time zone.

To get the time zone of a dataset, view the listing page in the Dataset Market or call the GetDataTimeZone method.

time_zone = self.MarketHoursDatabase.GetDataTimeZone(Market.USA, self.symbol, SecurityType.Equity)
var timeZone = MarketHoursDatabase.GetDataTimeZone(Market.USA, _symbol, SecurityType.Equity);

 

1.5 Security Identifiers

Introduction

We implemented Symbol objects in the LEAN open-source project as a way to identify or "finger-print" tradable assets so that no further database look-up is required. All QuantConnect and LEAN Algorithm API methods use Symbol objects to identify assets.

Encoding Symbols

SecurityIdentifier objects have several public properties to uniquely identify each asset. The following table describes these properties:

Property Data Type Description
Market string The market in which the asset trades
SecurityType SecurityType The asset class
OptionStyle OptionStyle American or European Option style
OptionRight OptionRight Call or put Option type
StrikePrice decimal The Option contract strike price
Date datetime DateTime Earliest listing date for Equities; expiry for Futures and Options; December 30, 1899 for continuous Futures contracts and Indices.
HasUnderlying bool A flag to represent if its a derivative asset with another underlying asset

We encode the preceding properties to create Symbol objects. We do our best to hide the details of this process from your algorithm, but you'll occasionally see it come through as an encoded hash like AAPL R735QTJ8XC9X . The first half of the encoded string represents the first ticker AAPL was listed under. The other letters at the end of the string represent the serialized form of the preceding SecurityIdentifier properties. You may also see an encoded has like AAPL XL7X5I241SO6|AAPL R735QTJ8XC9X for a derivative contract. In this case, the part before the | is contract hash and the part after the | is the underlying hash. This serialization approach lets LEAN assign a short, unique string to octillions of different security objects.

Security identifier decomposition

The following table shows the results of our encoding process given the preceding SecurityIdentifier properties:

Market SecurityType OptionStyle OptionRight StrikePrice Date HasUnderlying Encoded SecurityIdentifer After the Ticker Full Encoded SecurityIdentifer Example
USA Equity N/A N/A N/A false Depends on the listing date SPY R735QTJ8XC9X
India Equity N/A N/A N/A false Depends on the listing date YESBANK TA8Y7QR36M31
USA Option American Call true Depends on the strike price and contract expiry date SPY Y7T8ERCJRZHI|SPY R735QTJ8XC9X
USA Option American Put true Depends on the strike price and contract expiry date SPY 325YRWXJ6A2CM|SPY R735QTJ8XC9X
Bitfinex Crypto N/A N/A N/A N/A false E3 BTCUSD E3
GDAX Crypto N/A N/A N/A N/A false XJ BTCUSD XJ
Kraken Crypto N/A N/A N/A N/A false 10B BTCUSD 10B
Binance Crypto N/A N/A N/A N/A false 18N BTCUSDT 18N
BinanceUS Crypto N/A N/A N/A N/A false 2S7 BTCUSD 2S7
Binance CryptoFuture N/A N/A N/A Default value for continuous contracts (December 30, 1899) false 18R BTCBUSD 18R
Oanda Forex N/A N/A N/A N/A false 8G EURUSD 8G
NYMEX Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false JL CL JL
NYMEX Futures N/A N/A N/A false Depends on the contract expiry date CL Y5BMQ78IXW3L
CBOT Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false MD 10Y MD
CBOT Futures N/A N/A N/A false Depends on the contract expiry date 10Y Y6E15UI3XBFP
ICE Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false P5 SB P5
ICE Futures N/A N/A N/A false Depends on the contract expiry date SB XS9YHLR0G0P5
CFE Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false 2JT VX 2JT
CFE Futures N/A N/A N/A false Depends on the contract expiry date VX XLCUDY7B36Y1
COMEX Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false 1P9 AUP 1P9
COMEX Futures N/A N/A N/A false Depends on the contract expiry date AUP Y6E15UI3XCIL
CME Futures N/A N/A N/A Default value for continuous contracts (December 30, 1899) false 1S1 6A 1S1
CME Futures N/A N/A N/A false Depends on the contract expiry date 6A Y54QLJOCEN7L
CBOT FutureOption American Call true Depends on the strike price and Option contract expiry date OZB Y5IIV0IM2B9K|ZB Y6ZOZWJTLWYT
CBOT FutureOption American Put true Depends on the strike price and Option contract expiry date OZB 324MJ0GMRY64O|ZB Y6ZOZWJTLWYT
CME FutureOption American Call true Depends on the strike price and Option contract expiry date DC Y6F0M6PN2P50|DC Y79JGU7IDHQ9
CME FutureOption American Put true Depends on the strike price and Option contract expiry date DC 325J0RLJHWU6C|DC Y79JGU7IDHQ9
COMEX FutureOption American Call true Depends on the strike price and Option contract expiry date OG Y5HJES9Z6R40|GC Y6A3DH1FMBVH
COMEX FutureOption American Put true Depends on the strike price and Option contract expiry date OG 324LJK7HQ75GG|GC Y6A3DH1FMBVH
NYMEX FutureOption American Call true Depends on the strike price and Option contract expiry date ON Y693XDUJYOX0|NG Y6A3DH1FMAPT
NYMEX FutureOption American Put true Depends on the strike price and Option contract expiry date ON 325D42V6VFRT0|NG Y6A3DH1FMAPT
USA Index N/A N/A N/A Default value for Indices (December 30, 1899) false 31 SPX 31
USA IndexOption European Call true Depends on the strike price and contract expiry date SPX XVDBJU811DE6|SPX 31
USA IndexOption European Put true Depends on the strike price and contract expiry date SPX 31UHBPA78B6RY|SPX 31
OANDA Cfd N/A N/A N/A N/A false 8I SPX500USD 8I

LEAN assumes the ticker you pass to the AddEquity method is the current ticker of the Equity asset. To access this ticker, use the Value property of the Symbol object.

self.symbol = self.AddEquity("GOOG").Symbol
self.Debug(self.symbol.ID.Value) # Prints "GOOCV"
self.Debug(self.symbol.Value)    # Prints "GOOG"
var symbol = AddEquity("GOOG").Symbol;
Debug(symbol.ID.Value); // Prints "GOOCV"
Debug(symbol.Value);    // Prints "GOOG"

If you create the security subscription with a universe selection function, the Value property of the Symbol object is the point-in-time ticker.

Decoding Symbols

When a SecurityIdentifier is serialized to a string, it looks something like SPY R735QTJ8XC9X . This two-part string is a base64 encoded set of data. Encoding all of the properties into a short format allows dense communication without requiring a third-party list or look-up. Most of the time, you will not need to work with these encoded strings. However, to deserialize the string into a Symbol object, call the Symbol method.

var symbol = Symbol("GOOCV VP83T1ZUHROL");
symbol.ID.Market;     // => "USA"
symbol.SecurityType;  // => SecurityType.Equity
symbol.Value;         // => "GOOCV"
symbol = self.Symbol("GOOCV VP83T1ZUHROL")
symbol.ID.Market     # => "USA"
symbol.SecurityType  # => SecurityType.Equity
symbol.Value         # => "GOOCV"

The Market property distinguishes between tickers that have the same string value but represent different underlying assets. A prime example of this is the various market makers who have different prices for EURUSD. We store this data separately and as they have different fill prices, we treat the execution venues as different markets.

Tickers

Tickers are a string shortcode representation for an asset. Some examples of popular tickers include "AAPL" for Apple Corporation and "IBM" for International Business Machines Corporation. These tickers often change when the company rebrands or they undergo a merger or reverse merger.

The ticker of an asset is not the same as the Symbol . Symbol objects are permanent and track the underlying entity. When a company rebrands or changes its name, the Symbol object remains constant, giving algorithms a way to reliably track assets over time.

Tickers are also often reused by different brokerages. For example Coinbase, a leading US Crypto Brokerage lists the "BTCUSD" ticker for trading. Its competitor, Bitfinex, also lists "BTCUSD". You can trade both tickers with LEAN. Symbol objects allow LEAN to identify which market you reference in your algorithms.

To create a Symbol object for a point-in-time ticker, call the GenerateEquity method to create the security identifier and then call the Symbol constructor. For example, Heliogen, Inc. changed their ticker from ATHN to HLGN on December 31, 2021. To convert the ATHN ticker to the Equity Symbol , type:

ticker = "ATHN"
security_id = SecurityIdentifier.GenerateEquity(ticker, Market.USA, mappingResolveDate=datetime(2021, 12, 1))
symbol = Symbol(security_id, ticker)
var ticker = "ATHN";
var securityID = SecurityIdentifier.GenerateEquity(ticker, Market.USA, mappingResolveDate:new DateTime(2021, 12, 1));
var symbol = new Symbol(securityID, ticker);

In the preceding code snippet, the mappingResolveDate must be a date when the point-in-time ticker was trading.

Symbol Cache

To make using the API easier, we have built the Symbol Cache technology, which accepts strings and tries to guess which Symbol object you might mean. With the Symbol Cache, many methods can accept a string such as "IBM" instead of a complete Symbol object. We highly recommend you don't rely on this technology and instead save explicit references to your securities when you need them.

# Example 1: Relying On Symbol Cache:
self.AddEquity("IBM")         # Add by IBM string ticker, save reference to Symbol Cache.
self.MarketOrder("IBM", 100)  # Determine refering to IBM Equity from Symbol Cache.
self.History("AAPL", 14)      # Makes a guess referring to AAPL Equity.

# Example 2: Correctly Using Symbols: 
self.ibm = self.AddEquity("IBM").Symbol   # Add IBM Equity string ticker, save Symbol.
self.MarketOrder(self.ibm, 100)           # Use IBM Symbol in future API calls.

self.aapl = Symbol.Create("AAPL", SecurityType.Equity, Market.USA)
self.History(self.aapl, 14)
// Example 1: Relying On Symbol Cache:
AddEquity("IBM");         // Add by IBM string ticker, save reference to Symbol Cache.
MarketOrder("IBM", 100);  // Determine refering to IBM Equity from Symbol Cache.
History("AAPL", 14);      // Guess referring to AAPL Equity.

// Example 2: Correctly Using Symbols: 
var ibm = AddEquity("IBM").Symbol;   // Add IBM Equity string ticker, save Symbol.
MarketOrder(ibm, 100);               // Use IBM Symbol in future API calls.

var aapl = Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
History(aapl, 14);

Industry Standard Identifiers

You can convert industry-standard security identifiers like CUSIP, FIGI, ISIN, and SEDOL to Symbol objects and you can convert Symbol objects to industry-standard security identifiers.

CUSIP

To convert a Committee on Uniform Securities Identification Procedures (CUSIP) number to a Symbol or a Symbol to a CUSIP number, call the CUSIP method.

symbol = self.CUSIP("03783310") # AAPL Symbol
cusip = self.CUSIP(symbol) # AAPL CUSIP (03783310)
var symbol = CUSIP("03783310"); // AAPL Symbol
var cusip = CUSIP(symbol); // AAPL CUSIP (03783310)

FIGI

To convert a Financial Instrument Global Identifier (FIGI) to a Symbol or a Symbol to a FIGI, call the CompositeFIGI method.

symbol = self.CompositeFIGI("BBG000B9XRY4") # AAPL Symbol
figi = self.CompositeFIGI(symbol) # AAPL FIGI (BBG000B9XRY4)
var symbol = CompositeFIGI("BBG000B9XRY4"); // AAPL Symbol
var figi = CompositeFIGI(symbol); // AAPL FIGI (BBG000B9XRY4)

ISIN

To convert an International Securities Identification Number (ISIN) to a Symbol or a Symbol to an ISIN, call the ISIN method.

symbol = self.ISIN("US0378331005") # AAPL Symbol
isin = self.ISIN(symbol) # AAPL ISIN (US0378331005)
var symbol = ISIN("US0378331005"); // AAPL Symbol
var isin = ISIN(symbol); // AAPL ISIN (US0378331005)

SEDOL

To convert a Stock Exchange Daily Official List (SEDOL) number to a Symbol or a Symbol to a SEDOL number, call the SEDOL method.

symbol = self.SEDOL("2046251") # AAPL Symbol
sedol = self.SEDOL(symbol) # AAPL SEDOL (2046251)
var symbol = SEDOL("2046251"); // AAPL Symbol
var sedol = SEDOL(symbol); // AAPL SEDOL (2046251)

 

1.6 Event Handlers

Introduction

Event handlers are called during an algorithm execution to pass information to your strategy. Most of the events are not needed for simple strategies, but can be helpful for debugging issues in more complex algorithms.

Data Events

public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_symbol))
    {
        var myData = slice[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.symbol):
        my_data = slice[self.symbol]

The OnData method is the primary event handler for receiving financial data events to your algorithm. It is triggered sequentially at the point in time the data is available; in backtesting and live. For daily data this means the event is processed at midnight in backtesting or 6am the following day in live trading.

All data for a given moment of time is grouped in a single event, including custom data types. This data is passed with the Slice object.

When fill-forward is enabled for your asset, the OnData event handler will be called regularly even if there was no new data. This is the default behavior.

If the handler takes a long time to process, events will be queued up and the next event will be triggered again immediately. In live trading it is important to ensure your event handlers process quickly. Perform intensive computation before the market opens with a Scheduled Event , or a Train event.

For more information on the Slice object and OnData event, see Handling Data .

Securities Changed Event

public override void OnSecuritiesChanged(SecurityChanges changes)
{
    foreach (var security in changes.AddedSecurities)
    {
        Debug($"{Time}: Added {security.Symbol}");
    }
    foreach (var security in changes.RemovedSecurities)
    {
        Debug($"{Time}: Removed {security.Symbol}");
        
        if (security.Invested)
        {
            Liquidate(security.Symbol, "Removed from Universe");
        }
    }
}
def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.AddedSecurities:
        self.Debug(f"{self.Time}: Added {security.Symbol}")

    for security in changes.RemovedSecurities:
        self.Debug(f"{self.Time}: Removed {security.Symbol}")
        
        if security.Invested:
            self.Liquidate(security.Symbol, "Removed from Universe")

The OnSecuritiesChanged event notifies the algorithm when assets are added or removed from the universe. This can be due to changes in the Universe constituents , or an explicit call to the RemoveSecurity method.

The event is triggered immediately when the asset is removed from the universe; however the data feed for the asset may remain active if the algorithm has open orders.

For more information, see how to use Security Changed Events .

Order Events

public override void OnOrderEvent(OrderEvent orderEvent)
{
    var order = Transactions.GetOrderById(orderEvent.OrderId);
    if (orderEvent.Status == OrderStatus.Filled)
    {
        Debug($"{Time}: {order.Type}: {orderEvent}");
    }
}

public override void OnAssignmentOrderEvent(OrderEvent assignmentEvent)
{
    Log(assignmentEvent.ToString());
}
def OnOrderEvent(self, orderEvent: OrderEvent) -> None:
    order = self.Transactions.GetOrderById(orderEvent.OrderId)
    if orderEvent.Status == OrderStatus.Filled:
        self.Debug(f"{self.Time}: {order.Type}: {orderEvent}")

def OnAssignmentOrderEvent(self, assignmentEvent: OrderEvent) -> None:
    self.Log(str(assignmentEvent))

The OnOrderEvent method notifies the algorithm of new orders, and changes in the order status such as fill events and cancelations. For options assignment events there is a dedicated event handler OnAssignmentOrderEvent .

In backtesting order events are triggered synchronously after the main data events. In live trading, order events are asynchronously as they occur. To avoid infinite loops, we recommend not to place orders in the OnOrderEvent.

For more information, see how to use Order Events .

Brokerage Events

public override void OnBrokerageMessage(BrokerageMessageEvent message)
{
    if (message.Type== BrokerageMessageType.Reconnect)
    {
        Log($"{Time}: {message.Type}: Message: {message.Message}");
    }
}

public override void OnBrokerageDisconnect()
{
    Log($"Brokerage disconnection detected at {Time}.");
}
def OnBrokerageMessage(self, message: BrokerageMessageEvent) -> None: 
    if message.Type == BrokerageMessageType.Reconnect:
        self.Log(f"{self.Time}: {message.Type}: Message: {message.Message}")

def OnBrokerageDisconnect(self) -> None:
    self.Log("Brokerage disconnection detected")

The OnBrokerageDisconnect and OnBrokerageReconnect event handlers pass information to the algorithm about the brokerage connection status. This can be helpful for considering when to place a trade when a brokerage API is unreliable or under maintenance. The OnBrokerageMessage event handler provides information from the brokerages, including the disconnect and reconnect messages. Message content varies with each brokerage.

Brokerage events are triggered asynchronously in live trading, and are not created in backtesting.

Margin Call Events

public override void OnMarginCall(List requests)
{
    foreach (var orderRequest in requests) {
    }
}

public override void OnBrokerageDisconnect()
{
    Log($"Brokerage disconnection detected at {Time}.");
}
def OnMarginCall(self, requests): -> List[SubmitOrderRequest]: 
    # Modify order requests to choose what to liquidate.
    return requests

def OnMarginCallWarning()(self) -> None:
    self.Log("Margin call warning, 5% margin remaining")

The OnMarginCallWarning and OnMarginCall event handlers provide information and control over how to reduce algorithm leverage when performance is poor.

The OnMarginCallWarning method is called when there is less than 5% margin remaining, this gives you an opportunity to reduce leverage before an official margin call is performed by the brokerage. The OnMarginCall event handler is passed a list of SubmitOrderRequest objects which will be executed on exiting the method.

Margin events are called before the data events are processed.

The following demonstration demonstration processes suggested orders and modifies the qualities to liquidate more than necessary and prevent a second margin call. For more information, see how to handle Margin Calls .

Warmup Finished Event

public override void OnWarmupFinished()
{
    // Done warming up
}
def OnWarmupFinished(self) -> None:
    pass # Done warming up

The OnWarmupFinished event handler is triggered after initialization, and warm up is complete. This event signals that the initialization of the algorithm is complete.

For more information, see how to use Warm Up to prepare your algorithm.

End Of Algorithm Events

def OnEndOfAlgorithm(self) -> None:
    self.Debug("Algorithm done")
public override void OnEndOfAlgorithm()
{
    Debug("Algorithm done");
}

The OnEndOfAlgorithm event handler is when the algorithm has finished executing as its final step. This is helpful for performing final analysis, or saving algorithm state.

Event Flow

When you deploy an algorithm, LEAN first calls the Initialize method. In live mode, the engine loads your holdings and open orders from your brokerage account to add data subscriptions and populate the Securities , Portfolio , and Transactions objects. LEAN receives the data from the subscriptions, synchronizes the data to create a timeslice , and then performs the following steps. Your algorithm can spend up to 10 minutes on each timeslice unless you call the Train method.

  1. If it's a backtest, check if there are Scheduled Events in the past that didn't fire because there was no data between the previous slice and the current slice. LEAN automatically creates a Scheduled Event to call the OnEndOfDay method at the end of each day.
  2. In live mode, Scheduled Events occur in a separate thread from the algorithm manager, so they run at the correct time.

  3. Update the algorithm time.
  4. Update the CurrentSlice .
  5. Cancel all open orders for securities that changed their ticker .
  6. Add a Security object to the Securities collection for each new security in the universe.
  7. Update the Security objects with the latest data.
  8. Update the Cash objects in the CashBook with the latest data.
  9. Process fill models for non-market orders.
  10. Submit market on open orders to liquidate Equity Option contracts if the underlying Equity has a split warning .
  11. Process margin calls .
  12. If it's time to settle unsettled cash , perform settlement.
  13. Call the OnSecuritiesChanged method with the latest security changes.
  14. Apply dividends to the portfolio.
  15. For securities that have a split warning, update their portfolio holdings and adjust their open orders to account for the split.
  16. Update consolidators with the latest data.
  17. Pass custom data to the OnData method.
  18. Pass Dividends to the OnData method.
  19. Pass Splits to the OnData method.
  20. Pass Delistings to the OnData method.
  21. Pass TradeBars to the OnData method.
  22. Pass QuoteBars to the OnData method.
  23. Pass OptionChains to the OnData method.
  24. Pass Ticks to the OnData method.
  25. Pass the Slice to the OnData method.
  26. Perform universe selection .
  27. Pass the Slice to the Update method of each Alpha model .
  28. Pass the Insight objects from the Alpha model to the Portfolio Construction model .
  29. Pass the PortfolioTarget objects from the Portfolio Construction model to each Risk Management model .
  30. Pass the risk-adjusted PortfolioTarget objects from the Risk Management models to the Execution model .

When your algorithm stops executing, LEAN calls the OnEndOfAlgorithm method .

 

1.7 Python and LEAN

Introduction

The LEAN open-source package powers the core functionality of QuantConnect. Strategies plugin to LEAN to request data, and process trades. LEAN is written in C# and accessed in python with a defined API. Most of these interactions are using native python types, with a few key exceptions. To comfortably use LEAN you should learn to recognize error messages when you hit a non-native API, and how to convert back to a native type.

Enumerable Types

When LEAN returns an enumerable, the object should be converted to a list() to be easily read by python classes. Popular API methods which return an enumerable are shown below:

Historical Data

QuantConnect also provides methods to request historical data that return a pandas dataframe, or an enumerable. If loading a large amount of data using an enumerable streams the results reducing RAM usage.

The enumerable types might look like the MemoizingEnumerable that is a raw C# type accessible in python.



You can directly enumerate this object with standard python for loops, or to convert it to a native type, wrap the object in the list() :

Underlying Plugin Architecture

Your strategy code implements the QCAlgorithm class, which can communicate with the LEAN Engine. These method calls are done at the same speed as cython, directly invoking calls at the C layer of python. Your algorithm is imported as syntax checked, interpreted python.

 

1.8 Research Guide

Introduction

We aim to teach and inspire our community to create high-performing algorithmic trading strategies. We measure our success by the profits community members create through their live trading. As such, we try to build the best quantitative research techniques possible into the product to encourage a robust research process.

Hypothesis-Driven Research

We recommend you develop an algorithmic trading strategy based on a central hypothesis. You should develop an algorithm hypothesis at the start of your research and spend the remaining time exploring how to test your theory. If you find yourself deviating from your core theory or introducing code that isn't based around that hypothesis, you should stop and go back to thesis development.

Wang et al. (2014) illustrate the danger of creating your hypothesis based on test results. In their research, they examined the earnings yield factor in the technology sector over time. During 1998-1999, before the tech bubble burst, the factor was unprofitable. If you saw the results and then decided to bet against the factor during 2000-2002, you would have lost a lot of money because the factor performed extremely well during that time.

Hypothesis development is somewhat of an art and requires creativity and great observation skills. It is one of the most powerful skills a quant can learn. We recommend that an algorithm hypothesis follow the pattern of cause and effect. Your aim should be to express your strategy in the following sentence:

A change in {cause} leads to an {effect}.

To search for inspiration, consider causes from your own experience, intuition, or the media. Generally, causes of financial market movements fall into the following categories:

Consider the following examples:

Cause leads to Effect
Share class stocks are the same company, so any price divergence is irrational... A perfect pairs trade. Since they are the same company, the price will revert.
New stock addition to the S&P500 Index causes fund managers to buy up stock... An increase in the price of the new asset in the universe from buying pressure.
Increase in sunshine-hours increases the production of oranges... An increase in the supply of oranges, decreasing the price of Orange Juice Futures.
Allegations of fraud by the CEO causes investor faith in the stock to fall... A collapse of stock prices for the company as people panic.
FDA approval of a new drug opens up new markets for the pharmaceutical company... A jump in stock prices for the company.
Increasing federal interest rates restrict lending from banks, raising interest rates... Restricted REIT leverage and lower REIT ETF returns.

There are millions of potential alpha strategies to explore, each of them a candidate for an algorithm. Once you have chosen a strategy, we recommend exploring it for no more than 8-32 hours, depending on your coding ability.

Data Mining Driven Research

An alternative view is to follow any statistical anomaly without explaining it. In this case, you can use statistical techniques to identify the discontinuities and eliminate them when their edge is gone. Apparently, Renaissance Technologies has data mining models like this.

Overfitting

Overfitting occurs when you fine-tune the parameters of an algorithm to fit the detail and noise of backtesting data to the extent that it negatively impacts the performance of the algorithm on new data. The problem is that the parameters don't necessarily apply to new data and thus negatively impact the algorithm's ability to generalize and trade well in all market conditions. The following table shows ways that overfitting can manifest itself:

Data Practice Description
Data Dredging Performing many statistical tests on data and only paying attention to those that come back with significant results.
Hyper-Tuning Parameters Manually changing algorithm parameters to produce better results without altering the test data.
Overfit Regression Models Regression, machine learning, or other statistical models with too many variables will likely introduce overfitting to an algorithm.
Stale Testing Data Not changing the backtesting data set when testing the algorithm. Any improvements might not be able to be generalized to different datasets.

An algorithm that is dynamic and generalizes to new data is more valuable to funds and individual investors. It is more likely to survive across different market conditions and apply to new asset classes and markets.

If you have a collection of factors, you can backtest over a period of time to find the best-performing factors for the time period. If you then narrow the collection of factors to just the best-performing ones and backtest over the same period, the backtest will show great results. However, if you take the same best-performing factors and backtest them on an out-of-sample dataset, the performance will almost always underperform the in-sample period. To avoid issues with overfitting, follow these guidelines:

Look-ahead Bias

Look-ahead bias occurs when you use information from the future to inform decisions in the present. An example of look-ahead bias is using financial statement data to make trading decisions at the end of the reporting period instead of when the financial statement data was released. Another example is using updated financial statement data before the updated figures were actually available. Wang et al. (2014) show that using the date of when the period ends instead of when the data is actually available can increase the performance of the earnings yield factor by 60%.

Another culprit of look-ahead bias is adjusted price data. Splits and reverse splits can improve liquidity or attract certain investors, causing the performance of the stock to be different than without the split or reverse split. Wang et al (2014) build a portfolio using the 25 lowest priced stocks in the S&P index based on adjusted and non-adjusted prices. The portfolio based on adjusted prices greatly outperformed the one with raw prices in terms of return and Sharpe ratio . In this case, if you were to analyze the low price factor with adjusted prices, it would lead you to believe the factor is very informative, but it would not perform well out-of-sample with raw data.

Look-ahead bias can also occur if you set the universe to assets that have performed well during the backtest period or initialize indicators with values that have performed well during the backtest period. To avoid issues with look-ahead bias, trade a dynamic universe of assets and use point-in-time data. If point-in-time data is not available for the dataset you use, apply a reporting lag. Since the backtesting environment is event-driven and you can't pass the time frontier, it naturally helps to reduce the risk of look-ahead bias.

Survivorship Bias

Survivorship bias occurs when you test a strategy using only the securities that have survived to the end of the testing period and omit securities that have been delisted. If you use the current constituents of an index and backtest over the past, you'll most likely outperform the index because many of the underperformers have dropped out of the index over time and outperformers have been added to the index. In this case, the current constituent universe would consist of only outperformers. This technique is a form of look-ahead bias because if you were trading the strategy in real-time throughout the backtest period, you would not know the current index constituents until today.

If you analyze a dataset that has survivorship bias, you can discover results that are opposite of the true results. For example, Wang et al. (2014) analyze the low volatility factor using two universes. The first universe was the current S&P 500 constituents and the second universe was the point-in-time constituents. When they used the point-in-time constituents, the low volatility quintile outperformed the high volatility quintile. However, when they used the current constituents, the high volatility quintile significantly outperformed the low volatility quintile.

To avoid issues with survivorship bias, trade a dynamic universe of assets and use the datasets in the Dataset Market . We thoroughly vet the datasets we add to the market to ensure they're free of survivorship bias.

Outliers

Outliers in a dataset can have large impacts on how models train. In some cases, you may leave outliers in a dataset because they can contain useful information. In other cases, you may want to transform the data to handle the outlier data points. There are several common methods to handle outliers.

Winsorization Method

The winsorization method removes outliers at the $x$% of the extremes. For example, if you winsorize at 1%, it removes the 1% of data points with the lowest value and the 1% of data points with the highest value. This threshold percentage is subjective, so it can result in overfitting.

IQR Method

The interquartile range method removes data points that fall outside of the interval \([Q_1 - k (Q_3 - Q_1),\ Q_3 + k (Q_3 - Q_1)]\) for some constant \(k\ge 0\). This method can exclude up to 25% of observations on each side of the extremes. The interquartile range method doesn't work if the data is skewed or non-normal. Therefore, the disadvantage to this method is you need to review the factor distribution properties. If you need to, you can normalize the data with z-scores.

$$ Z = \frac{x - \mu}{\sigma} $$

Factor Ranking Method

The factor ranking method ranks the data values instead of taking their raw values. With this method, you don't need to remove any outlier data points. This method transforms the data into a uniform distribution. After converting the data to a uniform distribution, Wang et al. (2014) perform an inverse normal transformation to make the factor values normally distributed. Wang et al. found this ranking technique outperforms the z-score transformation, suggesting that the distance between factor scores doesn't add useful information.

 

1.9 Libraries

Introduction

Libraries (or packages) are third-party software that you can use in your projects. You can use many of the available open-source libraries to complement the classes and methods that you create. Libraries reduce your development time because it's faster to use a pre-built, open-source library than to write the functionality. Libraries can be used in backtesting, research, and live trading. The environments support various libraries for machine learning, plotting, and data processing. As members often request new libraries, we frequently add new libraries to the underlying docker image that runs the Lean engine.

This feature is primarily for Python algorithms as not all Python libraries are compatible with each other. We've bundled together different sets of libraries into distinct environments. To use the libraries of an environment, set the environment in your project and add the relevant using import statement of a library at the top of your file.

Default Environment Libraries

The default environment supports the following libraries:

# Name                        Version
absl-py                       1.4.0
adagio                        0.2.4
aesara                        2.8.12
aiodns                        3.0.0
aiohttp                       3.8.4
aiohttp-cors                  0.7.0
aiosignal                     1.3.1
alabaster                     0.7.13
ale-py                        0.7.4
alembic                       1.10.3
alpaca-trade-api              0.26
alphalens-reloaded            0.4.3
altair                        4.2.2
ansi2html                     1.8.0
antlr4-python3-runtime        4.11.1
anyio                         3.6.2
appdirs                       1.4.4
arch                          5.3.1
argon2-cffi                   21.3.0
argon2-cffi-bindings          21.2.0
arviz                         0.15.1
astropy                       5.2.1
asttokens                     2.2.1
astunparse                    1.6.3
async-timeout                 4.0.2
asyncio-nats-client           0.11.5
attrs                         23.1.0
autograd                      1.5
autokeras                     1.1.0
autoray                       0.6.3
AutoROM                       0.4.2
AutoROM.accept-rom-license    0.6.1
ax-platform                   0.3.0
Babel                         2.12.1
backcall                      0.2.0
bayesian-optimization         1.4.2
beautifulsoup4                4.11.2
bleach                        6.0.0
blessed                       1.20.0
blis                          0.7.9
blosc2                        2.0.0
bokeh                         2.4.3
boltons                       23.0.0
botorch                       0.8.2
Bottleneck                    1.3.7
brotlipy                      0.7.0
cachetools                    5.3.0
captum                        0.6.0
catalogue                     2.0.8
catboost                      1.1.1
category-encoders             2.6.0
ccxt                          3.0.72
certifi                       2022.12.7
cffi                          1.15.1
chardet                       5.1.0
charset-normalizer            2.0.4
check-shapes                  1.0.0
click                         7.1.2
clikit                        0.6.2
cloudpickle                   2.2.1
cmaes                         0.9.1
cmdstanpy                     1.1.0
colorama                      0.4.6
colorcet                      3.0.1
colorful                      0.5.5
colorlog                      6.7.0
colorlover                    0.3.0
colour                        0.1.5
comm                          0.1.3
commonmark                    0.9.1
conda                         23.3.1
conda-content-trust           0.1.3
conda-package-handling        2.0.2
conda_package_streaming       0.7.0
confection                    0.0.4
cons                          0.4.5
contourpy                     1.0.7
convertdate                   2.4.0
copulae                       0.7.7
copulas                       0.8.0
cramjam                       2.6.2
crashtest                     0.3.1
creme                         0.6.1
cryptography                  38.0.4
cufflinks                     0.17.3
cvxopt                        1.3.0
cvxpy                         1.3.0
cycler                        0.11.0
cymem                         2.0.7
Cython                        0.29.33
darts                         0.23.1
dash                          2.9.3
dash-core-components          2.0.0
dash-cytoscape                0.3.0
dash-html-components          2.0.0
dash-table                    5.0.0
dask                          2023.4.0
deap                          1.3.3
debugpy                       1.5.1
decorator                     5.1.1
defusedxml                    0.7.1
Deprecated                    1.2.13
dgl                           1.0.1
dill                          0.3.6
dimod                         0.12.3
diskcache                     5.6.1
distlib                       0.3.6
distributed                   2021.4.1
dm-tree                       0.1.8
docutils                      0.19
DoubleML                      0.5.2
dtreeviz                      2.2.1
dtw-python                    1.3.0
dwave-cloud-client            0.10.3
dwave-drivers                 0.4.4
dwave-greedy                  0.3.0
dwave-hybrid                  0.6.9
dwave-inspector               0.3.0
dwave-inspectorapp            0.3.0
dwave-neal                    0.6.0
dwave-networkx                0.8.12
dwave-ocean-sdk               6.1.1
dwave-preprocessing           0.5.3
dwave-samplers                1.0.0
dwave-system                  1.18.0
dwave-tabu                    0.5.0
dwavebinarycsp                0.2.0
dx                            0.1.22
ecos                          2.0.12
EMD-signal                    1.4.0
empyrical                     0.5.5
empyrical-reloaded            0.5.9
en-core-web-md                3.5.0
en-core-web-sm                3.5.0
entrypoints                   0.4
ephem                         4.1.4
et-xmlfile                    1.1.0
etuples                       0.3.8
exceptiongroup                1.1.1
exchange-calendars            4.2.6
executing                     1.2.0
ezyrb                         1.3.0.post2304
fastai                        2.7.11
fastai2                       0.0.30
fastcore                      1.5.29
fastdownload                  0.0.7
fasteners                     0.18
fastjsonschema                2.16.3
fastparquet                   2023.2.0
fastprogress                  1.0.3
fasttext                      0.9.2
featuretools                  0.23.1
filelock                      3.12.0
findiff                       0.9.2
finrl                         0.3.1
FixedEffectModel              0.0.5
Flask                         2.0.3
flatbuffers                   23.3.3
fonttools                     4.39.3
fracdiff                      0.9.0
frozendict                    2.3.7
frozenlist                    1.3.3
fs                            2.4.16
fsspec                        2023.4.0
fst-pso                       1.8.1
fugue                         0.8.3
fugue-sql-antlr               0.1.6
future                        0.18.3
fuzzy-c-means                 1.6.3
FuzzyTM                       2.0.5
gast                          0.4.0
gensim                        4.3.0
gevent                        22.10.2
gluonts                       0.12.3
google-api-core               2.11.0
google-auth                   2.17.3
google-auth-oauthlib          0.4.6
google-pasta                  0.2.0
googleapis-common-protos      1.59.0
gpflow                        2.7.0
gplearn                       0.4.2
gpustat                       1.1
GPUtil                        1.4.0
gpytorch                      1.9.1
graphviz                      0.20.1
greenlet                      2.0.2
grpcio                        1.54.0
gym                           0.21.0
Gymnasium                     0.26.3
gymnasium-notices             0.0.1
h2o                           3.40.0.1
h5netcdf                      1.1.0
h5py                          3.8.0
hijri-converter               2.2.4
hmmlearn                      0.2.8
holidays                      0.23
holoviews                     1.15.4
homebase                      1.0.1
hopcroftkarp                  1.2.5
html5lib                      1.1
httpstan                      4.9.1
hurst                         0.0.5
hvplot                        0.8.2
hyperopt                      0.2.7
idna                          3.4
iisignature                   0.24
ijson                         3.2.0.post0
imageio                       2.27.0
imagesize                     1.4.1
imbalanced-learn              0.10.1
importlib-metadata            4.13.0
importlib-resources           5.12.0
iniconfig                     2.0.0
injector                      0.20.1
interpret                     0.3.0
interpret-core                0.3.2
ipykernel                     6.22.0
ipython                       8.12.0
ipython-genutils              0.2.0
ipywidgets                    8.0.4
itsdangerous                  2.1.2
jax                           0.4.4
jaxlib                        0.4.4
jedi                          0.18.2
Jinja2                        3.1.2
joblib                        1.2.0
jqdatasdk                     1.8.11
json5                         0.9.11
jsonpatch                     1.32
jsonpointer                   2.0
jsonschema                    4.17.3
jupyter                       1.0.0
jupyter-bokeh                 3.0.5
jupyter-console               6.6.3
jupyter-dash                  0.4.2
jupyter-resource-usage        0.7.2
jupyter-server                1.24.0
jupyter_client                8.2.0
jupyter_core                  5.3.0
jupyterlab                    3.4.4
jupyterlab-pygments           0.2.2
jupyterlab-widgets            3.0.7
jupyterlab_server             2.22.1
keract                        4.5.1
keras                         2.11.0
keras-nlp                     0.4.1
keras-rl                      0.4.2
keras-tuner                   1.3.5
kiwisolver                    1.4.4
kmapper                       2.0.1
korean-lunar-calendar         0.3.1
kt-legacy                     1.0.5
langcodes                     3.3.0
lark                          1.1.5
lazy_loader                   0.2
lazypredict                   0.2.12
libclang                      16.0.0
lightgbm                      3.3.5
lime                          0.2.0.1
line-profiler                 4.0.2
linear-operator               0.3.0
littleutils                   0.2.2
livelossplot                  0.5.5
llvmlite                      0.39.1
locket                        1.0.0
logical-unification           0.4.5
LunarCalendar                 0.0.9
lxml                          4.9.2
lz4                           4.3.2
Mako                          1.2.4
Markdown                      3.4.3
MarkupSafe                    2.1.2
marshmallow                   3.19.0
matplotlib                    3.7.0
matplotlib-inline             0.1.6
miniful                       0.0.6
miniKanren                    1.0.3
minorminer                    0.2.9
mistune                       2.0.5
mljar-supervised              0.11.5
mlxtend                       0.21.0
mmh3                          2.5.1
modin                         0.18.1
mpi4py                        3.1.4
mplfinance                    0.12.9b7
mpmath                        1.2.1
msgpack                       1.0.4
mthree                        2.4.0
multidict                     6.0.4
multipledispatch              0.6.0
multiprocess                  0.70.14
multitasking                  0.0.11
murmurhash                    1.0.9
nbclassic                     0.5.5
nbclient                      0.7.3
nbconvert                     7.3.1
nbeats-keras                  1.8.0
nbeats-pytorch                1.8.0
nbformat                      5.8.0
nest-asyncio                  1.5.6
networkx                      2.8.8
neural-tangents               0.6.2
neuralprophet                 0.5.0
nfoursid                      1.0.1
nltk                          3.8.1
nose                          1.3.7
notebook                      6.5.4
notebook_shim                 0.2.2
ntlm-auth                     1.5.0
numba                         0.56.4
numerapi                      2.13.2
numexpr                       2.8.4
numpy                         1.23.5
numpydoc                      1.5.0
nvidia-cublas-cu11            11.10.3.66
nvidia-cuda-nvrtc-cu11        11.7.99
nvidia-cuda-runtime-cu11      11.7.99
nvidia-cudnn-cu11             8.5.0.96
nvidia-ml-py                  11.525.112
oauthlib                      3.2.2
openai                        0.26.5
opencensus                    0.11.2
opencensus-context            0.1.3
opencv-python                 4.7.0.72
openpyxl                      3.1.1
opt-einsum                    3.3.0
optuna                        3.1.0
orjson                        3.8.10
ortools                       9.4.1874
osqp                          0.6.2.post9
outdated                      0.2.2
packaging                     23.1
pandas                        1.5.3
pandas-datareader             0.10.0
pandas-flavor                 0.5.0
pandas-market-calendars       4.1.4
pandas-ta                     0.3.14b0
pandocfilters                 1.5.0
panel                         0.14.3
param                         1.13.0
parso                         0.8.3
partd                         1.4.0
pastel                        0.2.1
pathos                        0.3.0
pathy                         0.10.1
patsy                         0.5.3
pbr                           5.11.1
penaltymodel                  1.0.2
PennyLane                     0.29.0
PennyLane-Lightning           0.29.0
PennyLane-qiskit              0.29.0
persim                        0.3.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.5.0
pingouin                      0.5.3
pip                           22.3.1
pkgutil_resolve_name          1.3.10
platformdirs                  3.2.0
plotly                        5.13.1
plotly-resampler              0.8.3.2
plucky                        0.4.3
pluggy                        1.0.0
ply                           3.11
pmdarima                      2.0.2
polars                        0.16.9
pox                           0.3.2
ppft                          1.7.6.6
pprofile                      2.1.0
ppscore                       1.2.0
preshed                       3.0.8
prometheus-client             0.16.0
prompt-toolkit                3.0.38
property-cached               1.6.4
prophet                       1.1.2
protobuf                      3.19.6
psutil                        5.9.5
psycopg2-binary               2.9.6
ptvsd                         4.3.2
ptyprocess                    0.7.0
PuLP                          2.7.0
pure-eval                     0.2.2
py-cpuinfo                    9.0.0
py-heat                       0.0.6
py-heat-magic                 0.0.2
py-lets-be-rational           1.0.1
py-spy                        0.3.14
py-vollib                     1.0.1
py4j                          0.10.9.7
pyaml                         21.10.1
pyarrow                       11.0.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pybind11                      2.10.4
pycares                       4.3.0
pycosat                       0.6.4
pycparser                     2.21
pyct                          0.5.0
pydantic                      1.10.7
pyDeprecate                   0.3.2
pydevd-pycharm                201.8538.36
pydmd                         0.4.0.post2301
pyerfa                        2.0.0.3
pyfolio                       0.9.2
pyfolio-reloaded              0.9.5
pyFUME                        0.2.25
Pygments                      2.15.1
pykalman                      0.9.5
pylev                         1.4.0
pyluach                       2.2.0
pymannkendall                 1.4.3
pymc                          5.0.2
pymdptoolbox                  4.0b3
PyMeeus                       0.5.12
PyMySQL                       1.0.3
pynndescent                   0.5.9
pyod                          1.0.9
Pyomo                         6.5.0
pyOpenSSL                     22.0.0
pyparsing                     3.0.9
pyportfolioopt                1.5.4
pyqubo                        1.3.1
pyrb                          1.0.1
pyro-api                      0.1.2
pyro-ppl                      1.8.4
pyrsistent                    0.19.3
pysimdjson                    5.0.2
PySocks                       1.7.1
pystan                        3.6.0
pytensor                      2.9.1
pytest                        7.3.1
python-dateutil               2.8.2
python-statemachine           1.0.3
pytorch-ignite                0.4.11
pytorch-lightning             1.7.4
pytz                          2023.3
pyvinecopulib                 0.6.2
pyviz-comms                   2.2.1
PyWavelets                    1.4.1
PyYAML                        6.0
pyzmq                         25.0.2
qdldl                         0.1.7
qiskit                        0.41.1
qiskit-aer                    0.11.2
qiskit-ibmq-provider          0.20.1
qiskit-terra                  0.23.2
qpd                           0.4.1
qtconsole                     5.4.2
QtPy                          2.3.1
quadprog                      0.1.11
quantecon                     0.6.0
QuantLib                      1.29
QuantStats                    0.0.59
rauth                         0.7.3
ray                           2.3.0
rectangle-packer              2.0.1
regex                         2023.3.23
requests                      2.28.1
requests-ntlm                 1.1.0
requests-oauthlib             1.3.1
retrying                      1.3.4
retworkx                      0.12.1
rich                          12.4.4
ripser                        0.6.4
Riskfolio-Lib                 4.0.3
riskparityportfolio           0.4
river                         0.14.0
rsa                           4.9
ruamel.yaml                   0.17.21
ruamel.yaml.clib              0.2.6
ruptures                      1.1.7
rustworkx                     0.12.1
SALib                         1.4.7
scikeras                      0.10.0
scikit-image                  0.19.3
scikit-learn                  1.2.1
scikit-learn-extra            0.2.0
scikit-multiflow              0.5.3
scikit-optimize               0.9.0
scikit-plot                   0.3.7
scikit-tda                    1.0.0
scipy                         1.10.1
scs                           3.2.3
sdeint                        0.3.0
seaborn                       0.12.2
semantic-version              2.10.0
Send2Trash                    1.8.0
setuptools                    64.0.2
setuptools-scm                7.1.0
shap                          0.41.0
simpful                       2.10.0
simplejson                    3.19.1
simpy                         4.0.1
six                           1.16.0
sklearn-json                  0.1.0
skope-rules                   1.0.1
sktime                        0.16.1
slicer                        0.0.7
smart-open                    6.3.0
sniffio                       1.3.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.4.1
spacy                         3.5.0
spacy-legacy                  3.0.12
spacy-loggers                 1.0.4
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy                    1.4.47
sqlglot                       11.5.5
srsly                         2.4.6
ssm                           0.0.1
stable-baselines3             1.7.0
stack-data                    0.6.2
statsforecast                 1.5.0
statsmodels                   0.13.5
stellargraph                  1.2.1
stevedore                     5.0.0
stochastic                    0.7.0
stockstats                    0.5.2
stumpy                        1.11.1
symengine                     0.10.0
sympy                         1.11.1
ta                            0.10.2
TA-Lib                        0.4.18
tables                        3.8.0
tabulate                      0.8.10
tadasets                      0.0.4
tbats                         1.1.3
tblib                         1.7.0
tenacity                      8.2.2
tensorboard                   2.11.2
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.1
tensorboardX                  2.6
tensorflow                    2.11.0
tensorflow-addons             0.19.0
tensorflow-decision-forests   1.2.0
tensorflow-estimator          2.11.0
tensorflow-hub                0.13.0
tensorflow-io-gcs-filesystem  0.32.0
tensorflow-probability        0.19.0
tensorflow-text               2.11.0
tensorly                      0.8.0
tensortrade                   1.0.3
termcolor                     2.2.0
terminado                     0.17.1
tf2jax                        0.3.3
thinc                         8.1.9
threadpoolctl                 3.1.0
thriftpy2                     0.4.16
thundergbm                    0.3.17
tick                          0.7.0.1
tifffile                      2023.4.12
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
toolz                         0.12.0
torch                         1.13.1
torch-cluster                 1.6.0
torch-geometric               2.2.0
torch-scatter                 2.1.0
torch-sparse                  0.6.16
torch-spline-conv             1.2.1
torchmetrics                  0.9.3
torchvision                   0.14.1
tornado                       6.3
tqdm                          4.64.1
trace-updater                 0.0.9.1
trading-calendars             2.1.1
traitlets                     5.9.0
treeinterpreter               0.2.3
triad                         0.8.6
tsfresh                       0.20.0
tslearn                       0.5.3.2
tweepy                        4.10.0
typeguard                     3.0.2
typer                         0.3.2
typing_extensions             4.5.0
umap-learn                    0.5.3
urllib3                       1.26.14
virtualenv                    20.21.0
wasabi                        1.1.1
wcwidth                       0.2.6
webargs                       8.2.0
webencodings                  0.5.1
websocket-client              1.5.1
websockets                    10.4
Werkzeug                      2.2.3
wheel                         0.37.1
widgetsnbextension            4.0.7
wordcloud                     1.8.2.2
wrapt                         1.14.1
wrds                          3.1.6
wurlitzer                     3.0.3
xarray                        2023.1.0
xarray-einstats               0.5.1
xgboost                       1.7.4
xlrd                          2.0.1
XlsxWriter                    3.1.0
yarl                          1.8.2
yellowbrick                   1.5
yfinance                      0.2.18
zict                          3.0.0
zipp                          3.15.0
zope.event                    4.6
zope.interface                6.0
zstandard                     0.18.0
# Name                               Version
Accord                               3.6.0
Accord.Fuzzy                         3.6.0
Accord.MachineLearning               3.6.0
Accord.Math                          3.6.0
Accord.Statistics                    3.6.0
CloneExtensions                      1.3.0
Common.Logging                       3.4.1
Common.Logging.Core                  3.4.1
CsvHelper                            19.0.0
Deedle                               2.1.0
DotNetZip                            1.16.0
DynamicInterop                       0.9.1
fasterflect                          3.0.0
FSharp.Core                          4.5.2
MathNet.Numerics                     4.15.0
McMaster.Extensions.CommandLineUtils 2.6.0
Microsoft.IO.RecyclableMemoryStream  2.3.1
Microsoft.NET.Test.Sdk               16.9.4
Microsoft.TestPlatform.ObjectModel   16.9.4
Moq                                  4.16.1
NetMQ                                4.0.1.6
Newtonsoft.Json                      13.0.2
NodaTime                             3.0.5
NUnit                                3.13.3
NUnit3TestAdapter                    4.2.1
protobuf-net                         3.1.33
QLNet                                1.12.0
QuantConnect.pythonnet               2.0.18
RestSharp                            106.12.0
SharpZipLib                          1.3.3
System.ComponentModel.Composition    6.0.0

Pomegranate Environment Libraries

The Pomegranate environment cannot be selected on C# projects.

The Pomegranate environment supports the following libraries:

# Name                        Version
absl-py                       1.4.0
adagio                        0.2.4
aesara                        2.8.12
aiodns                        3.0.0
aiohttp                       3.8.4
aiohttp-cors                  0.7.0
aiosignal                     1.3.1
alabaster                     0.7.13
ale-py                        0.7.4
alembic                       1.10.3
alpaca-trade-api              0.26
alphalens-reloaded            0.4.3
altair                        4.2.2
ansi2html                     1.8.0
antlr4-python3-runtime        4.11.1
anyio                         3.6.2
appdirs                       1.4.4
arch                          5.3.1
argon2-cffi                   21.3.0
argon2-cffi-bindings          21.2.0
arviz                         0.15.1
astropy                       5.2.1
asttokens                     2.2.1
astunparse                    1.6.3
async-timeout                 4.0.2
asyncio-nats-client           0.11.5
attrs                         23.1.0
autograd                      1.5
autokeras                     1.1.0
autoray                       0.6.3
AutoROM                       0.4.2
AutoROM.accept-rom-license    0.6.1
ax-platform                   0.3.0
Babel                         2.12.1
backcall                      0.2.0
bayesian-optimization         1.4.2
beautifulsoup4                4.11.2
bleach                        6.0.0
blessed                       1.20.0
blis                          0.7.9
blosc2                        2.0.0
bokeh                         2.4.3
boltons                       23.0.0
botorch                       0.8.2
Bottleneck                    1.3.7
brotlipy                      0.7.0
cachetools                    5.3.0
captum                        0.6.0
catalogue                     2.0.8
catboost                      1.1.1
category-encoders             2.6.0
ccxt                          3.0.72
certifi                       2022.12.7
cffi                          1.15.1
chardet                       5.1.0
charset-normalizer            2.0.4
check-shapes                  1.0.0
click                         7.1.2
clikit                        0.6.2
cloudpickle                   2.2.1
cmaes                         0.9.1
cmdstanpy                     1.1.0
colorama                      0.4.6
colorcet                      3.0.1
colorful                      0.5.5
colorlog                      6.7.0
colorlover                    0.3.0
colour                        0.1.5
comm                          0.1.3
commonmark                    0.9.1
conda                         23.3.1
conda-content-trust           0.1.3
conda-package-handling        2.0.2
conda_package_streaming       0.7.0
confection                    0.0.4
cons                          0.4.5
contourpy                     1.0.7
convertdate                   2.4.0
copulae                       0.7.7
copulas                       0.8.0
cramjam                       2.6.2
crashtest                     0.3.1
creme                         0.6.1
cryptography                  38.0.4
cufflinks                     0.17.3
cvxopt                        1.3.0
cvxpy                         1.3.0
cycler                        0.11.0
cymem                         2.0.7
Cython                        0.29.33
darts                         0.23.1
dash                          2.9.3
dash-core-components          2.0.0
dash-cytoscape                0.3.0
dash-html-components          2.0.0
dash-table                    5.0.0
dask                          2023.4.0
deap                          1.3.3
debugpy                       1.5.1
decorator                     5.1.1
defusedxml                    0.7.1
Deprecated                    1.2.13
dgl                           1.0.1
dill                          0.3.6
dimod                         0.12.3
diskcache                     5.6.1
distlib                       0.3.6
distributed                   2021.4.1
dm-tree                       0.1.8
docutils                      0.19
DoubleML                      0.5.2
dtreeviz                      2.2.1
dtw-python                    1.3.0
dwave-cloud-client            0.10.3
dwave-drivers                 0.4.4
dwave-greedy                  0.3.0
dwave-hybrid                  0.6.9
dwave-inspector               0.3.0
dwave-inspectorapp            0.3.0
dwave-neal                    0.6.0
dwave-networkx                0.8.12
dwave-ocean-sdk               6.1.1
dwave-preprocessing           0.5.3
dwave-samplers                1.0.0
dwave-system                  1.18.0
dwave-tabu                    0.5.0
dwavebinarycsp                0.2.0
dx                            0.1.22
ecos                          2.0.12
EMD-signal                    1.4.0
empyrical                     0.5.5
empyrical-reloaded            0.5.9
en-core-web-md                3.5.0
en-core-web-sm                3.5.0
entrypoints                   0.4
ephem                         4.1.4
et-xmlfile                    1.1.0
etuples                       0.3.8
exceptiongroup                1.1.1
exchange-calendars            4.2.6
executing                     1.2.0
ezyrb                         1.3.0.post2304
fastai                        2.7.11
fastai2                       0.0.30
fastcore                      1.5.29
fastdownload                  0.0.7
fasteners                     0.18
fastjsonschema                2.16.3
fastparquet                   2023.2.0
fastprogress                  1.0.3
fasttext                      0.9.2
featuretools                  0.23.1
filelock                      3.12.0
findiff                       0.9.2
finrl                         0.3.1
FixedEffectModel              0.0.5
Flask                         2.0.3
flatbuffers                   23.3.3
fonttools                     4.39.3
fracdiff                      0.9.0
frozendict                    2.3.7
frozenlist                    1.3.3
fs                            2.4.16
fsspec                        2023.4.0
fst-pso                       1.8.1
fugue                         0.8.3
fugue-sql-antlr               0.1.6
future                        0.18.3
fuzzy-c-means                 1.6.3
FuzzyTM                       2.0.5
gast                          0.4.0
gensim                        4.3.0
gevent                        22.10.2
gluonts                       0.12.3
google-api-core               2.11.0
google-auth                   2.17.3
google-auth-oauthlib          0.4.6
google-pasta                  0.2.0
googleapis-common-protos      1.59.0
gpflow                        2.7.0
gplearn                       0.4.2
gpustat                       1.1
GPUtil                        1.4.0
gpytorch                      1.9.1
graphviz                      0.8.4
greenlet                      2.0.2
grpcio                        1.54.0
gym                           0.21.0
Gymnasium                     0.26.3
gymnasium-notices             0.0.1
h2o                           3.40.0.1
h5netcdf                      1.1.0
h5py                          3.8.0
hijri-converter               2.2.4
hmmlearn                      0.2.8
holidays                      0.23
holoviews                     1.15.4
homebase                      1.0.1
hopcroftkarp                  1.2.5
html5lib                      1.1
httpstan                      4.9.1
hurst                         0.0.5
hvplot                        0.8.2
hyperopt                      0.2.7
idna                          3.4
iisignature                   0.24
ijson                         3.2.0.post0
imageio                       2.27.0
imagesize                     1.4.1
imbalanced-learn              0.10.1
importlib-metadata            4.13.0
importlib-resources           5.12.0
iniconfig                     2.0.0
injector                      0.20.1
interpret                     0.3.0
interpret-core                0.3.2
ipykernel                     6.22.0
ipython                       8.12.0
ipython-genutils              0.2.0
ipywidgets                    8.0.4
itsdangerous                  2.1.2
jax                           0.4.4
jaxlib                        0.4.4
jedi                          0.18.2
Jinja2                        3.1.2
joblib                        1.2.0
jqdatasdk                     1.8.11
json5                         0.9.11
jsonpatch                     1.32
jsonpointer                   2.0
jsonschema                    4.17.3
jupyter                       1.0.0
jupyter-bokeh                 3.0.5
jupyter-console               6.6.3
jupyter-dash                  0.4.2
jupyter-resource-usage        0.7.2
jupyter-server                1.24.0
jupyter_client                8.2.0
jupyter_core                  5.3.0
jupyterlab                    3.4.4
jupyterlab-pygments           0.2.2
jupyterlab-widgets            3.0.7
jupyterlab_server             2.22.1
keract                        4.5.1
keras                         2.11.0
keras-nlp                     0.4.1
keras-rl                      0.4.2
keras-tuner                   1.3.5
kiwisolver                    1.4.4
kmapper                       2.0.1
korean-lunar-calendar         0.3.1
kt-legacy                     1.0.5
langcodes                     3.3.0
lark                          1.1.5
lazy_loader                   0.2
lazypredict                   0.2.12
libclang                      16.0.0
lightgbm                      3.3.5
lime                          0.2.0.1
line-profiler                 4.0.2
linear-operator               0.3.0
littleutils                   0.2.2
livelossplot                  0.5.5
llvmlite                      0.38.1
locket                        1.0.0
logical-unification           0.4.5
LunarCalendar                 0.0.9
lxml                          4.9.2
lz4                           4.3.2
Mako                          1.2.4
Markdown                      3.4.3
MarkupSafe                    2.1.2
marshmallow                   3.19.0
matplotlib                    3.7.0
matplotlib-inline             0.1.6
miniful                       0.0.6
miniKanren                    1.0.3
minorminer                    0.2.9
mistune                       2.0.5
mljar-supervised              0.11.5
mlxtend                       0.21.0
mmh3                          2.5.1
modin                         0.18.1
mpi4py                        3.1.4
mplfinance                    0.12.9b7
mpmath                        1.2.1
msgpack                       1.0.4
mthree                        2.4.0
multidict                     6.0.4
multipledispatch              0.6.0
multiprocess                  0.70.14
multitasking                  0.0.11
murmurhash                    1.0.9
mxnet                         1.9.1
nbclassic                     0.5.5
nbclient                      0.7.3
nbconvert                     7.3.1
nbeats-keras                  1.8.0
nbeats-pytorch                1.8.0
nbformat                      5.8.0
nest-asyncio                  1.5.6
networkx                      2.8.8
neural-tangents               0.6.2
neuralprophet                 0.5.0
nfoursid                      1.0.1
nltk                          3.8.1
nose                          1.3.7
notebook                      6.5.4
notebook_shim                 0.2.2
ntlm-auth                     1.5.0
numba                         0.55.1
numerapi                      2.13.2
numexpr                       2.8.4
numpy                         1.21.5
numpydoc                      1.5.0
nvidia-cublas-cu11            11.10.3.66
nvidia-cuda-nvrtc-cu11        11.7.99
nvidia-cuda-runtime-cu11      11.7.99
nvidia-cudnn-cu11             8.5.0.96
nvidia-ml-py                  11.525.112
oauthlib                      3.2.2
openai                        0.26.5
opencensus                    0.11.2
opencensus-context            0.1.3
opencv-python                 4.7.0.72
openpyxl                      3.1.1
opt-einsum                    3.3.0
optuna                        3.1.0
orjson                        3.8.10
ortools                       9.4.1874
osqp                          0.6.2.post9
outdated                      0.2.2
packaging                     23.1
pandas                        1.5.3
pandas-datareader             0.10.0
pandas-flavor                 0.5.0
pandas-market-calendars       4.1.4
pandas-ta                     0.3.14b0
pandocfilters                 1.5.0
panel                         0.14.3
param                         1.13.0
parso                         0.8.3
partd                         1.4.0
pastel                        0.2.1
pathos                        0.3.0
pathy                         0.10.1
patsy                         0.5.3
pbr                           5.11.1
penaltymodel                  1.0.2
PennyLane                     0.29.0
PennyLane-Lightning           0.29.0
PennyLane-qiskit              0.29.0
persim                        0.3.1
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.5.0
pingouin                      0.5.3
pip                           22.0.4
pkgutil_resolve_name          1.3.10
platformdirs                  3.2.0
plotly                        5.13.1
plotly-resampler              0.8.3.2
plucky                        0.4.3
pluggy                        1.0.0
ply                           3.11
pmdarima                      2.0.2
polars                        0.16.9
pomegranate                   0.14.8
pox                           0.3.2
ppft                          1.7.6.6
pprofile                      2.1.0
ppscore                       1.2.0
preshed                       3.0.8
prometheus-client             0.16.0
prompt-toolkit                3.0.38
property-cached               1.6.4
prophet                       1.1.2
protobuf                      3.19.6
psutil                        5.9.5
psycopg2-binary               2.9.6
ptvsd                         4.3.2
ptyprocess                    0.7.0
PuLP                          2.7.0
pure-eval                     0.2.2
py-cpuinfo                    9.0.0
py-heat                       0.0.6
py-heat-magic                 0.0.2
py-lets-be-rational           1.0.1
py-spy                        0.3.14
py-vollib                     1.0.1
py4j                          0.10.9.7
pyaml                         21.10.1
pyarrow                       11.0.0
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pybind11                      2.10.4
pycares                       4.3.0
pycosat                       0.6.4
pycparser                     2.21
pyct                          0.5.0
pydantic                      1.10.7
pyDeprecate                   0.3.2
pydevd-pycharm                201.8538.36
pydmd                         0.4.0.post2301
pyerfa                        2.0.0.3
pyfolio                       0.9.2
pyfolio-reloaded              0.9.5
pyFUME                        0.2.25
Pygments                      2.15.1
pykalman                      0.9.5
pylev                         1.4.0
pyluach                       2.2.0
pymannkendall                 1.4.3
pymc                          5.0.2
pymdptoolbox                  4.0b3
PyMeeus                       0.5.12
PyMySQL                       1.0.3
pynndescent                   0.5.9
pyod                          1.0.9
Pyomo                         6.5.0
pyOpenSSL                     22.0.0
pyparsing                     3.0.9
pyportfolioopt                1.5.4
pyqubo                        1.3.1
pyrb                          1.0.1
pyro-api                      0.1.2
pyro-ppl                      1.8.4
pyrsistent                    0.19.3
pysimdjson                    5.0.2
PySocks                       1.7.1
pystan                        3.6.0
pytensor                      2.9.1
pytest                        7.3.1
python-dateutil               2.8.2
python-statemachine           1.0.3
pytorch-ignite                0.4.11
pytorch-lightning             1.7.4
pytz                          2023.3
pyvinecopulib                 0.6.2
pyviz-comms                   2.2.1
PyWavelets                    1.4.1
PyYAML                        6.0
pyzmq                         25.0.2
qdldl                         0.1.7
qiskit                        0.41.1
qiskit-aer                    0.11.2
qiskit-ibmq-provider          0.20.1
qiskit-terra                  0.23.2
qpd                           0.4.1
qtconsole                     5.4.2
QtPy                          2.3.1
quadprog                      0.1.11
quantecon                     0.6.0
QuantLib                      1.29
QuantStats                    0.0.59
rauth                         0.7.3
ray                           2.3.0
rectangle-packer              2.0.1
regex                         2023.3.23
requests                      2.28.1
requests-ntlm                 1.1.0
requests-oauthlib             1.3.1
retrying                      1.3.4
retworkx                      0.12.1
rich                          12.4.4
ripser                        0.6.4
Riskfolio-Lib                 4.0.3
riskparityportfolio           0.4
river                         0.14.0
rsa                           4.9
ruamel.yaml                   0.17.21
ruamel.yaml.clib              0.2.6
ruptures                      1.1.7
rustworkx                     0.12.1
SALib                         1.4.7
scikeras                      0.10.0
scikit-image                  0.19.3
scikit-learn                  1.2.1
scikit-learn-extra            0.2.0
scikit-multiflow              0.5.3
scikit-optimize               0.9.0
scikit-plot                   0.3.7
scikit-tda                    1.0.0
scipy                         1.8.0
scs                           3.2.3
sdeint                        0.3.0
seaborn                       0.12.2
semantic-version              2.10.0
Send2Trash                    1.8.0
setuptools                    56.0.0
setuptools-scm                7.1.0
shap                          0.41.0
simpful                       2.10.0
simplejson                    3.19.1
simpy                         4.0.1
six                           1.16.0
sklearn-json                  0.1.0
skope-rules                   1.0.1
sktime                        0.16.1
slicer                        0.0.7
smart-open                    6.3.0
sniffio                       1.3.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.4.1
spacy                         3.5.0
spacy-legacy                  3.0.12
spacy-loggers                 1.0.4
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
SQLAlchemy                    1.4.47
sqlglot                       11.5.5
srsly                         2.4.6
ssm                           0.0.1
stable-baselines3             1.7.0
stack-data                    0.6.2
statsforecast                 1.5.0
statsmodels                   0.13.5
stellargraph                  1.2.1
stevedore                     5.0.0
stochastic                    0.7.0
stockstats                    0.5.2
stumpy                        1.11.1
symengine                     0.10.0
sympy                         1.11.1
ta                            0.10.2
TA-Lib                        0.4.18
tables                        3.8.0
tabulate                      0.8.10
tadasets                      0.0.4
tbats                         1.1.3
tblib                         1.7.0
tenacity                      8.2.2
tensorboard                   2.11.2
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.1
tensorboardX                  2.6
tensorflow                    2.11.0
tensorflow-addons             0.19.0
tensorflow-decision-forests   1.2.0
tensorflow-estimator          2.11.0
tensorflow-hub                0.13.0
tensorflow-io-gcs-filesystem  0.32.0
tensorflow-probability        0.19.0
tensorflow-text               2.11.0
tensorly                      0.8.0
tensortrade                   1.0.3
termcolor                     2.2.0
terminado                     0.17.1
tf2jax                        0.3.3
thinc                         8.1.9
threadpoolctl                 3.1.0
thriftpy2                     0.4.16
thundergbm                    0.3.17
tick                          0.7.0.1
tifffile                      2023.4.12
tigramite                     5.1.0.3
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
toolz                         0.12.0
torch                         1.13.1
torch-cluster                 1.6.0
torch-geometric               2.2.0
torch-scatter                 2.1.0
torch-sparse                  0.6.16
torch-spline-conv             1.2.1
torchmetrics                  0.9.3
torchvision                   0.14.1
tornado                       6.3
tqdm                          4.64.1
trace-updater                 0.0.9.1
trading-calendars             2.1.1
traitlets                     5.9.0
treeinterpreter               0.2.3
triad                         0.8.6
tsfresh                       0.20.0
tslearn                       0.5.3.2
tweepy                        4.10.0
typeguard                     3.0.2
typer                         0.3.2
typing_extensions             4.5.0
umap-learn                    0.5.3
urllib3                       1.26.14
virtualenv                    20.21.0
wasabi                        1.1.1
wcwidth                       0.2.6
webargs                       8.2.0
webencodings                  0.5.1
websocket-client              1.5.1
websockets                    10.4
Werkzeug                      2.2.3
wheel                         0.37.1
widgetsnbextension            4.0.7
wordcloud                     1.8.2.2
wrapt                         1.14.1
wrds                          3.1.6
wurlitzer                     3.0.3
xarray                        2023.1.0
xarray-einstats               0.5.1
xgboost                       1.7.4
xlrd                          2.0.1
XlsxWriter                    3.1.0
yarl                          1.8.2
yellowbrick                   1.5
yfinance                      0.2.18
zict                          3.0.0
zipp                          3.15.0
zope.event                    4.6
zope.interface                6.0
zstandard                     0.18.0

Hudson & Thames Environment

The Hudson & Thames environment cannot be selected on C# projects.

The Hudson & Thames environment supports the following libraries:

# Name                       Version
absl-py                      1.3.0
analytics-python             1.4.0
ansi2html                    1.8.0
anyio                        3.6.2
appdirs                      1.4.4
arch                         4.16.1
argon2-cffi                  21.3.0
argon2-cffi-bindings         21.2.0
asttokens                    2.2.1
astunparse                   1.6.3
attrs                        22.2.0
Babel                        2.11.0
backcall                     0.2.0
backoff                      1.10.0
beautifulsoup4               4.11.1
bleach                       5.0.1
Brotli                       1.0.9
bs4                          0.0.1
cachetools                   5.2.0
certifi                      2022.12.7
cffi                         1.15.1
charset-normalizer           2.1.1
click                        8.1.3
cloudpickle                  2.2.0
clr-loader                   0.1.6
comm                         0.1.2
cramjam                      2.6.2
cssselect                    1.2.0
cvxpy                        1.2.0
cycler                       0.11.0
Cython                       0.29.28
dash                         1.21.0
dash-bootstrap-components    0.13.1
dash-core-components         1.17.1
dash-cytoscape               0.2.0
dash-html-components         1.1.4
dash-table                   4.12.0
dask                         2022.12.1
debugpy                      1.6.4
decorator                    4.4.2
defusedxml                   0.7.1
distributed                  2022.12.1
ecos                         2.0.12
entrypoints                  0.4
executing                    1.2.0
fake-useragent               1.1.1
fastjsonschema               2.16.2
fastparquet                  0.8.1
Flask                        2.1.3
Flask-Compress               1.13
flatbuffers                  22.12.6
fsspec                       2022.11.0
future                       0.18.2
gast                         0.5.3
getmac                       0.8.3
google-auth                  2.15.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.51.1
h5py                         3.7.0
HeapDict                     1.0.1
ht-auth                      0.1.0
idna                         3.4
importlib-metadata           5.2.0
importlib-resources          5.10.1
ipykernel                    6.19.4
ipython                      8.7.0
ipython-genutils             0.2.0
itsdangerous                 2.1.2
jedi                         0.18.2
Jinja2                       3.1.2
joblib                       1.2.0
json5                        0.9.10
jsonschema                   4.17.3
jupyter_client               7.4.8
jupyter_core                 5.1.1
jupyter-dash                 0.4.2
jupyter-server               1.23.4
jupyterlab                   3.4.4
jupyterlab-pygments          0.2.2
jupyterlab_server            2.17.0
keras                        2.8.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.4
libclang                     14.0.6
llvmlite                     0.39.1
locket                       1.0.0
lxml                         4.6.2
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.4.3
matplotlib-inline            0.1.6
matrixprofile                1.1.10
mistune                      2.0.4
mlfinlab                     1.6.0
monotonic                    1.6
mpmath                       1.2.1
msgpack                      1.0.4
multitasking                 0.0.11
nbclassic                    0.4.8
nbclient                     0.7.2
nbconvert                    7.2.7
nbformat                     5.7.1
nest-asyncio                 1.5.6
networkx                     2.5.1
notebook                     6.5.2
notebook_shim                0.2.2
numba                        0.56.4
numpy                        1.20.1
oauthlib                     3.2.2
opt-einsum                   3.3.0
osqp                         0.6.2.post8
packaging                    22.0
pandas                       1.1.5
pandocfilters                1.5.0
parse                        1.19.0
parso                        0.8.3
partd                        1.3.0
patsy                        0.5.3
pexpect                      4.8.0
pickleshare                  0.7.5
Pillow                       9.3.0
pip                          22.0.4
pkgutil_resolve_name         1.3.10
platformdirs                 2.6.1
plotly                       5.11.0
pmdarima                     1.8.5
POT                          0.8.2
prometheus-client            0.15.0
prompt-toolkit               3.0.36
property-cached              1.6.4
protobuf                     3.11.2
psutil                       5.9.4
ptyprocess                   0.7.0
pure-eval                    0.2.2
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pybind11                     2.10.1
pycparser                    2.21
pyee                         8.2.2
Pygments                     2.13.0
pykalman                     0.9.5
pyparsing                    3.0.9
pyppeteer                    1.0.2
pyquery                      2.0.0
pyrsistent                   0.19.2
python-dateutil              2.8.2
pytz                         2022.7
pyvinecopulib                0.5.5
PyYAML                       6.0
pyzmq                        24.0.1
qdldl                        0.1.5.post2
requests                     2.28.1
requests-html                0.10.0
requests-oauthlib            1.3.1
retrying                     1.3.4
rsa                          4.9
scikit-learn                 0.24.2
scipy                        1.9.3
scs                          3.2.0
seaborn                      0.11.1
Send2Trash                   1.8.0
setuptools                   56.0.0
setuptools-scm               7.1.0
six                          1.16.0
sniffio                      1.3.0
sortedcontainers             2.4.0
soupsieve                    2.3.2.post1
stack-data                   0.6.2
statsmodels                  0.13.5
stumpy                       1.11.1
TA-Lib                       0.4.18
tblib                        1.7.0
tenacity                     8.1.0
tensorboard                  2.8.0
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.8.0
tensorflow-io-gcs-filesystem 0.29.0
termcolor                    2.1.1
terminado                    0.17.1
tf-estimator-nightly         2.8.0.dev2021122109
threadpoolctl                3.1.0
tinycss2                     1.2.1
tomli                        2.0.1
toolz                        0.12.0
tornado                      6.2
tqdm                         4.64.1
traitlets                    5.8.0
tsfresh                      0.19.0
typing_extensions            4.4.0
urllib3                      1.26.13
w3lib                        2.1.1
wcwidth                      0.2.5
webencodings                 0.5.1
websocket-client             1.4.2
websockets                   10.4
Werkzeug                     2.0.0
wheel                        0.38.4
wrapt                        1.14.1
yahoo-fin                    0.8.6
yfinance                     0.1.63
zict                         2.2.0
zipp                         3.11.0    

Add New Libraries

To request a new library, contact us . We will add the library to the queue for review and deployment. Since the libraries run on our servers, we need to ensure they are secure and won't cause harm. The process of adding new libraries takes 2-4 weeks to complete. View the list of libraries currently under review on the Issues list of the Lean GitHub repository .

Project Libraries

Project libraries are QuantConnect projects you can merge into your project to avoid duplicating code files. If you have tools that you use across several projects, create a library.

 

1.10 Glossary

Introduction

This page defines terms in QuantConnect products and documentation.

alpha

The quantity of an algorithm's returns that aren't explained by its underlying benchmark.

annual standard deviation

A staticial measure that describes the dispersion of annual returns relative to the mean annual return. It's the square root of the annual variance.

annual variance

A staticial measure that describes the dispersion of annual returns relative to the mean annual return.

average loss

The average rate of return for unprofitable trades.

average win

The average rate of return for profitable trades.

beta

The scale and direction of an algorithm's returns relative to movements in the underlying benchmark.

capacity

The maximum amount of money an algorithm can trade before its performance degrades from market impact.

compounding annual return

The annual percentage return that would be required to grow a portfolio from its starting value to its ending value.

day trade

Buying and selling the same asset within one trading day.

drawdown

The largest peak to trough decline in an algorithm's equity curve.

equity

The total portfolio value if all of the holdings were sold at current market rates.

expectancy

The expected return per trade.

holdings

The absolute sum of the items in the portfolio.

information ratio

The amount of excess return from the risk-free rate per unit of systematic risk.

look-ahead bias

The practice of making decisions using information that would not be available until some time in the future.

loss rate

The proportion of trades that were not profitable.

lowest capacity asset

The asset an algorithm traded that has the lowest capacity.

net profit

(Percent) The rate of return across the entire trading period.

(Dollar-value) The dollar-value return across the entire trading period.

pattern day trader

A trader who executes four or more day trades in the US Equity market within five business days.

Probabilistic Sharpe ratio

The probability that the estimated Sharpe ratio of an algorithm is greater than a benchmark (1).

profit-loss ratio

The ratio of the average win rate to the average loss rate.

return

The rate of return across the entire trading period.

Sharpe ratio

A measure of the risk-adjusted return, developed by William Sharpe.

total fees

The total quantity of fees paid for all the transactions.

total net profit

The rate of return across the entire trading period.

total trades

The number of orders that were filled or partially filled.

tracking error

A measure of how closely a portfolio follows the index to which it is benchmarked. A tracking error of 0 is a perfect match.

Treynor ratio

A measurement of the returns earned in an algorithm in excess of the risk-free rate per unit of benchmark risk, developed by Jack Treynor.

unrealized

The amount of profit a portfolio would capture if it liquidated all open positions and paid the fees for transacting and crossing the spread.

volume

The total value of assets traded for all of an algorithm's transactions.

win rate

The proportion of trades that were profitable after transaction fees.

 

2 Initialization

Introduction

The Initialize method is the entry point of your algorithm where you define a series of settings, including security subscriptions, starting cash balances, and warm-up periods. LEAN only calls the Initialize method one time, at the start of your algorithm.

Set Dates

To set the date range of backtests, call the SetStartDate and SetEndDate methods. The dates you provide are based in the algorithm time zone. By default, the end date is yesterday, one millisecond before midnight. In live trading, LEAN ignores the start and end dates.

SetStartDate(2013, 1, 5);                  // Set start date to January 5, 2013
SetEndDate(2015, 1, 5);                    // Set end date to January 5, 2015
SetEndDate(DateTime.Now.Date.AddDays(-7)); // Set end date to last week
self.SetStartDate(2013, 1, 5)                  # Set start date to January 5, 2013
self.SetEndDate(2015, 1, 5)                    # Set end date to January 5, 2015
self.SetEndDate(datetime.now() - timedelta(7)) # Set end date to last week

Set Account Currency

The algorithm equity curve, benchmark, and performance statistics are denominated in the account currency. To set the account currency, call the SetAccountCurrency method. By default, the account currency is USD. If you call the SetAccountCurrency method, you must call it before you call the SetCash method.

SetAccountCurrency("BTC"); // Set account currency to Bitcoin
SetAccountCurrency("INR"); // Set account currency to Indian Rupees
self.SetAccountCurrency("BTC") # Set account currency to Bitcoin
self.SetAccountCurrency("INR") # Set account currency to Indian Rupees

Set Cash

To set your starting cash in backtests, call the SetCash method. By default, your starting cash is $100,000 USD. In live trading, LEAN ignores the SetCash method and uses the cash balances in your brokerage account instead.

SetCash(100000);       // Set the quantity of the account currency to 100,000
SetCash("BTC", 10);    // Set the Bitcoin quantity to 10
SetCash("EUR", 10000); // Set the EUR quantity to 10,000
self.SetCash(100000)       # Set the quantity of the account currency to 100,000
self.SetCash("BTC", 10)    # Set the Bitcoin quantity to 10
self.SetCash("EUR", 10000) # Set the EUR quantity to 10,000

Set Brokerage and Cash Model

We model your algorithm with margin modeling by default, but you can select a cash account type. Cash accounts don't allow leveraged trading, whereas Margin accounts can support leverage on your account value. To set your brokerage and account type, call the SetBrokerageModel method. For more information about each brokerage and the account types they support, see the brokerage integration documentation. For more information about the reality models that the brokerage models set, see Supported Models .

SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin);
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash)

The AccountType enumeration has the following members:

Set Universe Settings

The universe settings of your algorithm configure some properties of the universe constituents. The following table describes the properties of the UniverseSettings object:

Property: ExtendedMarketHours

Should assets also feed extended market hours? You only receive extended market hours data if you create the subscription with an intraday resolution. If you create the subscription with daily resolution, the daily bars only reflect the regular trading hours.

Data Type: bool | Default Value: false False

Property: FillForward

Should asset data fill forward?

Data Type: bool | Default Value: true True

Property: MinimumTimeInUniverse

What's the minimum time assets should be in the universe?

Data Type: TimeSpan timedelta | Default Value: TimeSpan.FromDays(1) timedelta(1)

Property: Resolution

What resolution should assets use?

Data Type: Resolution | Default Value: Resolution.Minute

Property: ContractDepthOffset

What offset from the current front month should be used for continuous Future contracts ? 0 uses the front month and 1 uses the back month contract. This setting is only available for Future assets.

Data Type: int | Default Value: 0

Property: DataMappingMode

How should continuous Future contracts be mapped? This setting is only available for Future assets.

Data Type: DataMappingMode | Default Value: DataMappingMode.OpenInterest

Property: DataNormalizationMode

How should historical prices be adjusted? This setting is only available for Equity and Futures assets.

Data Type: DataNormalizationMode | Default Value: DataNormalizationMode.Adjusted

Property: Leverage

What leverage should assets use in the universe? This setting is not available for derivative assets.

Data Type: decimal float | Default Value: Security.NullLeverage

To set the UniverseSettings , update the preceding properties in the Initialize method before you add the "universe" These settings are globals, so they apply to all universes you create.

// Request second resolution data. This will be slow!
UniverseSettings.Resolution = Resolution.Second;
AddUniverse(MyCoarseFilterFunction);
# Request second resolution data. This will be slow!
self.UniverseSettings.Resolution = Resolution.Second
self.AddUniverse(self.MyCoarseFilterFunction)

Set Security Initializer

Instead of configuring global universe settings, you can individually configure the settings of each security in the universe with a security initializer. Security initializers let you apply any security-level reality model or special data requests on a per-security basis. To set the security initializer, in the Initialize method, call the SetSecurityInitializer method and then define the security initializer.

//In Initialize
SetSecurityInitializer(CustomSecurityInitializer);

private void CustomSecurityInitializer(Security security)
{
    // Disable trading fees
    security.SetFeeModel(new ConstantFeeModel(0, "USD"));
}
#In Initialize
self.SetSecurityInitializer(self.CustomSecurityInitializer)

def CustomSecurityInitializer(self, security: Security) -> None:
    # Disable trading fees
    security.SetFeeModel(ConstantFeeModel(0, "USD"))

For simple requests, you can use the functional implementation of the security initializer. This style lets you configure the security object with one line of code.

SetSecurityInitializer(security => security.SetFeeModel(new ConstantFeeModel(0, "USD")));
self.SetSecurityInitializer(lambda security: security.SetFeeModel(ConstantFeeModel(0, "USD")))

In some cases, you may want to trade a security in the same time loop that you create the security subscription. To avoid errors, use a security initializer to set the market price of each security to the last known price. The GetLastKnownPrices method seeds the security price by gathering the security data over the last 3 days. If there is no data during this period, the security price remains at 0.

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(security => seeder.SeedSecurity(security));
seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
self.SetSecurityInitializer(lambda security: seeder.SeedSecurity(security))

If you call the SetSecurityInitializer method, it overwrites the default security initializer. The default security initializer uses the security-level reality models of the brokerage model to set the following reality models of each security:

The default security initializer also sets the leverage of each security and intializes each security with a seeder function. To extend upon the default security initializer instead of overwriting it, create a custom BrokerageModelSecurityInitializer .

// In Initialize
SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));

// Outside of the algorithm class
class MySecurityInitializer : BrokerageModelSecurityInitializer
{
    public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
        : base(brokerageModel, securitySeeder) {}    
    
    public override void Initialize(Security security)
    {
        // First, call the superclass definition
        // This method sets the reality models of each security using the default reality models of the brokerage model
        base.Initialize(security);

        // Next, overwrite some of the reality models        
        security.SetFeeModel(new ConstantFeeModel(0, "USD"));    
    }
}
# In Initialize
self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

# Outside of the algorithm class
class MySecurityInitializer(BrokerageModelSecurityInitializer):

    def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
        super().__init__(brokerage_model, security_seeder)

    def Initialize(self, security: Security) -> None:
        # First, call the superclass definition
        # This method sets the reality models of each security using the default reality models of the brokerage model
        super().Initialize(security)

        # Next, overwrite some of the reality models        
        security.SetFeeModel(ConstantFeeModel(0, "USD"))

To set a seeder function without overwriting the reality models of the brokerage, use the standard BrokerageModelSecurityInitializer .

SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

Add Data

You can subscribe to asset, fundamental, alternative, and custom data. The Dataset Market provides 400TB of data that you can easily import into your algorithms.

Asset Data

To subscribe to asset data, call one of the asset subscription methods like AddEquity or AddForex . Each asset class has its own method to create subscriptions. For more information about how to create subscriptions for each asset class, see Asset Classes .

AddEquity("AAPL"); // Add Apple 1 minute bars (minute by default)
AddForex("EURUSD", Resolution.Second); // Add EURUSD 1 second bars
self.AddEquity("SPY")  # Add Apple 1 minute bars (minute by default)
self.AddForex("EURUSD", Resolution.Second) # Add EURUSD 1 second bars

In live trading, you define the securities you want, but LEAN also gets the securities in your live portfolio and sets their resolution to the lowest resolution of the subscriptions you made. For example, if you create subscriptions in your algorithm for securities with Second, Minute, and Hour resolutions, the assets in your live portfolio are given a resolution of Second.

Alternative Data

To add alternative datasets to your algorithms, call the AddData method. For full examples, in the Datasets chapter, select a dataset and see the Requesting Data section.

Custom Data

To add custom data to your algorithms, call the AddData method. For more information about custom data, see Importing Data .

Limitations

There is no official limit to how much data you can add to your algorithms, but there are practical resource limitations. Each security subscription requires about 5MB of RAM, so larger machines let you run algorithms with bigger universes. For more information about our cloud nodes, see Resources .

Set Indicators and Consolidators

You can create and warm-up indicators in the Initialize method.

private Symbol _symbol;
private SimpleMovingAverage _sma;

_symbol = AddEquity("SPY").Symbol;
_sma = SMA(_symbol, 20);
WarmUpIndicator(_symbol, _sma);
self.symbol = self.AddEquity("SPY").Symbol
self.sma = self.SMA(self.symbol, 20)
self.WarmUpIndicator(self.symbol, self.sma)

Set Algorithm Settings

The following table describes the AlgorithmSettings properties:

Property: DataSubscriptionLimit

The maximum number of concurrent market data subscriptions available.

Data Type: Int | Default Value: int.MaxValue

Property: FreePortfolioValue

The buying power buffer value.

Data Type: float | Default Value: 250

Property: FreePortfolioValuePercentage

The buying power buffer percentage value.

Data Type: float | Default Value: 0.0025

Property: LiquidateEnabled

A flag to enable and disable the Liquidate method.

Data Type: bool | Default Value: True

Property: MaxAbsolutePortfolioTargetPercentage

The absolute maximum valid total portfolio value target percentage.

Data Type: float | Default Value: 1000000000

Property: MinAbsolutePortfolioTargetPercentage

The absolute minimum valid total portfolio value target percentage.

Data Type: float | Default Value: 0.0000000001

Property: MinimumOrderMarginPortfolioPercentage

The minimum order margin portfolio percentage to ignore bad orders and orders with small sizes.

Data Type: float | Default Value: 0

Property: RebalancePortfolioOnInsightChanges

Rebalance the portfolio when you emit new insights or when insights expire.

Data Type: bool/NoneType | Default Value: True

Property: RebalancePortfolioOnSecurityChanges

Rebalance the portfolio when your universe changes.

Data Type: bool/NoneType | Default Value: True

Property: StalePriceTimeSpan

The minimum time span elapsed to consider a market fill price as stale

Data Type: timedelta | Default Value: timedelta(hours=1)

Property: WarmUpResolution

The resolution to use during the warm-up period

Data Type: Resolution/NoneType | Default Value: None

To change the AlgorithmSettings , update some of the preceding properties.

Settings.RebalancePortfolioOnSecurityChanges = false;
self.Settings.RebalancePortfolioOnSecurityChanges = False

To successfully update the FreePortfolioValue , you must update it after the Initialize method.

Set Benchmark

The benchmark performance is input to calculate several statistics on your algorithm, including alpha and beta . To set a benchmark for your algorithm, call the SetBenchmark method. You can set the benchmark to a security, a constant value, or a value from a custom data source . If you don't set a brokerage model , the default benchmark is SPY. If you set a brokerage model, the model defines the default benchmark.

// Set the benchmark to IBM
SetBenchmark("IBM");

// Set the benchmark to a constant value of 0
SetBenchmark(x => 0);

// Set the benchmark to a value from a custom data source
var symbol = AddData<CustomData>("CustomData", Resolution.Hour).Symbol;
SetBenchmark(symbol);
# Set the benchmark to IBM
self.SetBenchmark("IBM")

# Set the benchmark to a constant value of 0
self.SetBenchmark(lambda x: 0)

# Set the benchmark to a value from a custom data source
self.symbol = self.AddData(CustomData, "CustomData", Resolution.Hour).Symbol
self.SetBenchmark(self.symbol)

If you pass a ticker to the SetBenchmark method, LEAN checks if you have a subscription for it. If you have a subscription for it, LEAN uses the security subscription. If you don't have a subscription for it, LEAN creates a US Equity subscription with the ticker. Since the ticker you pass may not reference a US Equity, we recommend you subscribe to the benchmark security before you call the SetBenchmark method.

Set Time Zone

LEAN supports international trading across multiple time zones and markets, so it needs a reference time zone for the algorithm to set the Time . The default time zone is Eastern Time (ET), which is UTC-4 in summer and UTC-5 in winter. To set a different time zone, call the SetTimeZone method. This method accepts either a string following the IANA Time Zone database convention or a NodaTime .DateTimeZone object. If you pass a string, the method converts it to a NodaTime.DateTimeZone object. The TimeZones class provides the following helper attributes to create NodaTime.DateTimeZone objects:

SetTimeZone("Europe/London");
SetTimeZone(NodaTime.DateTimeZone.Utc);
SetTimeZone(TimeZones.Chicago);
self.SetTimeZone("Europe/London")
self.SetTimeZone(TimeZones.Chicago)

The algorithm time zone may be different from the data time zone . If the time zones are different, it might appear like there is a lag between the algorithm time and the first bar of a history request, but this is just the difference in time zone. All the data is internally synchronized in Coordinated Universal Time (UTC) and arrives in the same Slice object. A slice is a sliver of time with all the data available for this moment.

To keep trades easy to compare between asset classes, we mark all orders in UTC time.

Set Warm Up Period

You may need some historical data at the start of your algorithm to prime technical indicators or populate historical data arrays. The warm-up period pumps data into your algorithm from before the start date. To set a warm-up period, call the SetWarmUp method. The warm-up feature uses the subscriptions you add in Initialize to gather the historical data that warms up the algorithm. If you don't create security subscriptions in the Initialize method, the warm-up won't occur.

// Wind time back 7 days from the start date
SetWarmUp(TimeSpan.FromDays(7));

// Feed in 100 trading days worth of data before the start date
SetWarmUp(100, Resolution.Daily);

// If you don't provide a resolution argument, it uses the lowest resolution in your subscriptions
SetWarmUp(100);
# Wind time back 7 days from the start date
self.SetWarmUp(timedelta(7))

# Feed in 100 trading days worth of data before the start date
self.SetWarmUp(100, Resolution.Daily)

# If you don't provide a resolution argument, it uses the lowest resolution in your subscriptions
self.SetWarmUp(100)

Post Initialization

After the Initialize method, the PostInitialize method performs post-initialization routines, so don't override it. To be notified when the algorithm is ready to begin trading, define an OnWarmupFinished method. This method executes even if you don't set a warm-up period.

public override void OnWarmupFinished()
{
    Log("Algorithm Ready");
}
def OnWarmupFinished(self) -> None:
    self.Log("Algorithm Ready")

Examples

Demonstration Algorithms
BasicTemplateAlgorithm.py Python BasicTemplateCryptoAlgorithm.py Python BasicTemplateForexAlgorithm.py Python BasicTemplateFuturesAlgorithm.py Python BasicTemplateOptionsAlgorithm.py Python BasicTemplateAlgorithm.cs C# BasicTemplateCryptoAlgorithm.cs C# BasicTemplateForexAlgorithm.cs C# BasicTemplateFuturesAlgorithm.cs C# BasicTemplateOptionsAlgorithm.cs C#

 

3 Securities

3.1 Key Concepts

Introduction

A security is an individual financial asset that you might trade on an exchange. LEAN models these unique assets with a Security object, which the AddEquity , AddCrypto , and similar methods return. The Securities property of the QCAlgorithm class is a dictionary where the keys are Symbol objects and the values are Security objects. The Securities dictionary contains all of the securities that have been in the algorithm during its lifetime.

Quote Currency

The quote currency is the currency you must give the seller to buy an asset. For currency trades, the quote currency is the currency ticker on the right side of the currency pair. For other types of assets, the quote currency is usually USD, but the quote currency for India Equities is INR. To get the quote currency of a Security , use the QuoteCurrency property.

var aaplQuoteCurrency = Securities["AAPL"].QuoteCurrency; // USD
var btcusdtQuoteCurrency = Securities["BTCUSDT"].QuoteCurrency; // USDT
aapl_quote_currency = self.Securities["AAPL"].QuoteCurrency # USD
btcusdt_quote_currency = self.Securities["BTCUSDT"].QuoteCurrency # USDT

The QuoteCurrency is a Cash object, which have the following properties:

You can use the ConversionRate property to calculate the value of the minimum price movement in the account currency

var cfd = Securities["SG30SGD"];
var quoteCurrency = cfd.QuoteCurrency; // SGD
var contractMutiplier = cfd.SymbolProperties.ContractMultiplier;
var minimumPriceVariation = cfd.SymbolProperties.MinimumPriceVariation;

// Value of a pip in account currency
var pip = minimumPriceVariation * contractMutiplier * quoteCurrency.ConversionRate;
cfd = self.Securities["SG30SGD"]
quote_currency = cfd.QuoteCurrency # SGD
contract_mutiplier = cfd.SymbolProperties.ContractMultiplier
minimum_price_variation = cfd.SymbolProperties.MinimumPriceVariation

# Value of a pip in account currency
pip = minimum_price_variation * contract_mutiplier * quote_currency.ConversionRate

Security Listing

The Exchange property of a Security object contains information about the exchange that lists the security.

var exchange = Securities["SPY"].Exchange;
exchange = self.Securities["SPY"].Exchange

Security Market

The Market enumeration has the following members:

LEAN groups all of the US Equity exchanges under Market.USA . In live mode, the brokerage routes the orders to the exchange that provides the best price.

Active Securities

The ActiveSecurities property of the algorithm class contains all of the assets currently in your universe. It is a dictionary where the key is a Symbol and the value is a Security . When you remove an asset from a universe, LEAN usually removes the security from the ActiveSecurities collection and removes the security subscription. However, it won't remove the security in any of the following situations:

When LEAN removes the security, the Security object remains in the Securities collection for record-keeping purposes, like tracking fees and trading volume.

Tradable Status

The IsTradable property shows whether you can trade a security. The property value is true when the security is in the universe, even if the data starts at a later day. Indices, canonical Option securities, and continuous Futures contracts are not tradable. In live mode, custom data objects are also not tradable, even if the custom data represents a tradable asset.

var tradable = Securities["SPY"].IsTradable;
tradable = self.Securities["SPY"].IsTradable

Linked Custom Data

Linked custom data is custom data that's linked to individual assets. In contrast, unlinked data is not linked to specific assets. An example of an unlinked dataset is the US Regulatory Alerts dataset. LEAN passes custom data objects to the OnData method. For more information about custom data, see Custom Securities .

Security Types

LEAN uses the SecurityType enumeration as a synonym for asset classes. The SecurityType enumeration has the following members:

The Base type is for non-financial assets like custom and alternative data objects.

 

3.2 Properties

Introduction

Security objects contain the models and properties of an asset.

Security Properties

Security objects have the following properties:

Reality Models

Security objects contain references to the security level reality models . To customize the behavior of each security, configure its reality models.

Symbol Properties

The SymbolProperties property of a Security contains properties for a specific security. SymbolProperties objects have the following properties:

To create a SymbolProperties object, call the constructor.

var symbolProperties = new SymbolProperties(description, quoteCurrency, contractMultiplier, minimumPriceVariation, lotSize, marketTicker);
symbol_properties = SymbolProperties(description, quoteCurrency, contractMultiplier, minimumPriceVariation, lotSize, marketTicker)

The following table describes the arguments of the SymbolProperties constructor:

Argument Data Type Description Default Value
description string str The description of the security.
quoteCurrency string str The quote currency of the security.
contractMultiplier decimal float The contract multiplier for the security.
minimumPriceVariation decimal float The minimum price variation (tick size) for the security.
lotSize decimal float The lot size (lot size of the order) for the security.
marketTicker string str The market ticker.
minimumOrderSize decimal? float/NoneType The minimum order size allowed. None null
priceMagnifier decimal float This property allows normalizing live asset prices to US Dollars for Lean consumption. In some exchanges, for some securities, data is expressed in cents like corn Futures ('ZC'). 1

 

3.3 Exchange

Introduction

The Exchange property of a Security object contains information about the exchange that lists the security.

Properties

The Exchange property of a Security object returns an SecurityExchange object, which has the following attributes:

Hours

To get the exchange hours, use the Exchange.Hours property on a Security object.

var securityExchangeHours = Securities["SPY"].Exchange.Hours;
security_exchange_hours = self.Securities["SPY"].Exchange.Hours

The preceding code snippet returns a SecurityExchangeHours object, which has the following attributes:

To check if the exchange is open at a specific time, call the IsOpen method.

// Check if the exchange is open at a specific time
var isOpenNow = securityExchangeHours.IsOpen(Time, extendedMarketHours: false);

// Check if the exchange is open at any point in time over a specific interval
var isOpen = securityExchangeHours.IsOpen(Time, Time.AddDays(1), extendedMarketHours: false);
# Check if the exchange is open at a specific time
is_open_now = security_exchange_hours.IsOpen(self.Time, extendedMarketHours=False)

# Check if the exchange is open at any point in time over a specific interval
is_open = security_exchange_hours.IsOpen(self.Time, self.Time + timedelta(days=1), extendedMarketHours=False)

To check if the exchange is open on a specific date, call the IsDateOpen method.

var isOpen = securityExchangeHours.IsDateOpen(Time);
is_open = security_exchange_hours.IsDateOpen(self.Time)

To get the next market open time, call the GetNextMarketOpen method.

var marketOpenTime = securityExchangeHours.GetNextMarketOpen(Time, extendedMarketHours: false);
market_open_time = security_exchange_hours.GetNextMarketOpen(self.Time, extendedMarketHours=False)

To get the next market close time, call the GetNextMarketClose method.

var marketCloseTime = securityExchangeHours.GetNextMarketClose(Time, extendedMarketHours: false);
market_close_time = security_exchange_hours.GetNextMarketClose(self.Time, extendedMarketHours=False)

To get the previous trading day, call the GetPreviousTradingDay method.

var day = securityExchangeHours.GetPreviousTradingDay(Time);
day = security_exchange_hours.GetPreviousTradingDay(self.Time)

To get the next trading day, call the GetNextTradingDay method.

var day = securityExchangeHours.GetNextTradingDay(Time);
day = security_exchange_hours.GetNextTradingDay(self.Time)

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddEquity("SPY", extendedMarketHours: true);
self.AddEquity("SPY", extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

24 Hour Markets

The Crypto market trades 24/7, but other asset classes only trade during part of the week. Each market has an official trading schedule, but it can be impacted by daylight savings, holidays, and trading halts.

 

3.4 Requesting Data

Introduction

If you create a data subscription, your algorithm receives data updates for that security or custom data source.

Characteristics

We thoroughly vet datasets before we add them to the Data Market. The datasets in the Data Market are well-defined with robust ticker and Symbol links to ensure tickers are properly tracked through time. The datasets are consistently delivered on time and most of them are ready for live trading. All the datasets have at least one year of historical data and are free of survivorship bias.

Resolutions

Resolution is the duration of time that's used to sample a data source. The Resolution enumeration has the following members:

The default resolution for market data is Minute . To set the resolution for a security, pass the resolution argument when you create the security subscription.

AddEquity("SPY", Resolution.Daily);
self.AddEquity("SPY", Resolution.Daily)

To set the resolution for all securities, set the Resolution universe setting before you create security subscriptions.

UniverseSettings.Resolution = Resolution.Daily;
self.UniverseSettings.Resolution = Resolution.Daily

To see which resolutions of data are available for a dataset, see the dataset listing in the Data Market . To create custom resolution periods, see Consolidating Data .

Data density describes the frequency of entries in a dataset. Datasets at the tick resolution have dense data density. All other resolutions usually have regular data density. If a non-tick resolution dataset doesn't have an entry at each sampling, it has sparse density.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddEquity("SPY", fillForward: false);
self.AddEquity("SPY", fillForward=False)

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddEquity("SPY", extendedMarketHours: true);
self.AddEquity("SPY", extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

Remove Subscriptions

To remove a security subscription, call the RemoveSecurity method.

RemoveSecurity(_symbol);
self.RemoveSecurity(self.symbol)

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings.

Markets

The datasets integrated into the Dataset Market cover many markets. The Market enumeration has the following members:

LEAN can usually determine the correct market based on the ticker you provide when you create the security subscription. To manually set the market for a security, pass a market argument when you create the security subscription.

AddEquity("SPY", market: Market.USA);
self.AddEquity("SPY", market=Market.USA)

Quotas

There is no limit to the number of security subscriptions you can create, but some live data providers impose data subscription limits. To set a limit, in the Initialize method, set the DataSubscriptionLimit algorithm setting .

Settings.DataSubscriptionLimit = 500;
self.Settings.DataSubscriptionLimit = 500

All securities that you add to the algorithm count as one subscription, except Options and Futures. Every Option and Future contract counts as one subscription.

 

3.5 Handling Data

Introduction

LEAN packages the data for your subscriptions in a Slice object and passes it to the OnData method of your algorithm. To avoid look-ahead bias , LEAN only provides the data that's available at the current time in your algorithm. This processing style ensures that your algorithm backtests in the same manner that it trades live. Your algorithm uses the data to make trading decisions and LEAN uses the data to update your positions, track your portfolio value, and simulate orders.

Security Cache

To get the most recent data for a security, call the GetLastData method on the Security object.

var data = Securities["SPY"].GetLastData();
data = self.Securities["SPY"].GetLastData()

Timeslice

The Slice that LEAN passes to the OnData method represents all of the data for your subscriptions at a single point in time. The Slice object contains data like Tick objects, TradeBar objects, QuoteBar objects, corporate actions , and chains for Option and Future contracts. You can use the data in the Slice to make trading decisions.

To access data in the Slice , index it with the security Symbol . If you use the security ticker instead of the Symbol , LEAN automatically finds the Symbol .

public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_symbol))
    {
        var myData = slice[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.symbol):
        my_data = slice[self.symbol]

The following table shows the Slice property to index based on the data format you want:

Data Format Slice Property
TradeBar Bars
QuoteBar QuoteBars
Tick Ticks
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_symbol))
    {
        var bar = slice.Bars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.symbol):
        bar = slice.Bars[self.symbol]

If you just index the Slice instead of the preceding properties, it returns the correct object. If your data subscription provides QuoteBar objects and you index the Slice with the security Symbol , it returns the QuoteBar .

Slice objects have the following properties:

For more information about the Slice class, see Timeslices .

 

3.6 Filtering Data

Introduction

Unfiltered raw data can be faulty for a number of reasons, including invalid data entry. Moreover, high-frequency traders can deploy bait-and-switch strategies by submitting bait orders to deceive other market participants, making raw data noisy and untradeable. To avoid messing up with our trading logic and model training, you can filter out suspicious raw data with a data filter.

Set Models

To set a data filter for a security, call the SetDataFilter property on the Security object.

// In Initialize
var spy = AddEquity("SPY");
spy.SetDataFilter(new SecurityDataFilter());
# In Initialize
spy = AddEquity("SPY")
spy.SetDataFilter(SecurityDataFilter())

You can also set the data filter model in a security initializer . If your algorithm has a universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

// In Initialize
SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));

// Outside of the algorithm class
class MySecurityInitializer : BrokerageModelSecurityInitializer
{
    public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
        : base(brokerageModel, securitySeeder) {}    
    
    public override void Initialize(Security security)
    {
        // First, call the superclass definition
        // This method sets the reality models of each security using the default reality models of the brokerage model
        base.Initialize(security);

        // Next, overwrite some of the reality models        
        security.SetDataFilter(new SecurityDataFilter());    
    }
}
# In Initialize
self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

# Outside of the algorithm class
class MySecurityInitializer(BrokerageModelSecurityInitializer):

    def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
        super().__init__(brokerage_model, security_seeder)

    def Initialize(self, security: Security) -> None:
        # First, call the superclass definition
        # This method sets the reality models of each security using the default reality models of the brokerage model
        super().Initialize(security)

        # Next, overwrite some of the reality models        
        security.SetDataFilter(SecurityDataFilter())

Default Behavior

The following table shows the default data filter for each security type:

Security Type Default Filter
Equity EquityDataFilter
Option OptionDataFilter
Forex ForexDataFilter
Index IndexDataFilter
Cfd CfdDataFilter
Others SecurityDataFilter

None of the preceding filters filter out any data.

Model Structure

Data filtering models should implement the ISecurityDataFilter interface. Extensions of the ISecurityDataFilter interface must implement the Filter method, which receives Security and BaseData objects and then returns a boolean object that represents if the data point should be filtered out.

Data filtering models must implement a Filter method, which receives Security and BaseData objects and then returns a boolean object that represents if the data point should be filtered out.

public class MyDataFilter : ISecurityDataFilter
{
    public override bool Filter(Security vehicle, BaseData data)
    {
        return true;
    }
}
class MyDataFilter:
    def Filter(self, vehicle: Security, data: BaseData) -> bool:
        return True

Examples

Demonstration Algorithms
CustomSecurityDataFilterRegressionAlgorithm.py Python TickDataFilteringAlgorithm.py Python CustomSecurityDataFilterRegressionAlgorithm.cs C# TickDataFilteringAlgorithm.cs C#

 

3.7 Asset Classes

You can trade any of the following asset classes. Click one to learn more.

See Also

Universes
Importing Data

 

3.7.1 US Equity

US Equities represent partial ownership in a US corporation.

See Also

BasicTemplateAlgorithm.py
BasicTemplateAlgorithm.cs

 

3.7.1.1 Requesting Data

Introduction

Request US Equity data in your algorithm to receive a feed of asset prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Equities dataset listing . To trade US Equities live, you can use our US Equities data feed or one of the brokerage data feeds .

Create Subscriptions

To create an Equity subscription, in the Initialize method, call the AddEquity method. The AddEquity method returns an Equity object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddEquity("SPY").Symbol;
self.symbol = self.AddEquity("SPY").Symbol

The AddEquity method creates a subscription for a single Equity asset and adds it to your user-defined universe. To create a dynamic universe of Equities, add an Equity universe or an Equity Universe Selection model .

To view the supported assets in the US Equities dataset, see the Data Explorer .

Resolutions

The following table shows the available resolutions and data formats for Equity subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check green check
Second green check green check
Minute green check green check
Hour green check
Daily green check

The default resolution for Equity subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddEquity method.

_symbol = AddEquity("SPY", Resolution.Daily).Symbol;
self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Asset Primary Exchange

When a stock like Apple is listed, it’s listed on Nasdaq. The open auction tick on Nasdaq is the price that’s used as the official open of the day. NYSE, BATS, and other exchanges also have opening auctions, but the only official opening price for Apple is the opening auction on the exchange where it was listed.

Supported Markets

LEAN groups all of the US Equity exchanges under Market.USA . In live mode, the brokerage routes the orders to the exchange that provides the best price.

To set the market for a security, pass a market argument to the AddEquity method.

_symbol = AddEquity("SPY", market: Market.USA).Symbol;
self.symbol = self.AddEquity("SPY", market=Market.USA).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddEquity("SPY", fillForward: false);
self.AddEquity("SPY", fillForward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. In backtests, the default leverage for margin accounts is 2x leverage and leverage is not available for cash accounts. To change the amount of leverage you can use for a security, pass a leverage argument to the AddEquity method.

_symbol = AddEquity("SPY", leverage: 3).Symbol;
self.symbol = self.AddEquity("SPY", leverage=3).Symbol

In live trading, the brokerage determines how much leverage you may use. For more information about the leverage they provide, see Brokerages .

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddEquity("SPY", extendedMarketHours: true);
self.AddEquity("SPY", extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours .

Data Normalization

The data normalization mode defines how historical data is adjusted for corporate actions . The data normalization mode affects the data that LEAN passes to OnData and the data from history requests . By default, LEAN adjusts US Equity data for splits and dividends to produce a smooth price curve, but the following data normalization modes are available:

We use the entire split and dividend history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

To set the data normalization mode for a security, pass a dataNormalizationMode argument to the AddEquity method.

_symbol = AddEquity("SPY", dataNormalizationMode: DataNormalizationMode.Raw).Symbol;
self.symbol = self.AddEquity("SPY", dataNormalizationMode=DataNormalizationMode.Raw).Symbol

Properties

The AddEquity method returns an Equity object, which have the following properties:

 

3.7.1.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the security ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the security Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_symbol))
    {
        var tradeBar = tradeBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

We adjust the daily open and close price of bars to reflect the official auction prices .

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the security Symbol . If the security doesn't actively get quotes or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_symbol))
    {
        var quoteBar = quoteBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the security. A quote tick is an offer to buy or sell the security at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

If we detect a tick that may be suspicious , we set its Suspicious flag to true.

Other Data Formats

For more information about data formats available for US Equities, see Corporate Actions .

 

3.7.1.3 Corporate Actions

Introduction

US Equity subscriptions provide notifications for splits, dividends, symbol changes, and delistings.

Splits

When a company does a stock split, the number of shares each shareholder owns increases and the price of each share decreases. When a company does a reverse stock split, the number of shares each shareholder owns decreases and the price of each share increases. A company may perform a stock split or a reverse stock split to adjust the price of their stock so that more investors trade it and the liquidity increases.

When a stock split or reverse stock split occurs for an Equity in your algorithm, LEAN sends a Split object to the OnData method. Split objects have the following properties:

You receive Split objects when a split is in the near future and when it occurs. To know if the split occurs in the near future or now, check the Type property.

If you backtest without the Raw data normalization mode , the splits are factored into the price and volume. If you backtest with the Raw data normalization mode or trade live, when a split occurs, LEAN automatically adjusts your positions based on the SplitFactor . If the post-split quantity isn't a valid lot size , LEAN credits the remaining value to your cashbook in your account currency. If you have indicators in your algorithm, reset your indicators when splits occur so that the data in your indicators account for the price adjustments that the splits cause.

To get the Split objects in the Slice , index the Splits property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Splits property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Splits.ContainsKey(_symbol))
    {
        var split = slice.Splits[_symbol];
    }
}

public void OnData(Splits splits)
{
    if (splits.ContainsKey(_symbol))
    {
        var split = splits[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    split = slice.Splits.get(self.symbol)
    if split:
        pass

You can also iterate through the Splits dictionary. The keys of the dictionary are the Symbol objects and the values are the Split objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Splits)
    {
        var symbol = kvp.Key;
        var split = kvp.Value;
    }
}

public void OnData(Splits splits)
{
    foreach (var kvp in splits)
    {
        var symbol = kvp.Key;
        var split = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, split in slice.Splits.items():
        pass

LEAN stores the data for stock splits in factor files. To view some example factor files, see the LEAN GitHub repository . In backtests, your algorithm receives Split objects at midnight. In live trading, your algorithm receives Split objects when the factor files are ready.

If you hold an Option contract for an underlying Equity when a split occurs, LEAN closes your Option contract position.

If a split event occurred before an order is filled, the unfilled portion of the order will be adjusted automatically, where its quantity will be multiplied by the split factor and the limit/stop price (if any) will be divided by the split factor.

Dividends

A dividend is a payment that a company gives to shareholders to distribute profits. When a dividend payment occurs for an Equity in your algorithm, LEAN sends a Dividend object to the OnData method. Dividend objects have the following properties:

If you backtest with the Adjusted or TotalReturn data normalization mode, the dividends are factored into the price. If you backtest with the other data normalization modes or trade live, when a dividend payment occurs, LEAN automatically adds the payment amount to your cashbook. If you have indicators in your algorithm, reset your indicators when dividend payments occur so that the data in your indicators account for the price adjustments that the dividend causes.

To get the Dividend objects in the Slice , index the Dividends property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Dividends property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Dividends.ContainsKey(_symbol))
    {
        var dividend = slice.Dividends[_symbol];
    }
}

public void OnData(Dividends dividends)
{
    if (dividends.ContainsKey(_symbol))
    {
        var dividend = dividends[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    dividend = slice.Dividends.get(self.symbol)
    if dividend:
        pass

You can also iterate through the Dividends dictionary. The keys of the dictionary are the Symbol objects and the values are the Dividend objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Dividends)
    {
        var symbol = kvp.Key;
        var dividend = kvp.Value;
    }
}

public void OnData(Dividends dividends)
{
    foreach (var kvp in dividends)
    {
        var symbol = kvp.Key;
        var dividend = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, dividend in slice.Dividends.items():
        pass

For a full example, see the DividendAlgorithm DividendAlgorithm in the LEAN GitHub repository.

Symbol Changes

The benefit of the Symbol class is that it always maps to the same security, regardless of their trading ticker. When a company changes its trading ticker, LEAN sends a SymbolChangedEvent to the OnData method. SymbolChangedEvent objects have the following properties:

To get the SymbolChangedEvent objects in the Slice , index the SymbolChangedEvents property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the SymbolChangedEvents property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.SymbolChangedEvents.ContainsKey(_symbol))
    {
        var symbolChangedEvent = slice.SymbolChangedEvents[_symbol];
    }
}

public void OnData(SymbolChangedEvents symbolChangedEvents)
{
    if (symbolChangedEvents.ContainsKey(_symbol))
    {
        var symbolChangedEvent = symbolChangedEvents[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    symbol_changed_event = slice.SymbolChangedEvents.get(self.symbol)
    if symbol_changed_event:
        pass

You can also iterate through the SymbolChangedEvents dictionary. The keys of the dictionary are the Symbol objects and the values are the SymbolChangedEvent objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.SymbolChangedEvents)
    {
        var symbol = kvp.Key;
        var symbolChangedEvent = kvp.Value;
    }
}

public void OnData(SymbolChangedEvents symbolChangedEvents)
{
    foreach (var kvp in symbolChangedEvents)
    {
        var symbol = kvp.Key;
        var symbolChangedEvent = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, symbol_changed_event in slice.SymbolChangedEvents.items():
        pass

If you have an open order for a security when they change their ticker, LEAN cancels your order. To keep your order, in the OnOrderEvent method, get the quantity and Symbol of the cancelled order and submit a new order.

public override void OnOrderEvent(OrderEvent orderEvent)
{
    if (orderEvent.Status == OrderStatus.Canceled)
    {
        var ticket = Transactions.GetOrderTicket(orderEvent.OrderId);
        if (ticket.Tag.Contains("symbol changed event"))
        {
            Transactions.AddOrder(ticket.SubmitRequest);
        }
    } 
}
def OnOrderEvent(self, order_event: OrderEvent) -> None:
    if order_event.Status == OrderStatus.Canceled:
        ticket = self.Transactions.GetOrderTicket(order_event.OrderId)
        if "symbol changed event" in ticket.Tag:
            self.Transactions.AddOrder(ticket.SubmitRequest)

LEAN stores the data for ticker changes in map files. To view some example map files, see the LEAN GitHub repository .

Delistings

When a company is delisting from an exchange, LEAN sends a Delisting object to the OnData method. Delisting objects have the following properties:

You receive Delisting objects when a delisting is in the near future and when it occurs. To know if the delisting occurs in the near future or now, check the Type property.

To get the Delisting objects in the Slice , index the Delistings property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Delistings property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Delistings.ContainsKey(_symbol))
    {
        var delisting = slice.Delistings[_symbol];
    }
}

public void OnData(Delistings delistings)
{
    if (delistings.ContainsKey(_symbol))
    {
        var delisting = delistings[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    delisting = slice.Delistings.get(self.symbol)
    if delisting:
        pass

You can also iterate through the Delistings dictionary. The keys of the dictionary are the Symbol objects and the values are the Delisting objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Delistings)
    {
        var symbol = kvp.Key;
        var delisting = kvp.Value;
    }
}

public void OnData(Delistings delistings)
{
    foreach (var kvp in delistings)
    {
        var symbol = kvp.Key;
        var delisting = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, delisting in slice.Delistings.items():
        pass

The delist warning occurs on the final trading day of the stock to give you time to gracefully exit out of positions before LEAN automatically liquidates them.

if (delisting.Type == DelistingType.Warning)
{
    // Liquidate with MarketOnOpenOrder on delisting warning
    var quantity = Portfolio[symbol].Quantity;
    if (quantity != 0)
    {
        MarketOnOpenOrder(symbol, -quantity);
    }
}
if delisting.Type == DelistingType.Warning:
    # Liquidate with MarketOnOpenOrder on delisting warning
    quantity = self.Portfolio[symbol].Quantity
    if quantity != 0:
        self.MarketOnOpenOrder(symbol, -quantity)

For a full example, see the DelistingEventsAlgorithm DelistingEventsAlgorithm in the LEAN GitHub repository.

 

3.7.1.4 Corporate Fundamentals

Introduction

Corporate fundamental data contains all the information on the underlying company of an Equity asset and the information in their financial statements. Since corporate data contains information not found in price and alternative data, adding corporate data to your trading strategies provides you with more information so you can make more informed trading decisions. Corporate fundamental data is available through the US Fundamental Data from Morningstar . To get fundamental data into your algorithm, add a fundamental universe .

Properties

To get fundamental data, access the FineFundamental properties in your fine universe selection function or access the Fundamentals property of the Equity objects in your fundamental universe.

var fundamentals = Securities[_symbol].Fundamentals;
fundamentals = self.Securities[self.symbol].Fundamentals

The US Fundamentals dataset provides FineFundamental objects. To filter FineFundamental objects, you can use the MorningstarSectorCode, MorningstarIndustryGroupCode, and MorningstarIndustryCode enumeration values.

FineFundamental Attributes

FineFundamental objects have the following attributes:

MorningstarSectorCode Enumeration

Sectors are large super categories of data. To access the sector of an Equity, use the MorningstarSectorCode property.

filteredFine = fine.Where(x => x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology]

The MorningstarSectorCode enumeration has the following members:

MorningstarIndustryGroupCode Enumeration

Industry groups are clusters of related industries which tie together. To access the industry group of an Equity, use the MorningstarIndustryGroupCode property.

filteredFine = fine.Where(x => x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.ApplicationSoftware);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.ApplicationSoftware]

The MorningstarIndustryGroupCode enumeration has the following members:

MorningstarIndustryCode Enumeration

Industries are the finest level of classification available and are the individual industries according to the Morningstar classification system. To access the industry group of an Equity, use the MorningstarIndustryCode property:

filteredFine = fine.Where(x => x.AssetClassification.MorningstarIndustryCode == MorningstarIndustryCode.SoftwareApplication);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarIndustryCode == MorningstarIndustryCode.SoftwareApplication]

The MorningstarIndustryCode enumeration has the following members:

Exchange Id Values

Exchange Id is mapped to represent the exchange that lists the Equity. To access the exchange Id of an Equity, use the PrimaryExchangeID property.

filteredFine = fine.Where(x => x.CompanyReference.PrimaryExchangeID == "NAS");
filtered_fine = [x for x in fine if x.CompanyReference.PrimaryExchangeID == "NAS"]

The exchanges are represented by the following string values:

String Representation Exchange
NYS New York Stock Exchange (NYSE)
NAS NASDAQ
ASE American Stock Exchange (AMEX)
TSE Tokyo Stock Exchange
AMS Amsterdam Internet Exchange
SGO Santiago Stock Exchange
XMAD Madrid Stock Exchange
ASX Australian Securities Exchange
BVMF B3 (stock exchange)
LON London Stock Exchange
TKS Istanbul Stock Exchange Settlement and Custody Bank
SHG Shanghai Exchange
LIM Lima Stock Exchange
FRA Frankfurt Stock Exchange
JSE Johannesburg Stock Exchange
MIL Milan Stock Exchange
TAE Tel Aviv Stock Exchange
STO Stockholm Stock Exchange
ETR Deutsche Boerse Xetra Core
PAR Paris Stock Exchange
BUE Buenos Aires Stock Exchange
KRX Korea Exchange
SWX SIX Swiss Exchange
PINX Pink Sheets (OTC)
CSE Canadian Securities Exchange
PHS Philippine Stock Exchange
MEX Mexican Stock Exchange
TAI Taiwan Stock Exchange
IDX Indonesia Stock Exchange
OSL Oslo Stock Exchange
BOG Colombia Stock Exchange
NSE National Stock Exchange of India
HEL Nasdaq Helsinki
MISX Moscow Exchange
HKG Hong Kong Stock Exchange
IST Istanbul Stock Exchange
BOM Bombay Stock Exchange
TSX Toronto Stock Exchange
BRU Brussels Stock Exchange
BATS BATS Global Markets
ARCX NYSE Arca
GREY Grey Market (OTC)
DUS Dusseldorf Stock Exchange
BER Berlin Stock Exchange
ROCO Taipei Exchange
CNQ Canadian Trading and Quotation System Inc.
BSP Bangko Sentral ng Pilipinas
NEOE NEO Exchange

Historical Data

To get historical fundamental data, set a warm-up period and save the fundamental data during the warm-up period. It’s not currently possible to make a history request for fundamental data in an algorithm. Subscribe to GitHub Issue #4890 to track the feature progress.

Data Updates

The US Fundmamental dataset only provides the originally-reported figures. If there was a mistake in reporting a figure, the data value isn't fixed later. In live trading, new fundamental data is available to your algorithms at approximately 6 AM Eastern Time (ET) each day. The majority of the corporate data update occurs once per month, but the financial ratios update daily. If there is no new data for a period of time, the previous data is filled forward.

 

3.7.1.5 Shorting

Introduction

In a regular long position, you buy shares and then sell them later to close the trade. In a short position, you borrow shares, sell them, and then buy the shares back later to close the trade. Short positions let you profit when a security's price decreases while you have the position open, but there are risks involved. For example, you can get a margin call and you may incur borrowing costs.

Holdings Accounting

If you have an open long position, your portfolio has a positive quantity of shares for that security. In contrast, if you have an open short position, your portfolio has a negative quantity of shares for that security.

Borrowing Costs

In live trading, you usually pay a fee to borrow shares that you use to open a short position. Part of the fee goes to the investor that provided you with the opportunity to short with their shares. The borrowing rate is set by your live brokerage. In backtests, LEAN doesn't currently model borrowing costs, but we have an open GitHub Issue to add the functionality. Subscribe to GitHub Issue #4563 to track the feature progress.

 

3.7.1.6 Data Preparation

Introduction

The US Equities dataset provides price data for backtests and live trading.

Sourcing

The US Equities data feed consolidates market data across all of the exchanges. Over-the-Counter (OTC) trades are excluded. The data feed is powered by the Securities Information Processor (SIP), so it has 100% market coverage. In contrast, free platforms that display data feeds like the Better Alternative Trading System (BATS) only have about 6-7% market coverage .

We provide live splits, dividends, and corporate actions for US companies. We deliver them to your algorithm before the trading day starts.

Bar Building

We aggregate ticks to build bars.

The bar-building process can exclude ticks. If a tick is excluded, its volume is aggregated in the bar but its price is not aggregated in the bar. Ticks are excluded if any of the following statements are true:

In the preceding tables, Participant refers to the entities on page 19 of the Consolidated Tape System Multicast Output Binary Specification .

Suspicious Ticks

Tick price data is raw and unfiltered, so it can contain a lot of noise. If a tick is not tradable, we flag it as suspicious. This process makes the bars a more realistic representation of what you could execute in live trading. If you use tick data, avoid using suspicious ticks in your algorithms as informative data points. We recommend only using tick data if you understand the risks and are able to perform your own tick filtering. Ticks are flagged as suspicious in the following situations:

Market Auction Prices

The opening and closing price of the day is set by very specific opening and closing auction ticks. When a stock like Apple is listed, it’s listed on Nasdaq. The open auction tick on Nasdaq is the price that’s used as the official open of the day. NYSE, BATS, and other exchanges also have opening auctions, but the only official opening price for Apple is the opening auction on the exchange where it was listed.

We set the opening and closing prices of the first and last bars of the day to the official auction prices. This process is used for second, minute, hour, and daily bars for the 9:30 AM and 4:30 PM Eastern Time (ET) prices. In contrast, other platforms might not be using the correct opening and closing prices.

The official auction prices are usually emitted 2-30 seconds after the market open and close. We do our best to use the official opening and closing prices in the bars we build, but the delay can be so large that there isn't enough time to update the opening and closing price of the bar before it's injected into your algorithms. For example, if you subscribe to second resolution data, we wait until the end of the second for the opening price but most second resolution data won’t get the official opening price. If you subscribe to minute resolution data, we wait until the end of the minute for the opening auction price. Most of the time, you’ll get the actual opening auction price with minute resolution data, but there are always exceptions. Nasdaq and NYSE can have delays in publishing the opening auction price, but we don’t have control over those issues and we have to emit the data on time so that you get the bar you are expecting.

Live and Backtesting Differences

In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.

Data Availability

In live trading, live data is available in real-time. In backtests, live data is available at the following pre-market trading session.

 

3.7.1.7 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the US Equity market.

Pre-market Hours

The following table shows the pre-market hours for the US Equity market:

Weekday Time (America/New York)
Monday 04:00:00 to 09:30:00
Tuesday 04:00:00 to 09:30:00
Wednesday 04:00:00 to 09:30:00
Thursday 04:00:00 to 09:30:00
Friday 04:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the US Equity market:

Weekday Time (America/New York)
Monday 09:30:00 to 16:00:00
Tuesday 09:30:00 to 16:00:00
Wednesday 09:30:00 to 16:00:00
Thursday 09:30:00 to 16:00:00
Friday 09:30:00 to 16:00:00

Post-market Hours

The following table shows the post-market hours for the US Equity market:

Weekday Time (America/New York)
Monday 16:00:00 to 20:00:00
Tuesday 16:00:00 to 20:00:00
Wednesday 16:00:00 to 20:00:00
Thursday 16:00:00 to 20:00:00
Friday 16:00:00 to 20:00:00

Holidays

LEAN uses the trading holidays from the NYSE website.

The following table shows the dates of holidays for the US Equity market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

The following table shows the early closes for the US Equity market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
1999-11-26 13:00:00
2000-07-03 13:00:00
2000-11-24 13:00:00
2001-07-03 13:00:00
2001-11-23 13:00:00
2001-12-24 13:00:00
2002-07-05 13:00:00
2002-11-29 13:00:00
2002-12-24 13:00:00
2003-07-03 13:00:00
2003-11-28 13:00:00
2003-12-24 13:00:00
2003-12-26 13:00:00
2004-11-26 13:00:00
2005-11-25 13:00:00
2006-07-03 13:00:00
2006-11-24 13:00:00
2007-07-03 13:00:00
2007-11-23 13:00:00
2007-12-24 13:00:00
2008-07-03 13:00:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-07-03 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-07-03 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-07-03 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:00:00
2016-11-25 13:00:00
2017-07-03 13:00:00
2017-11-24 13:00:00
2017-12-24 13:00:00
2018-07-03 13:00:00
2018-11-23 13:00:00
2018-12-24 13:00:00
2019-07-03 13:00:00
2019-11-29 13:00:00
2019-12-24 13:00:00
2020-11-27 13:00:00
2020-12-24 13:00:00
2021-11-26 13:00:00
2022-11-25 13:00:00

Late Opens

There are no days with late opens.

Time Zone

The US Equity market trades in the America/New York time zone.

 

3.7.2 India Equity

India Equities represent partial ownership in an Indian corporation.

See Also

BasicTemplateIndiaAlgorithm.py
BasicTemplateIndiaAlgorithm.cs

 

3.7.2.1 Requesting Data

Introduction

Request India Equity data in your algorithm to receive a feed of asset prices in the OnData method. For more information about the specific dataset we use for backtests, see the India Equities dataset listing . To trade India Equities live, you can use one of the brokerage data feeds .

Create Subscriptions

To create an India Equity subscription, in the Initialize method, call the AddEquity method. The AddEquity method returns an Equity object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddEquity("YESBANK", market: Market.India).Symbol;
self.symbol = self.AddEquity("YESBANK", market=Market.India).Symbol

If you set the brokerage model to an India brokerage, you don't need to pass a market argument. To view the integrated brokerages that offer India Equities, see Brokerages .

To view the supported assets in the India Equities dataset, see the Data Explorer .

Resolutions

The following table shows the available resolutions and data formats for India Equity subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick

Second

Minute green check
Hour green check
Daily green check

The default resolution for India Equity subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddEquity method.

_symbol = AddEquity("YESBANK", Resolution.Daily, Market.India).Symbol;
self.symbol = self.AddEquity("YESBANK", Resolution.Daily, Market.India).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

LEAN groups all of the India Equity exchanges under Market.India . To set the market for a security, pass a market argument to the AddEquity method.

_symbol = AddEquity("YESBANK", market: Market.India).Symbol;
self.symbol = self.AddEquity("YESBANK", market=Market.India).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddEquity("YESBANK", market: Market.India, fillForward: false).Symbol;
self.symbol = self.AddEquity("YESBANK", market=Market.India, fillForward=False).Symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The amount of margin that's available depends on the brokerage model you use. For more information about the margin requirements of each brokerage, see the Margin section of the brokerage guides . To change the amount of leverage you can use for a security, pass a leverage argument to the AddEquity method.

_symbol = AddEquity("YESBANK", market: Market.India, leverage: 3).Symbol;
self.symbol = self.AddEquity("YESBANK", market=Market.India, leverage=3).Symbol

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

_symbol = AddEquity("YESBANK", market: Market.India, extendedMarketHours: true).Symbol;
self.symbol = self.AddEquity("YESBANK", market=Market.India, extendedMarketHours=True).Symbol

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours .

Data Normalization

The data normalization mode defines how historical data is adjusted for corporate actions . The data normalization mode affects the data that LEAN passes to OnData and the data from history request . By default, LEAN adjusts India Equity data for splits and dividends to produce a smooth price curve. The following data normalization modes are available:

We use the entire split and dividend history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

To set the data normalization mode for a security, pass a dataNormalizationMode argument to the AddEquity method..

_symbol = AddEquity("YESBANK", market: Market.India, dataNormalizationMode: DataNormalizationMode.Raw).Symbol;
self.symbol = AddEquity("YESBANK", market=Market.India, dataNormalizationMode=DataNormalizationMode.Raw).Symbol

Properties

The AddEquity method returns an Equity object, which have the following properties:

 

3.7.2.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the security ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the security Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_symbol))
    {
        var tradeBar = tradeBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

 

3.7.2.3 Corporate Actions

Introduction

India Equity subscriptions provide notifications for splits, dividends, symbol changes, and delistings.

Splits

When a company does a stock split, the number of shares each shareholder owns increases and the price of each share decreases. When a company does a reverse stock split, the number of shares each shareholder owns decreases and the price of each share increases. A company may perform a stock split or a reverse stock split to adjust the price of their stock so that more investors trade it and the liquidity increases.

When a stock split or reverse stock split occurs for an Equity in your algorithm, LEAN sends a Split object to the OnData method. Split objects have the following properties:

You receive Split objects when a split is in the near future and when it occurs. To know if the split occurs in the near future or now, check the Type property.

If you backtest without the Raw data normalization mode , the splits are factored into the price and volume. If you backtest with the Raw data normalization mode or trade live, when a split occurs, LEAN automatically adjusts your positions based on the SplitFactor . If the post-split quantity isn't a valid lot size , LEAN credits the remaining value to your cashbook in your account currency. If you have indicators in your algorithm, reset your indicators when splits occur so that the data in your indicators account for the price adjustments that the splits cause.

To get the Split objects in the Slice , index the Splits property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Splits property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Splits.ContainsKey(_symbol))
    {
        var split = slice.Splits[_symbol];
    }
}

public void OnData(Splits splits)
{
    if (splits.ContainsKey(_symbol))
    {
        var split = splits[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    split = slice.Splits.get(self.symbol)
    if split:
        pass

You can also iterate through the Splits dictionary. The keys of the dictionary are the Symbol objects and the values are the Split objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Splits)
    {
        var symbol = kvp.Key;
        var split = kvp.Value;
    }
}

public void OnData(Splits splits)
{
    foreach (var kvp in splits)
    {
        var symbol = kvp.Key;
        var split = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, split in slice.Splits.items():
        pass

LEAN stores the data for stock splits in factor files. To view some example factor files, see the LEAN GitHub repository . In backtests, your algorithm receives Split objects at midnight. In live trading, your algorithm receives Split objects when the factor files are ready.

If you hold an Option contract for an underlying Equity when a split occurs, LEAN closes your Option contract position.

If a split event occurred before an order is filled, the unfilled portion of the order will be adjusted automatically, where its quantity will be multiplied by the split factor and the limit/stop price (if any) will be divided by the split factor.

Dividends

A dividend is a payment that a company gives to shareholders to distribute profits. When a dividend payment occurs for an Equity in your algorithm, LEAN sends a Dividend object to the OnData method. Dividend objects have the following properties:

If you backtest with the Adjusted or TotalReturn data normalization mode, the dividends are factored into the price. If you backtest with the other data normalization modes or trade live, when a dividend payment occurs, LEAN automatically adds the payment amount to your cashbook. If you have indicators in your algorithm, reset your indicators when dividend payments occur so that the data in your indicators account for the price adjustments that the dividend causes.

To get the Dividend objects in the Slice , index the Dividends property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Dividends property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Dividends.ContainsKey(_symbol))
    {
        var dividend = slice.Dividends[_symbol];
    }
}

public void OnData(Dividends dividends)
{
    if (dividends.ContainsKey(_symbol))
    {
        var dividend = dividends[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    dividend = slice.Dividends.get(self.symbol)
    if dividend:
        pass

You can also iterate through the Dividends dictionary. The keys of the dictionary are the Symbol objects and the values are the Dividend objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Dividends)
    {
        var symbol = kvp.Key;
        var dividend = kvp.Value;
    }
}

public void OnData(Dividends dividends)
{
    foreach (var kvp in dividends)
    {
        var symbol = kvp.Key;
        var dividend = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, dividend in slice.Dividends.items():
        pass

For a full example, see the DividendAlgorithm DividendAlgorithm in the LEAN GitHub repository.

Symbol Changes

The benefit of the Symbol class is that it always maps to the same security, regardless of their trading ticker. When a company changes its trading ticker, LEAN sends a SymbolChangedEvent to the OnData method. SymbolChangedEvent objects have the following properties:

To get the SymbolChangedEvent objects in the Slice , index the SymbolChangedEvents property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the SymbolChangedEvents property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.SymbolChangedEvents.ContainsKey(_symbol))
    {
        var symbolChangedEvent = slice.SymbolChangedEvents[_symbol];
    }
}

public void OnData(SymbolChangedEvents symbolChangedEvents)
{
    if (symbolChangedEvents.ContainsKey(_symbol))
    {
        var symbolChangedEvent = symbolChangedEvents[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    symbol_changed_event = slice.SymbolChangedEvents.get(self.symbol)
    if symbol_changed_event:
        pass

You can also iterate through the SymbolChangedEvents dictionary. The keys of the dictionary are the Symbol objects and the values are the SymbolChangedEvent objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.SymbolChangedEvents)
    {
        var symbol = kvp.Key;
        var symbolChangedEvent = kvp.Value;
    }
}

public void OnData(SymbolChangedEvents symbolChangedEvents)
{
    foreach (var kvp in symbolChangedEvents)
    {
        var symbol = kvp.Key;
        var symbolChangedEvent = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, symbol_changed_event in slice.SymbolChangedEvents.items():
        pass

If you have an open order for a security when they change their ticker, LEAN cancels your order. To keep your order, in the OnOrderEvent method, get the quantity and Symbol of the cancelled order and submit a new order.

public override void OnOrderEvent(OrderEvent orderEvent)
{
    if (orderEvent.Status == OrderStatus.Canceled)
    {
        var ticket = Transactions.GetOrderTicket(orderEvent.OrderId);
        if (ticket.Tag.Contains("symbol changed event"))
        {
            Transactions.AddOrder(ticket.SubmitRequest);
        }
    } 
}
def OnOrderEvent(self, order_event: OrderEvent) -> None:
    if order_event.Status == OrderStatus.Canceled:
        ticket = self.Transactions.GetOrderTicket(order_event.OrderId)
        if "symbol changed event" in ticket.Tag:
            self.Transactions.AddOrder(ticket.SubmitRequest)

LEAN stores the data for ticker changes in map files. To view some example map files, see the LEAN GitHub repository .

Delistings

When a company is delisting from an exchange, LEAN sends a Delisting object to the OnData method. Delisting objects have the following properties:

You receive Delisting objects when a delisting is in the near future and when it occurs. To know if the delisting occurs in the near future or now, check the Type property.

To get the Delisting objects in the Slice , index the Delistings property of the Slice with the security Symbol . The Slice may not contain data for your Symbol . To avoid issues, check if the Delistings property contains data for your security before you index it with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Delistings.ContainsKey(_symbol))
    {
        var delisting = slice.Delistings[_symbol];
    }
}

public void OnData(Delistings delistings)
{
    if (delistings.ContainsKey(_symbol))
    {
        var delisting = delistings[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    delisting = slice.Delistings.get(self.symbol)
    if delisting:
        pass

You can also iterate through the Delistings dictionary. The keys of the dictionary are the Symbol objects and the values are the Delisting objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Delistings)
    {
        var symbol = kvp.Key;
        var delisting = kvp.Value;
    }
}

public void OnData(Delistings delistings)
{
    foreach (var kvp in delistings)
    {
        var symbol = kvp.Key;
        var delisting = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, delisting in slice.Delistings.items():
        pass

The delist warning occurs on the final trading day of the stock to give you time to gracefully exit out of positions before LEAN automatically liquidates them.

if (delisting.Type == DelistingType.Warning)
{
    // Liquidate with MarketOnOpenOrder on delisting warning
    var quantity = Portfolio[symbol].Quantity;
    if (quantity != 0)
    {
        MarketOnOpenOrder(symbol, -quantity);
    }
}
if delisting.Type == DelistingType.Warning:
    # Liquidate with MarketOnOpenOrder on delisting warning
    quantity = self.Portfolio[symbol].Quantity
    if quantity != 0:
        self.MarketOnOpenOrder(symbol, -quantity)

For a full example, see the DelistingEventsAlgorithm DelistingEventsAlgorithm in the LEAN GitHub repository.

 

3.7.2.4 Data Preparation

Introduction

The India Equities dataset provides price data for backtests.

Sourcing

TrueData is an authorized NSE and MCX data vendor founded by Kapil Marwaha in 2007, with the goal of providing users with a multitude of solutions for the financial services sector, including making market data feeds available in all its forms, to as many applications as possible, including a wide range of technical analysis applications, trading solutions, automated & algorithmic traders/platforms and a lot more.

Bar Building

We receive minute-resolution trade data and aggregate it to build hour and daily bars. To create custom resolution periods, see Consolidating Data .

 

3.7.2.5 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the India Equity market.

Pre-market Hours

The following table shows the pre-market hours for the India Equity market:

Weekday Time (Asia/Kolkata)
Monday 09:00:00 to 09:15:00
Tuesday 09:00:00 to 09:15:00
Wednesday 09:00:00 to 09:15:00
Thursday 09:00:00 to 09:15:00
Friday 09:00:00 to 09:15:00

Regular Trading Hours

The following table shows the regular trading hours for the India Equity market:

Weekday Time (Asia/Kolkata)
Monday 09:15:00 to 15:30:00
Tuesday 09:15:00 to 15:30:00
Wednesday 09:15:00 to 15:30:00
Thursday 09:15:00 to 15:30:00
Friday 09:15:00 to 15:30:00

Post-market Hours

The following table shows the post-market hours for the India Equity market:

Weekday Time (Asia/Kolkata)
Monday 15:40:00 to 16:00:00
Tuesday 15:40:00 to 16:00:00
Wednesday 15:40:00 to 16:00:00
Thursday 15:40:00 to 16:00:00
Friday 15:40:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the India Equity market:

Date ( yyyy-mm-dd )
2004-01-26 2004-04-14 2005-01-26 2005-04-14 2005-08-15
2006-01-26 2006-04-14 2006-05-01 2006-08-15 2006-10-02
2006-12-25 2007-01-26 2007-05-01 2007-08-15 2007-10-02
2007-12-25 2008-04-14 2008-05-01 2008-08-15 2008-10-02
2008-12-25 2009-01-26 2009-04-14 2009-05-01 2009-10-02
2009-12-25 2010-01-26 2010-04-14 2011-01-26 2011-03-02
2011-04-12 2011-04-14 2011-04-22 2011-08-15 2011-08-31
2011-09-01 2011-10-06 2011-10-26 2011-10-27 2011-11-07
2011-11-10 2011-12-06 2012-01-26 2012-02-20 2012-03-08
2012-04-05 2012-04-06 2012-05-01 2012-08-15 2012-08-20
2012-09-19 2012-10-02 2012-10-24 2012-11-14 2012-11-28
2012-12-25 2013-03-27 2013-03-29 2013-04-19 2013-04-24
2013-05-01 2013-08-09 2013-08-15 2013-09-09 2013-10-02
2013-10-16 2013-11-04 2013-11-15 2013-12-25 2014-02-27
2014-03-17 2014-04-08 2014-04-14 2014-04-18 2014-04-24
2014-05-01 2014-07-29 2014-08-15 2014-08-29 2014-10-02
2014-10-03 2014-10-06 2014-10-15 2014-10-24 2014-11-04
2014-11-06 2014-12-25 2015-01-26 2015-02-17 2015-03-06
2015-04-02 2015-04-03 2015-04-14 2015-05-01 2015-09-17
2015-09-25 2015-10-02 2015-10-22 2015-11-12 2015-11-25
2015-12-25 2016-01-26 2016-03-07 2016-03-24 2016-03-25
2016-04-14 2016-04-15 2016-04-19 2016-07-06 2016-08-15
2016-09-05 2016-09-13 2016-10-11 2016-10-12 2016-10-31
2016-11-14 2017-01-26 2017-02-24 2017-03-13 2017-04-04
2017-04-14 2017-05-01 2017-06-26 2017-08-15 2017-08-25
2017-10-02 2017-10-20 2017-12-25 2018-01-26 2018-02-13
2018-03-02 2018-03-29 2018-03-30 2018-05-01 2018-08-15
2018-08-22 2018-09-13 2018-09-20 2018-10-02 2018-10-18
2018-11-08 2018-11-23 2018-12-25 2019-03-04 2019-03-21
2019-04-17 2019-04-19 2019-04-29 2019-05-01 2019-06-05
2019-08-12 2019-08-15 2019-09-02 2019-09-10 2019-10-02
2019-10-08 2019-10-21 2019-10-28 2019-11-12 2019-12-25
2020-02-21 2020-03-10 2020-04-02 2020-04-06 2020-04-10
2020-04-14 2020-05-01 2020-05-25 2020-10-02 2020-11-16
2020-11-30 2020-12-25 2021-01-26 2021-03-11 2021-03-29
2021-04-02 2021-04-14 2021-04-21 2021-05-13 2021-07-21
2021-08-19 2021-09-10 2021-10-15 2021-11-05 2021-11-19
2022-01-26 2022-04-14 2022-08-15 2023-01-26 2023-04-14
2023-05-01 2023-08-15 2023-10-02 2023-12-25 2024-01-26

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The India Equity market trades in the Asia/Kolkata time zone.

 

3.7.3 Equity Options

Equity Options are a financial derivative that gives the holder the right (but not the obligation) to buy or sell the underlying Equity, such as Apple, at the stated exercise price.

See Also

BasicTemplateOptionsAlgorithm.py
BasicTemplateOptionsAlgorithm.cs

 

3.7.3.1 Requesting Data

Introduction

Request Equity Options data in your algorithm to receive a feed of contract prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Equity Options dataset listing . To trade Equity Options live, you can use one of the brokerage data feeds . We currently only support American-style Options for US Equity Options.

Create Subscriptions

Before you can subscribe to an Option contract, you must configure the underlying Equity and get the contract Symbol .

Configure the Underlying Equity

If you want to subscribe to the underlying Equity in the Initialize method, set the Equity data normalization to DataNormalizationMode.Raw .

_symbol = AddEquity("SPY", dataNormalizationMode: DataNormalizationMode.Raw).Symbol;
self.symbol = self.AddEquity("SPY", dataNormalizationMode=DataNormalizationMode.Raw).Symbol

If your algorithm has a dynamic universe of Equities, before you add the Equity universe in the Initialize method, set the universe data normalization mode to DataNormalizationMode.Raw .

UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw;
self.UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Get Contract Symbols

To subscribe to an Option contract, you need the contract Symbol . You can get the contract Symbol from the CreateOption method or from the OptionChainProvider . If you use the CreateOption method, you need to provide the details of an existing contract.

_contractSymbol = QuantConnect.Symbol.CreateOption(_symbol, Market.USA,
    OptionStyle.American, OptionRight.Call, 365, new DateTime(2022, 6, 17));
self.contract_symbol = Symbol.CreateOption(self.symbol, Market.USA,
    OptionStyle.American, OptionRight.Call, 365, datetime(2022, 6, 17))

Another way to get an Option contract Symbol is to use the OptionChainProvider . The GetOptionContractList method of OptionChainProvider returns a list of Symbol objects that reference the available Option contracts for a given underlying Equity on a given date. To filter and select contracts, you can use the following properties of each Symbol object:

Property Description
ID.Date The expiration date of the contract.
ID.StrikePrice The strike price of the contract.
ID.OptionRight The contract type. The OptionRight enumeration has the following members:
ID.OptionStyle The contract style. The OptionStyle enumeration has the following members:
We currently only support American-style Options for US Equity Options.
var contractSymbols = OptionChainProvider.GetOptionContractList(_symbol, Time);
var expiry = contractSymbols.Select(symbol => symbol.ID.Date).Min();
var filteredSymbols = contractSymbols.Where(symbol => symbol.ID.Date == expiry && symbol.ID.OptionRight == OptionRight.Call);
_contractSymbol = filteredSymbols.OrderByDescending(symbol => symbol.ID.StrikePrice).Last();
contract_symbols = self.OptionChainProvider.GetOptionContractList(self.symbol, self.Time)
expiry = min([symbol.ID.Date for symbol in contract_symbols])
filtered_symbols = [symbol for symbol in contract_symbols if symbol.ID.Date == expiry and symbol.ID.OptionRight == OptionRight.Call]
self.contract_symbol = sorted(filtered_symbols, key=lambda symbol: symbol.ID.StrikePrice)[0]

Subscribe to Contracts

To create an Equity Option contract subscription, pass the contract Symbol to the AddOptionContract method. Save a reference to the contract Symbol so you can easily access the Option contract in the OptionChain that LEAN passes to the OnData method. This method returns an Option object. To override the default pricing model of the Option, set a pricing model .

var option = AddOptionContract(_contractSymbol);
option.PriceModel = OptionPriceModels.BjerksundStensland();
option = self.AddOptionContract(self.contract_symbol)
option.PriceModel = OptionPriceModels.BjerksundStensland()

The AddOptionContract method creates a subscription for a single Option contract and adds it to your user-defined universe. To create a dynamic universe of Option contracts, add an Equity Options universe or an Options Universe Selection model .

Warm Up Contract Prices

If you subscribe to an Option contract with AddOptionContract , you'll need to wait until the next Slice to receive data and trade the contract. To trade the contract in the same time step you subscribe to the contract, set the current price of the contract in a security initializer .

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, seeder, this));
seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, seeder, self))

Supported Assets

To view the supported assets in the US Equities dataset, see the Data Explorer .

Resolutions

The following table shows the available resolutions and data formats for Equity Option contract subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick

Second

Minute green check green check
Hour green check green check
Daily green check green check

The default resolution for Option contract subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddOptionContract method.

AddOptionContract(_contractSymbol, Resolution.Minute);
self.AddOptionContract(self.contract_symbol, Resolution.Minute)

To create custom resolution periods, see Consolidating Data .

Supported Markets

LEAN groups all of the US Equity exchanges under Market.USA . You don't need to pass a Market argument to the AddOptionContract method because the contract Symbol already contains the market.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddOptionContract(_contractSymbol, fillForward: false);
self.AddOptionContract(self.contract_symbol, fillForward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. Options are already leveraged products, so you can't change their leverage.

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddOptionContract(_contractSymbol, extendedMarketHours: true);
self.AddOptionContract(self.contract_symbol, extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours .

Remove Subscriptions

To remove a contract subscription that you created with AddOptionContract , call the RemoveOptionContract method. This method is an alias for RemoveSecurity .

RemoveOptionContract(_contractSymbol);
self.RemoveOptionContract(self.contract_symbol)

The RemoveOptionContract method cancels your open orders for the contract and liquidates your holdings.

Properties

The AddOptionContract method returns an Option object, which have the following properties:

 

3.7.3.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the contract ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the contract Symbol . If the contract doesn't actively trade or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_contractSymbol))
    {
        var tradeBar = slice.Bars[_contractSymbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_contractSymbol))
    {
        var tradeBar = tradeBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.Bars:
        trade_bar = slice.Bars[self.contract_symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the contract Symbol . If the contract doesn't actively get quotes or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = slice.QuoteBars[_contractSymbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = quoteBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.contract_symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , index the OptionChains property of the Slice with the canonical Symbol .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contracts = chain.Contracts

You can also loop through the OptionChains property to get each OptionChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        contracts = chain.Contracts

Option Contracts

OptionContract objects represent the data of a single Option contract in the market. They have the following properties:

To get the Option contracts in the Slice , use the Contracts property of the OptionChain .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            price = contract.Price

Greeks and Implied Volatility

To get the Greeks and implied volatility of an Option contract, use the Greeks and ImpliedVolatility members.

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var delta = contract.Greeks.Delta;
            var iv = contract.ImpliedVolatility;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            delta = contract.Greeks.Delta
            iv = contract.ImpliedVolatility

LEAN only calculates Greeks and implied volatility when you request them because they are expensive operations. If you invoke the Greeks member, the Greeks aren't calculated. However, if you invoke the Greeks.Delta member, LEAN calculates the delta. To avoid unecessary computation in your algorithm, only request the Greeks and implied volatility when you need them. For more information about the Greeks and implied volatility, see Options Pricing .

Open Interest

Open interest is the number of outstanding contracts that haven't been settled. It provides a measure of investor interest and the market liquidity, so it's a popular metric to use for contract selection. Open interest is calculated once per day. To get the latest open interest value, use the OpenInterest property of the Option or OptionContract .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            open_interest = contract.OpenInterest

 

3.7.3.3 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the Equity Option market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Equity Option market:

Weekday Time (America/New York)
Monday 09:30:00 to 16:00:00
Tuesday 09:30:00 to 16:00:00
Wednesday 09:30:00 to 16:00:00
Thursday 09:30:00 to 16:00:00
Friday 09:30:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

LEAN uses the trading holidays from the NYSE website.

The following table shows the dates of holidays for the Equity Option market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

The following table shows the early closes for the Equity Option market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
1999-11-26 13:00:00
2000-07-03 13:00:00
2000-11-24 13:00:00
2001-07-03 13:00:00
2001-11-23 13:00:00
2001-12-24 13:00:00
2002-07-05 13:00:00
2002-11-29 13:00:00
2002-12-24 13:00:00
2003-07-03 13:00:00
2003-11-28 13:00:00
2003-12-24 13:00:00
2003-12-26 13:00:00
2004-11-26 13:00:00
2005-11-25 13:00:00
2006-07-03 13:00:00
2006-11-24 13:00:00
2007-07-03 13:00:00
2007-11-23 13:00:00
2007-12-24 13:00:00
2008-07-03 13:00:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-07-03 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-07-03 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-07-03 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:00:00
2016-11-25 13:00:00
2017-07-03 13:00:00
2017-11-24 13:00:00
2017-12-24 13:00:00
2018-07-03 13:00:00
2018-11-23 13:00:00
2018-12-24 13:00:00
2019-07-03 13:00:00
2019-11-29 13:00:00
2019-12-24 13:00:00
2020-11-27 13:00:00
2020-12-24 13:00:00
2021-11-26 13:00:00
2022-11-25 13:00:00

Late Opens

There are no days with late opens.

Time Zone

The Equity Option market trades in the America/New York time zone.

 

3.7.4 Crypto

A Cryptocurrency is a digital currency that's secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.

See Also

BasicTemplateCryptoAlgorithm.py
BasicTemplateCryptoAlgorithm.cs

 

3.7.4.1 Requesting Data

Introduction

Request Crypto data in your algorithm to receive a feed of asset prices in the OnData method. For more information about the specific datasets we use for backtests, see the CoinAPI datasets . To trade Crypto live, you can use our Crypto data feed .

Create Subscriptions

To create a Crypto subscription, in the Initialize method, call the AddCrypto method. The AddCrypto method returns a Crypto object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddCrypto("BTCUSD").Symbol;
self.symbol = self.AddCrypto("BTCUSD").Symbol

The AddCrypto method creates a subscription for a single Crypto asset and adds it to your user-defined universe. To create a dynamic universe of Crypto assets, add a Crypto universe .

To view the supported assets, see the CoinAPI datasets .

Fungible Assets

Fungible assets are assets that are interchangeable with each other. For example, every Bitcoin is effectively identical to every other Bitcoin. In contrast, non-fungible tokens (NFTs) are non-fungible because each one is unique. An example of an NFT is the Bored Ape Yacht Club collection. LEAN doesn't currently support trading NFTs.

Resolutions

The following table shows the available resolutions and data formats for Crypto subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check green check
Second green check green check
Minute green check green check
Hour green check green check
Daily green check green check

The default resolution for Crypto subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddCrypto method.

_symbol = AddCrypto("BTCUSD", Resolution.Daily).Symbol;
self.symbol = self.AddCrypto("BTCUSD", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

The following Market enumeration members are available for Crypto:

To set the market for a security, pass a market argument to the AddCrypto method.

_symbol = AddCrypto("BTCUSD", market: Market.GDAX).Symbol;
self.symbol = self.AddCrypto("BTCUSD", market=Market.GDAX).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddCrypto("BTCUSD", fillForward: false).Symbol;
self.symbol = self.AddCrypto("BTCUSD", fillForward=False).Symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The amount of leverage available to you depends on the brokerage you use. To change the amount of leverage you can use for a security, pass a leverage argument to the AddCrypto method.

_symbol = AddCrypto("BTCUSD", leverage: 3).Symbol;
self.symbol = self.AddCrypto("BTCUSD", leverage=3).Symbol

For more information about the leverage each brokerage provides, see Brokerages .

Properties

The AddCrypto method returns a Crypto object, which have the following properties:

 

3.7.4.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the security ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the security Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_symbol))
    {
        var tradeBar = tradeBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the security Symbol . If the security doesn't actively get quotes or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_symbol))
    {
        var quoteBar = quoteBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the security. A quote tick is an offer to buy or sell the security at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

 

3.7.4.3 Holdings

Introduction

Crypto holdings require special consideration because not all brokerages track your positions in each currency pair.

Cash vs Margin Brokerage Accounts

Some of the Crypto brokerages integrated into QuantConnect support cash and margin accounts while some only support cash accounts. If you want to short Crypto assets or use leverage, you need a margin account. Follow these steps to view which account types each brokerage supports:

  1. Open the brokerage guides .
  2. Click a Crypto brokerage.
  3. Scroll down to the Account Types section.

Virtual Pairs

All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio cashbook and adds some BTC. The virtual pair BTCUSD represents your position in that trade, but the virtual pair doesn't actually exist. It simply represents an open trade. If you call the Liquidate method with the Symbol of a virtual pair, the method only liquidates the quantity in your virtual pair. For more information about liquidating Crypto postitions, see Crypto Trades .

Access Cypto Holdings

The CashBook stores the quantity of your Crypto holdings. To access your Crypto holdings, index the CashBook with the currency ticker. The values of the CashBook dictionary are Cash objects, which have the following properties:

var btcQuantity = Portfolio.CashBook["BTC"].Amount;
var btcValue = Portfolio.CashBook["BTC"].ValueInAccountCurrency;
btc_quantity = self.Portfolio.CashBook['BTC'].Amount
btc_value = self.Portfolio.CashBook['BTC'].ValueInAccountCurrency

To access the virtual pair of your Crypto trades, index the Portfolio object with the pair Symbol .

var securityHolding = Portfolio[_btcUsdSymbol];
security_holding  = self.Portfolio[self.btc_usd_symbol]

Stateful Redeployments

When you make a trade inside of a running algorithm, LEAN tracks the virtual position state for you, but it won't survive between deployments. Some brokerages save your virtual pairs, so you can load them into your algorithm when you stop and redeploy it. Depending on the brokerage you select, you may be able to manually add virtual pairs when you deploy live algorithms with the LEAN CLI or cloud deployment wizard .

 

3.7.4.4 Market Hours

Introduction

The Crypto markets are open 24/7. There are no pre-market hours, post-market hours, holidays, late opens, or early closes.

 

3.7.5 Crypto Futures

Crypto Perpetual Futures are derivative financial contracts that obligate parties to buy or sell an asset at an unspecified future date.

See Also

BasicTemplateCryptoFutureAlgorithm.py
BasicTemplateCryptoFutureAlgorithm.cs

 

3.7.5.1 Requesting Data

Introduction

Request Crypto Futures data in your algorithm to receive a feed of asset prices in the OnData method. For more information about the specific datasets we use for backtests, see the Binance Crypto Future Price Data dataset listing . To trade Crypto live, you can use our Crypto Futures data feed .

Create Subscriptions

To create a Crypto Futures subscription, in the Initialize method, call the AddCryptoFuture method. The AddCryptoFuture method returns a CryptoFuture object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddCryptoFuture("BTCUSD").Symbol;
self.symbol = self.AddCryptoFuture("BTCUSD").Symbol

The AddCryptoFuture method creates a subscription for a single Crypto Futures asset and adds it to your user-defined universe.

To view the supported assets in the Crypto Futures dataset, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for Crypto Futures contract subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check green check
Second green check green check
Minute green check green check
Hour green check green check
Daily green check green check

The default resolution for Crypto Futures subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddCryptoFuture method.

_symbol = AddCryptoFuture("BTCUSD", Resolution.Daily).Symbol;
self.symbol = self.AddCryptoFuture("BTCUSD", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

Crypto Futures are currently only available on Market.Binance . To set the market for a security, pass a market argument to the AddCryptoFuture method.

_symbol = AddCryptoFuture("BTCUSD", market: Market.Binance).Symbol;
self.symbol = self.AddCryptoFuture("BTCUSD", market=Market.Binance).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddCryptoFuture("BTCUSD", fillForward: false).Symbol;
self.symbol = self.AddCryptoFuture("BTCUSD", fillForward=False).Symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The amount of leverage available to you depends on the brokerage you use. To change the amount of leverage you can use for a security, pass a leverage argument to the AddCryptoFuture method.

_symbol = AddCryptoFuture("BTCUSD", leverage: 3).Symbol;
self.symbol = self.AddCryptoFuture("BTCUSD", leverage=3).Symbol

For more information about the leverage each brokerage provides, see Brokerages .

Properties

The AddCryptoFuture method returns a CryptoFuture object, which have the following properties:

 

3.7.5.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the security ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the security Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_symbol))
    {
        var tradeBar = tradeBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the security Symbol . If the security doesn't actively get quotes or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_symbol))
    {
        var quoteBar = quoteBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the security. A quote tick is an offer to buy or sell the security at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the security doesn't actively trade or you are in the same time step as when you added the security subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your security before you index the Slice with the security Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

Margin Interest Rates

MarginInterestRate objects contain the margin interest rate, which is a cost associated with trading on margin. MarginInterestRate objects have the following properties:

To get the MarginInterestRate objects in the Slice , index the MarginInterestRate property of the Slice with the Crypto Future Symbol . The MarginInterestRate property of the Slice may not contain data for your Symbol . To avoid issues, check if the property contains data for your Crypto Future before you index it with the Crypto Future Symbol .

public override void OnData(Slice slice)
{
    if (slice.MarginInterestRates.ContainsKey(_symbol))
    {
        var interestRate = slice.MarginInterestRates[_symbol].InterestRate;
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.MarginInterestRates:
        interest_rate = slice.MarginInterestRates[self.symbol].InterestRate

You can also iterate through the MarginInterestRates dictionary. The keys of the dictionary are the Symbol objects and the values are the MarginInterestRate objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.MarginInterestRates)
    {
        var symbol = kvp.Key;
        var marginInterestRate = kvp.Value;
        var interestRate = marginInterestRate.InterestRate;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, margin_interest_rate in slice.MarginInterestRates.items():
        interest_rate = margin_interest_rate.InterestRate

 

3.7.5.3 Market Hours

Introduction

The Crypto Futures markets are open 24/7. There are no pre-market hours, post-market hours, holidays, late opens, or early closes.

 

3.7.6 Forex

Forex markets are for trading foreign currencies.

See Also

BasicTemplateForexAlgorithm.py
BasicTemplateForexAlgorithm.cs

 

3.7.6.1 Requesting Data

Introduction

Request Forex data in your algorithm to receive a feed of exchange rates in the OnData method. For more information about the specific dataset we use for backtests, see the FOREX dataset listing . To trade Forex live, you can use our Forex data feed .

Create Subscriptions

To create a Forex pair subscription, in the Initialize method, call the AddForex method. The AddForex method returns a Forex object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddForex("EURUSD").Symbol;
self.symbol = self.AddForex("EURUSD").Symbol

To view the supported Forex pairs, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for Forex subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check
Second
green check
Minute
green check
Hour
green check
Daily
green check

The default resolution for Forex subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddForex method.

_symbol = AddForex("EURUSD", Resolution.Daily).Symbol;
self.symbol = self.AddForex("EURUSD", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

The only market available for Forex pairs is Market.Oanda , so you don't need to pass a market argument to the AddForex method.

_symbol = AddForex("EURUSD", market: Market.Oanda).Symbol;
self.symbol = self.AddForex("EURUSD", market=Market.Oanda).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddForex("EURUSD", fillForward: false).Symbol;
self.symbol = self.AddForex("EURUSD", fillForward=False).Symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The Oanda brokerage let's you use up to 50x leverage on margin accounts. To change the amount of leverage you can use for a Forex pair, pass a leverage argument to the AddForex method.

_symbol = AddForex("EURUSD", leverage: 35).Symbol;
self.symbol = self.AddForex("EURUSD", leverage=35).Symbol

Properties

The AddForex method returns a Forex object, which have the following properties:

 

3.7.6.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a QuoteBar argument, it only receives QuoteBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the QuoteBars DataDictionary is made up of QuoteBar objects. To access individual data points in the dictionary, you can index the dictionary with the Forex pair ticker or Symbol , but we recommend you use the Symbol .

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the Forex pair Symbol . If the Forex pair doesn't actively get quotes or you are in the same time step as when you added the Forex pair subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your Forex pair before you index the Slice with the Forex pair Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_symbol))
    {
        var quoteBar = quoteBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the Forex pair. A quote tick is an offer to buy or sell the Forex pair at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the Forex pair doesn't actively trade or you are in the same time step as when you added the Forex pair subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your Forex pair before you index the Slice with the Forex pair Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

 

3.7.6.3 Market Hours

Introduction

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The Forex market trades in the America/New York time zone.

Assets With Other Hours

The following list shows the pairs that have different trading periods than the overall Forex market:

 

3.7.6.3.1 EURNZD

Introduction

This page shows the trading hours, holidays, and time zone of the EUR/NZD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the EUR/NZD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the EUR/NZD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the EUR/NZD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the EUR/NZD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The EUR/NZD pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.2 GBPNZD

Introduction

This page shows the trading hours, holidays, and time zone of the GBP/NZD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the GBP/NZD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the GBP/NZD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the GBP/NZD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the GBP/NZD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The GBP/NZD pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.3 NZDCAD

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/CAD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/CAD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/CAD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/CAD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/CAD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/CAD pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.4 NZDCHF

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/CHF pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/CHF pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/CHF pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/CHF pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/CHF pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/CHF pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.5 NZDHKD

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/HKD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/HKD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/HKD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/HKD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/HKD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/HKD pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.6 NZDJPY

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/JPY pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/JPY pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/JPY pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/JPY pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/JPY pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/JPY pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.7 NZDSGD

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/SGD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/SGD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/SGD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/SGD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/SGD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/SGD pair in the Forex market trades in the America/New York time zone.

 

3.7.6.3.8 NZDUSD

Introduction

This page shows the trading hours, holidays, and time zone of the NZD/USD pair in the Forex market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NZD/USD pair in the Forex market:

Weekday Time (America/New York)
Sunday 17:03:00 to 24:00:00
Monday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Tuesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Wednesday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Thursday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00, 17:03:00 to 24:00:00
Friday 00:00:00 to 12:58:00, 13:03:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NZD/USD pair in the Forex market:

Date ( yyyy-mm-dd )
2005-01-01 2010-01-01 2010-12-25 2011-01-01 2012-12-25
2013-01-01 2015-12-25 2016-01-01 2016-12-25 2017-01-01
2020-12-25 2021-01-01 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2023-12-24 2023-12-31 2024-01-01

Early Closes

The following table shows the early closes for the NZD/USD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2005-12-29 17:00:00
2005-12-30 17:00:00
2007-12-31 17:00:00
2008-12-31 17:00:00
2009-12-31 17:00:00
2010-12-31 17:00:00
2011-12-30 17:00:00
2012-12-31 14:00:00
2013-12-31 14:00:00
2014-12-31 14:00:00
2015-12-31 14:00:00
2016-12-30 14:00:00
2017-12-29 17:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-12-24 17:00:00
2019-12-31 17:00:00
2020-12-24 17:00:00
2020-12-31 17:00:00
2021-12-31 17:00:00

Late Opens

The following table shows the late opens for the NZD/USD pair in the Forex market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2018-12-25 17:00:00
2019-01-01 17:00:00
2019-12-25 17:00:00
2020-01-01 17:00:00
2023-12-25 17:00:00
2024-01-01 17:00:00

Time Zone

The NZD/USD pair in the Forex market trades in the America/New York time zone.

 

3.7.7 Futures

Select one of the following Futures markets to see its operating hours:

See Also

BasicTemplateFuturesAlgorithm.py
BasicTemplateFuturesAlgorithm.cs

 

3.7.7.1 Requesting Data

Introduction

Request Futures data in your algorithm to receive a feed of contract prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Futures dataset listing . To trade Futures live, you can use our Futures data feed or one of the brokerage data feeds .

Create Subscriptions

Before you can subscribe to a Futures contract, you must get the contract Symbol .

Get Contract Symbols

To get Futures contract Symbol objects, call the CreateFuture method or use the FutureChainProvider . If you use the CreateFuture method, you need to know the specific contract details.

_contractSymbol = QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini,
    Market.CME, new DateTime(2022, 6, 17));
self.contract_symbol = Symbol.CreateFuture(Futures.Indices.SP500EMini,
    Market.CME, datetime(2022,6,17))

If you use the FutureChainProvider , you need to create the continuous contract Symbol of the Future. The GetFutureContractList method of FutureChainProvider returns a list of Symbol objects that reference the available Futures contracts for a given underlying Future on a given date.

var continuousFutureSymbol = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME);
var contractSymbols = FutureChainProvider.GetFutureContractList(continuousFutureSymbol, Time);
_contractSymbol = contractSymbols.OrderByDescending(symbol => symbol.ID.Date).Last();
continuous_future_symbol = Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME)
contract_symbols = self.FutureChainProvider.GetFutureContractList(continuous_future_symbol, self.Time)
self.contract_symbol = sorted(contract_symbols, key=lambda symbol: symbol.ID.Date)[0]

Subscribe to Contracts

To create a Futures contract subscription, pass the contract Symbol to the AddFutureContract method. Save a reference to the contract Symbol so you can easily access the contract in the FuturesChain that LEAN passes to the OnData method.

AddFutureContract(_contractSymbol);
self.AddFutureContract(self.contract_symbol)

The AddFutureContract method creates a subscription for a single Future contract and adds it to your user-defined universe. To create a dynamic universe of Futures contracts, add a Futures universe or a Futures Universe Selection model .

Warm Up Contract Prices

If you subscribe to a Futures contract with AddFutureContract , you'll need to wait until the next Slice to receive data and trade the contract. To trade the contract in the same time step you subscribe to the contract, set the current price of the contract in a security initializer .

SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel,
    new FuncSecuritySeeder(GetLastKnownPrices)));
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel,
    FuncSecuritySeeder(self.GetLastKnownPrices)));

Supported Assets

To view the supported assets in the US Futures dataset, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for Futures subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check green check
Second green check green check
Minute green check green check
Hour green check green check
Daily green check green check

The default resolution for Futures contract subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddFutureContract method.

AddFutureContract(_contractSymbol, Resolution.Daily);
self.AddFutureContract(self.contract_symbol, Resolution.Daily)

To create custom resolution periods, see Consolidating Data .

Supported Markets

The following Market enumeration members are available for Futures:

You don't need to pass a market argument to the AddFutureContract method because the contract Symbol already contains the market.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddFutureContract(_contractSymbol, fillForward: false);
self.AddFutureContract(self.contract_symbol, fillForward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. Futures are already leveraged products, so you can't change their leverage with the default margin model .

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddFutureContract(_contractSymbol, extendedMarketHours: true);
self.AddFutureContract(self.contract_symbol, extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours .

In general, we model most Futures market hours with the following segments:

Market Segment Time
Pre-market 00:00:00 to 09:30:00
Market 09:30:00 to 17:00:00
Post-market 18:00:00 to 00:00:00

We model it this way because some Futures, like VIX, have pre- and post-market hours, so we standardized it. With this segmentation, if you set a Scheduled Events for the market open, it's set for 9:30 AM instead of midnight.

Continuous Contracts

A continuous Futures contract represents a single contract that maps to other contracts over time as the rollover rules are met. For more information about continuous Futures contracts, see Continuous Contracts .

Properties

The AddFutureContract method returns a Future object, which have the following properties:

 

3.7.7.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the contract ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the contract Symbol . If the contract doesn't actively trade or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_contractSymbol))
    {
        var tradeBar = slice.Bars[_contractSymbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_contractSymbol))
    {
        var tradeBar = tradeBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.Bars:
        trade_bar = slice.Bars[self.contract_symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the contract Symbol . If the contract doesn't actively get quotes or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = slice.QuoteBars[_contractSymbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = quoteBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.contract_symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the contract. A quote tick is an offer to buy or sell the contract at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the contract doesn't actively trade or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_contractSymbol))
    {
        var ticks = slice.Ticks[_contractSymbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_contractSymbol))
    {
        foreach (var tick in ticks[_contractSymbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.Ticks:
        ticks = slice.Ticks[self.contract_symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

Futures Chains

FuturesChain objects represent an entire chain of contracts for a single underlying Future. They have the following properties:

To get the FuturesChain , index the FuturesChains property of the Slice with the continuous contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.contract_symbol.Canonical)
    if chain:
        contracts = chain.Contracts

You can also loop through the FuturesChains property to get each FuturesChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(FuturesChains futuresChains)
{
    foreach (var kvp in futuresChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for continuous_contract_symbol, chain in slice.FuturesChains.items():
        contracts = chain.Contracts

Futures Contracts

FuturesContract objects represent the data of a single Futures contract in the market. They have the following properties:

To get the Futures contracts in the Slice , use the Contracts property of the FuturesChain .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.LastPrice;
        }
    }
}

public void OnData(FuturesChains futuresChains)
{
    if (futuresChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.LastPrice;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            price = contract.LastPrice

Open interest is the number of outstanding contracts that haven't been settled. It provides a measure of investor interest and the market liquidity, so it's a popular metric to use for contract selection. Open interest is calculated once per day. To get the latest open interest value, use the OpenInterest property of the Future or FutureContract .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}

def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            open_interest = contract.OpenInterest

Symbol Changes

When the continuous contract rolls over, LEAN passes a SymbolChangedEvent to your OnData method, which contains the old contract Symbol and the new contract Symbol . SymbolChangedEvent objects have the following properties:

To get the SymbolChangedEvent , use the SymbolChangedEvents property of the Slice .

public override void OnData(Slice slice)
{
    foreach(var changeEvent in slice.SymbolChangedEvents.Values)
    {
        Log($"Contract rollover from {changed_event.OldSymbol} to {changed_event.NewSymbol}");
    }
}
def OnData(self, slice: Slice) -> None:
    for changed_event in slice.SymbolChangedEvents.Values:
        self.Log(f"Contract rollover from {changed_event.OldSymbol} to {changed_event.NewSymbol}")

 

3.7.7.3 Market Hours

Market hours of different exchanges.

 

3.7.7.3.1 CBOT

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the CBOT Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The CBOT Future market trades in the America/Chicago time zone.

Supported Assets

The following table shows the available contracts in the CBOT Future market. Some of these contracts may have different trading periods than the overall CBOT Future market.

Symbol Contract
10Y Micro 10-Year Yield Futures
2YY Micro 2-Year Yield Futures
30Y Micro 30-Year Yield Futures
5YY Micro 5-Year Yield Futures
AW Bloomberg Commodity Index Futures
BCF Black Sea Corn Financially Settled (Platts) Futures
BWF Black Sea Wheat Financially Settled (Platts) Futures
EH Ethanol Futures
F1U 5-Year USD MAC Swap Futures
KE KC HRW Wheat Futures
MYM Micro E-mini Dow Jones Industrial Average Index Futures
TN Ultra 10-Year U.S. Treasury Note Futures
UB Ultra U.S. Treasury Bond Futures
YM E-mini Dow ($5) Futures
ZB U.S. Treasury Bond Futures
ZC Corn Futures
ZF 5-Year T-Note Futures
ZL Soybean Oil Futures
ZM Soybean Meal Futures
ZN 10-Year T-Note Futures
ZO Oats Futures
ZS Soybean Futures
ZT 2-Year T-Note Futures
ZW Chicago SRW Wheat Futures

 

3.7.7.3.1.1 10Y

Introduction

This page shows the trading hours, holidays, and time zone of the Micro 10-Year Yield Futures (10Y) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2021-12-24
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2008-12-31 15:15:00
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-03 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:15:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

The following table shows the late opens for the Micro 10-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2009-01-02 05:00:00
2011-12-27 05:00:00
2012-01-03 05:00:00
2012-12-26 05:00:00
2013-01-02 05:00:00
2013-12-26 05:00:00
2014-01-02 05:00:00

Time Zone

The Micro 10-Year Yield Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.2 2YY

Introduction

This page shows the trading hours, holidays, and time zone of the Micro 2-Year Yield Futures (2YY) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2021-12-24
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2008-12-31 15:15:00
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-03 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:15:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

The following table shows the late opens for the Micro 2-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2009-01-02 05:00:00
2011-12-27 05:00:00
2012-01-03 05:00:00
2012-12-26 05:00:00
2013-01-02 05:00:00
2013-12-26 05:00:00
2014-01-02 05:00:00

Time Zone

The Micro 2-Year Yield Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.3 30Y

Introduction

This page shows the trading hours, holidays, and time zone of the Micro 30-Year Yield Futures (30Y) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2021-12-24
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2008-12-31 15:15:00
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-03 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:15:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

The following table shows the late opens for the Micro 30-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2009-01-02 05:00:00
2011-12-27 05:00:00
2012-01-03 05:00:00
2012-12-26 05:00:00
2013-01-02 05:00:00
2013-12-26 05:00:00
2014-01-02 05:00:00

Time Zone

The Micro 30-Year Yield Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.4 5YY

Introduction

This page shows the trading hours, holidays, and time zone of the Micro 5-Year Yield Futures (5YY) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2021-12-24
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2008-12-31 15:15:00
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-03 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:15:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

The following table shows the late opens for the Micro 5-Year Yield Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2009-01-02 05:00:00
2011-12-27 05:00:00
2012-01-03 05:00:00
2012-12-26 05:00:00
2013-01-02 05:00:00
2013-12-26 05:00:00
2014-01-02 05:00:00

Time Zone

The Micro 5-Year Yield Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.5 AW

Introduction

This page shows the trading hours, holidays, and time zone of the Bloomberg Commodity Index Futures (AW) contract in the CBOT Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Bloomberg Commodity Index Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:15:00 to 13:30:00
Tuesday 08:15:00 to 13:30:00
Wednesday 08:15:00 to 13:30:00
Thursday 08:15:00 to 13:30:00
Friday 08:15:00 to 13:30:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Bloomberg Commodity Index Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-01-19 2009-02-16 2009-04-10 2009-05-25 2009-07-03
2009-09-07 2009-11-26 2009-12-25 2010-01-01 2010-01-18
2010-02-15 2010-04-02 2010-05-31 2010-07-05 2010-09-06
2010-11-25 2010-12-24 2011-01-01 2011-01-17 2011-02-21
2011-04-22 2011-05-30 2011-07-04 2011-09-05 2011-11-24
2011-12-26 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-11-22 2012-12-25 2013-01-02
2013-01-21 2013-02-18 2013-03-29 2013-05-27 2013-07-04
2013-09-02 2013-11-28 2014-01-01 2014-01-20 2014-02-17
2014-04-18 2014-05-26 2014-07-04 2014-09-01 2014-11-27
2014-12-25 2015-01-01 2015-01-19 2015-02-16 2015-04-03
2015-05-25 2015-07-03 2015-09-07 2015-11-26 2015-12-25
2016-01-01 2016-01-18 2016-02-15 2016-03-25 2016-05-30
2016-07-04 2016-09-05 2016-11-24 2016-12-26 2017-01-02
2017-01-16 2017-02-20 2017-04-14 2017-05-29 2017-07-04
2017-09-04 2017-11-23 2017-12-25 2018-01-02 2018-01-15
2018-02-19 2018-03-30 2018-04-01 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Bloomberg Commodity Index Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2010-11-26 12:00:00
2011-11-25 12:00:00
2011-12-31 12:00:00
2012-11-23 12:00:00
2012-12-24 12:00:00
2013-11-29 12:00:00
2013-12-24 12:00:00
2014-11-28 12:00:00
2014-12-24 12:00:00
2015-11-27 12:00:00
2015-12-24 12:00:00
2016-11-25 12:00:00
2016-12-23 12:00:00
2017-07-03 12:00:00
2017-11-24 12:00:00
2017-12-22 12:00:00
2018-07-03 12:00:00
2018-11-23 12:00:00
2018-12-24 12:00:00
2019-07-03 12:00:00
2019-11-29 12:00:00
2019-12-24 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The Bloomberg Commodity Index Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.6 BCF

Introduction

This page shows the trading hours, holidays, and time zone of the Black Sea Corn Financially Settled (Platts) Futures (BCF) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2017-12-25 2018-01-01 2018-03-30 2018-12-25 2019-01-01
2019-04-19 2019-12-25 2020-01-01 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:45:00
2018-12-24 12:45:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:45:00
2019-12-24 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Black Sea Corn Financially Settled (Platts) Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.7 BWF

Introduction

This page shows the trading hours, holidays, and time zone of the Black Sea Wheat Financially Settled (Platts) Futures (BWF) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2017-12-25 2018-01-01 2018-03-30 2018-12-25 2019-01-01
2019-04-19 2019-12-25 2020-01-01 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:45:00
2018-12-24 12:45:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:45:00
2019-12-24 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Black Sea Wheat Financially Settled (Platts) Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.8 EH

Introduction

This page shows the trading hours, holidays, and time zone of the Ethanol Futures (EH) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Ethanol Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Ethanol Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Ethanol Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Ethanol Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-02-15 2009-04-10 2009-05-24 2009-09-06 2009-11-25
2009-12-25 2010-01-01 2010-01-17 2010-02-14 2010-04-02
2010-05-30 2010-07-04 2010-09-05 2010-11-24 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-12-26 2012-01-15
2012-02-19 2012-04-06 2012-12-25 2013-01-02 2013-01-20
2013-02-17 2013-03-29 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-07-03 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Ethanol Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2010-11-26 12:00:00
2011-11-25 12:00:00
2011-12-31 12:00:00
2013-05-27 12:15:00
2013-07-04 12:15:00
2013-09-02 12:15:00
2013-11-28 12:15:00
2013-11-29 12:45:00
2013-12-24 12:45:00
2014-01-20 12:15:00
2014-02-17 12:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:45:00
2014-12-24 12:45:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:45:00
2015-12-24 12:45:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:45:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:45:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:45:00
2018-12-24 12:45:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:45:00
2019-12-24 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Ethanol Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.9 F1U

Introduction

This page shows the trading hours, holidays, and time zone of the 5-Year USD MAC Swap Futures (F1U) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the 5-Year USD MAC Swap Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 5-Year USD MAC Swap Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the 5-Year USD MAC Swap Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 5-Year USD MAC Swap Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The 5-Year USD MAC Swap Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.10 KE

Introduction

This page shows the trading hours, holidays, and time zone of the KC HRW Wheat Futures (KE) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the KC HRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the KC HRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the KC HRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the KC HRW Wheat Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2013-01-01 2013-01-20 2013-02-17 2013-03-29 2013-05-26
2013-07-04 2013-09-01 2013-11-28 2013-12-25 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-07-06 2014-08-31 2014-11-27 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-12-25 2016-01-01 2016-01-17
2016-02-14 2016-03-25 2016-05-29 2016-07-03 2016-07-04
2016-09-04 2016-11-24 2017-01-15 2017-02-19 2017-04-14
2017-05-28 2017-07-04 2017-09-03 2017-11-23 2017-12-25
2018-01-01 2018-01-14 2018-02-18 2018-03-30 2018-05-27
2018-07-04 2018-09-02 2018-11-22 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-12-25 2020-01-01 2020-01-19
2020-02-16 2020-04-10 2020-05-24 2020-07-03 2020-09-06
2020-11-26 2020-12-25 2021-01-01 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the KC HRW Wheat Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2013-05-24 13:15:00
2013-07-03 12:00:00
2013-08-30 13:15:00
2013-11-27 13:15:00
2013-11-29 12:00:00
2013-12-24 12:00:00
2013-12-26 13:15:00
2013-12-31 13:15:00
2014-01-02 13:15:00
2014-01-17 13:15:00
2014-02-14 13:15:00
2014-04-17 13:15:00
2014-05-23 13:15:00
2014-07-03 12:00:00
2014-08-29 13:15:00
2014-11-26 13:15:00
2014-11-28 12:00:00
2014-12-24 12:00:00
2014-12-26 13:15:00
2014-12-31 13:15:00
2015-01-02 13:15:00
2015-01-16 13:15:00
2015-02-13 13:15:00
2015-04-02 13:15:00
2015-05-22 13:15:00
2015-07-02 12:00:00
2015-09-04 13:20:00
2015-11-25 13:20:00
2015-11-27 12:05:00
2015-12-28 13:20:00
2015-12-31 13:20:00
2016-01-04 13:20:00
2016-01-15 13:20:00
2016-02-12 13:20:00
2016-03-24 13:20:00
2016-05-27 13:20:00
2016-07-01 13:20:00
2016-09-02 13:20:00
2016-11-23 13:20:00
2016-11-25 12:05:00
2016-12-23 12:05:00
2016-12-27 13:20:00
2016-12-30 13:20:00
2017-01-03 13:20:00
2017-01-13 13:20:00
2017-02-17 13:20:00
2017-04-13 13:20:00
2017-05-26 13:20:00
2017-07-03 12:05:00
2017-09-01 13:20:00
2017-11-22 13:20:00
2017-11-24 12:05:00
2017-12-22 12:05:00
2017-12-26 13:20:00
2017-12-29 13:20:00
2018-01-02 13:20:00
2018-01-12 13:20:00
2018-02-16 13:20:00
2018-03-29 13:20:00
2018-05-25 13:20:00
2018-07-03 12:05:00
2018-08-31 13:20:00
2018-11-21 13:20:00
2018-11-23 12:05:00
2018-12-24 12:05:00
2018-12-26 13:20:00
2018-12-31 13:20:00
2019-01-02 13:20:00
2019-01-18 13:20:00
2019-02-15 13:20:00
2019-04-18 13:20:00
2019-05-24 13:20:00
2019-07-03 12:05:00
2019-08-30 13:20:00
2019-11-27 13:20:00
2019-11-29 12:05:00
2019-12-24 12:05:00
2019-12-26 13:20:00
2019-12-31 13:20:00
2020-01-02 13:20:00
2020-01-17 13:20:00
2020-02-14 13:20:00
2020-04-09 13:20:00
2020-05-22 13:20:00
2020-07-02 12:05:00
2020-09-04 13:20:00
2020-11-25 13:20:00
2020-11-27 12:05:00
2020-12-24 12:05:00
2020-12-28 13:20:00
2020-12-31 13:20:00
2021-01-04 13:20:00

Late Opens

The following table shows the late opens for the KC HRW Wheat Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2013-01-21 19:00:00
2013-02-22 19:00:00
2013-05-27 19:00:00
2013-07-05 08:30:00
2013-09-02 19:00:00
2013-11-29 08:30:00
2014-01-02 08:30:00
2014-01-20 19:00:00
2014-02-17 19:00:00
2014-04-20 19:00:00
2014-05-26 19:00:00
2014-07-07 08:30:00
2014-09-01 19:00:00
2014-11-28 08:30:00
2014-12-26 08:30:00
2015-01-02 08:30:00
2015-01-19 19:00:00
2015-02-16 19:00:00
2015-04-05 19:00:00
2015-05-25 19:00:00
2015-07-05 19:00:00
2015-07-06 08:30:00
2015-09-07 19:00:00
2015-11-27 08:30:00
2015-12-27 19:00:00
2015-12-28 08:30:00
2016-01-03 19:00:00
2016-01-04 08:30:00
2016-01-18 19:00:00
2016-02-15 19:00:00
2016-03-27 19:00:00
2016-05-30 19:00:00
2016-07-05 08:30:00
2016-09-05 19:00:00
2016-11-25 08:30:00
2016-12-26 19:00:00
2016-12-27 08:30:00
2017-01-02 19:00:00
2017-01-03 08:30:00
2017-01-16 19:00:00
2017-02-20 19:00:00
2017-04-16 19:00:00
2017-05-29 19:00:00
2017-07-05 08:30:00
2017-09-04 19:00:00
2017-11-24 08:30:00
2017-12-26 08:30:00
2018-01-02 08:30:00
2018-01-15 19:00:00
2018-02-19 19:00:00
2018-02-20 08:30:00
2018-04-01 19:00:00
2018-05-28 19:00:00
2018-05-29 08:30:00
2018-07-05 08:30:00
2018-09-03 19:00:00
2018-11-23 08:30:00
2018-12-26 08:30:00
2019-01-02 08:30:00
2019-01-21 19:00:00
2019-01-22 08:30:00
2019-02-18 19:00:00
2019-02-19 08:30:00
2019-04-21 19:00:00
2019-05-27 19:00:00
2019-05-28 08:30:00
2019-07-05 08:30:00
2019-09-02 19:00:00
2019-09-03 08:30:00
2019-11-29 08:30:00
2019-12-26 08:30:00
2020-01-02 08:30:00
2020-01-20 19:00:00
2020-01-21 08:30:00
2020-02-17 19:00:00
2020-02-18 08:30:00
2020-04-12 19:00:00
2020-05-25 19:00:00
2020-05-26 08:30:00
2020-07-05 19:00:00
2020-07-06 08:30:00
2020-09-07 19:00:00
2020-09-08 08:30:00
2020-11-27 08:30:00
2020-12-27 19:00:00
2020-12-28 08:30:00
2021-01-03 19:00:00
2021-01-04 08:30:00

Time Zone

The KC HRW Wheat Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.11 MYM

Introduction

This page shows the trading hours, holidays, and time zone of the Micro E-mini Dow Jones Industrial Average Index Futures (MYM) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro E-mini Dow Jones Industrial Average Index Futures contract in the CBOT Future market trades in the America/New York time zone.

 

3.7.7.3.1.12 TN

Introduction

This page shows the trading hours, holidays, and time zone of the Ultra 10-Year U.S. Treasury Note Futures (TN) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2016-03-25 2016-12-26 2017-01-02 2017-04-14 2017-12-25
2018-01-01 2018-03-30 2018-12-25 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-04-13 2020-12-25
2021-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Ultra 10-Year U.S. Treasury Note Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.13 UB

Introduction

This page shows the trading hours, holidays, and time zone of the Ultra U.S. Treasury Bond Futures (UB) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Ultra U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Ultra U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Ultra U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Ultra U.S. Treasury Bond Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2010-12-24 2011-04-22 2011-12-26 2012-01-02 2012-12-25
2013-01-01 2013-03-29 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2022-12-25
2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Ultra U.S. Treasury Bond Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-24 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Ultra U.S. Treasury Bond Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.14 YM

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Dow ($5) Futures (YM) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Dow ($5) Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Dow ($5) Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Dow ($5) Futures contract in the CBOT Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Dow ($5) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the E-mini Dow ($5) Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Dow ($5) Futures contract in the CBOT Future market trades in the America/New York time zone.

 

3.7.7.3.1.15 ZB

Introduction

This page shows the trading hours, holidays, and time zone of the U.S. Treasury Bond Futures (ZB) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the U.S. Treasury Bond Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the U.S. Treasury Bond Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The U.S. Treasury Bond Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.16 ZC

Introduction

This page shows the trading hours, holidays, and time zone of the Corn Futures (ZC) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Corn Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Corn Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Corn Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Corn Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Corn Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.17 ZF

Introduction

This page shows the trading hours, holidays, and time zone of the 5-Year T-Note Futures (ZF) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the 5-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 5-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the 5-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 5-Year T-Note Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The 5-Year T-Note Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.18 ZL

Introduction

This page shows the trading hours, holidays, and time zone of the Soybean Oil Futures (ZL) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Soybean Oil Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Soybean Oil Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Soybean Oil Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Soybean Oil Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Soybean Oil Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.19 ZM

Introduction

This page shows the trading hours, holidays, and time zone of the Soybean Meal Futures (ZM) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Soybean Meal Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Soybean Meal Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Soybean Meal Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Soybean Meal Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Soybean Meal Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.20 ZN

Introduction

This page shows the trading hours, holidays, and time zone of the 10-Year T-Note Futures (ZN) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the 10-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 10-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the 10-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 10-Year T-Note Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The 10-Year T-Note Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.21 ZO

Introduction

This page shows the trading hours, holidays, and time zone of the Oats Futures (ZO) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Oats Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Oats Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Oats Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Oats Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Oats Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.22 ZS

Introduction

This page shows the trading hours, holidays, and time zone of the Soybean Futures (ZS) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Soybean Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Soybean Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Soybean Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Soybean Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Soybean Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.23 ZT

Introduction

This page shows the trading hours, holidays, and time zone of the 2-Year T-Note Futures (ZT) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the 2-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 2-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the 2-Year T-Note Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 2-Year T-Note Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The 2-Year T-Note Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.1.24 ZW

Introduction

This page shows the trading hours, holidays, and time zone of the Chicago SRW Wheat Futures (ZW) contract in the CBOT Future market.

Pre Market Hours

The following table shows the pre-market hours for the Chicago SRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00
Tuesday 00:00:00 to 07:45:00
Wednesday 00:00:00 to 07:45:00
Thursday 00:00:00 to 07:45:00
Friday 00:00:00 to 07:45:00

Regular Trading Hours

The following table shows the regular trading hours for the Chicago SRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:20:00
Tuesday 08:30:00 to 13:20:00
Wednesday 08:30:00 to 13:20:00
Thursday 08:30:00 to 13:20:00
Friday 08:30:00 to 13:20:00

Post Market Hours

The following table shows the post-market hours for the Chicago SRW Wheat Futures contract in the CBOT Future market:

Weekday Time (America/Chicago)
Monday 19:00:00 to 24:00:00
Tuesday 19:00:00 to 24:00:00
Wednesday 19:00:00 to 24:00:00
Thursday 19:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Chicago SRW Wheat Futures contract in the CBOT Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Chicago SRW Wheat Futures contract in the CBOT Future market trades in the America/Chicago time zone.

 

3.7.7.3.2 CFE

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the CFE Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the CFE Future market:

Weekday Time (America/Chicago)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 24:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the CFE Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The CFE Future market trades in the America/Chicago time zone.

Supported Assets

The following table shows the available contracts in the CFE Future market. Some of these contracts may have different trading periods than the overall CFE Future market.

Symbol Contract
VX VIX futures

 

3.7.7.3.2.1 VX

Introduction

This page shows the trading hours, holidays, and time zone of the VIX futures (VX) contract in the CFE Future market.

Pre Market Hours

The following table shows the pre-market hours for the VIX futures contract in the CFE Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the VIX futures contract in the CFE Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:00:00
Tuesday 08:30:00 to 15:00:00
Wednesday 08:30:00 to 15:00:00
Thursday 08:30:00 to 15:00:00
Friday 08:30:00 to 15:00:00

Post Market Hours

The following table shows the post-market hours for the VIX futures contract in the CFE Future market:

Weekday Time (America/Chicago)
Monday 15:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 15:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 15:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 15:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 15:00:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the VIX futures contract in the CFE Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The VIX futures contract in the CFE Future market trades in the America/Chicago time zone.

 

3.7.7.3.3 CME

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the CME Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the CME Future market:

Weekday Time (America/Chicago)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the CME Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The CME Future market trades in the America/Chicago time zone.

Supported Assets

The following table shows the available contracts in the CME Future market. Some of these contracts may have different trading periods than the overall CME Future market.

Symbol Contract
6A Australian Dollar Futures
6B British Pound Futures
6C Canadian Dollar Futures
6E Euro FX Futures
6J Japanese Yen Futures
6L Brazilian Real Futures
6M Mexican Peso Futures
6N New Zealand Dollar Futures
6R Russian Ruble Futures
6S Swiss Franc Futures
6Z South African Rand Futures
ACD Australian Dollar/Canadian Dollar Futures
AJY Australian Dollar/Japanese Yen Futures
ANE Australian Dollar/New Zealand Dollar Futures
BIO E-mini Nasdaq-100 Biotechnology Index Futures
BTC Bitcoin Futures
CB Cash-settled Butter Futures
CJY Canadian Dollar/Japanese Yen Futures
CNH Standard-Size USD/Offshore RMB (CNH) Futures
CSC Cash-Settled Cheese Futures
DC Class III Milk Futures
DY Dry Whey Futures
E7 E-mini Euro FX Futures
EAD Euro/Australian Dollar Futures
ECD Euro/Canadian Dollar Futures
EI E-mini FTSE Emerging Index Futures
EMD E-mini S&P MidCap 400 Futures
ES E-mini S&P 500 Futures
ESK Euro/Swedish Krona Futures
ETH Ether Futures
GD S&P-GSCI Commodity Index Futures
GDK Class IV Milk Futures
GE Eurodollar Futures
GF Feeder Cattle Futures
GNF Nonfat Dry Milk Futures
HE Lean Hog Futures
IBV USD-Denominated Ibovespa Index Futures
J7 E-mini Japanese Yen Futures
LBS Random Length Lumber Futures
LE Live Cattle Futures
M2K Micro E-mini Russell 2000 Index Futures
M6A Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures
M6B Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures
M6C Micro USD/CAD Futures
M6E Micro Euro/U.S. Dollar (EUR/USD) Futures
M6J Micro USD/JPY Futures
M6S Micro USD/CHF Futures
MBT Micro Bitcoin Futures
MCD Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures
MES Micro E-mini Standard and Poor's 500 Stock Price Index Futures
MET Micro Ether Futures
MIR Micro INR/USD Futures
MJY Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures
MNH Micro USD/CNH Futures
MNQ Micro E-mini Nasdaq-100 Index Futures
MSF Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures
NKD Nikkei/USD Futures
NQ E-mini Nasdaq-100 Futures
RTY E-mini Russell 2000 Index Futures

 

3.7.7.3.3.1 6A

Introduction

This page shows the trading hours, holidays, and time zone of the Australian Dollar Futures (6A) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Australian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Australian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Australian Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.2 6B

Introduction

This page shows the trading hours, holidays, and time zone of the British Pound Futures (6B) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the British Pound Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the British Pound Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the British Pound Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the British Pound Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the British Pound Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The British Pound Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.3 6C

Introduction

This page shows the trading hours, holidays, and time zone of the Canadian Dollar Futures (6C) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Canadian Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.4 6E

Introduction

This page shows the trading hours, holidays, and time zone of the Euro FX Futures (6E) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Euro FX Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Euro FX Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Euro FX Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.5 6J

Introduction

This page shows the trading hours, holidays, and time zone of the Japanese Yen Futures (6J) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Japanese Yen Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.6 6L

Introduction

This page shows the trading hours, holidays, and time zone of the Brazilian Real Futures (6L) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Brazilian Real Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Brazilian Real Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Brazilian Real Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Brazilian Real Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Brazilian Real Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Brazilian Real Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.7 6M

Introduction

This page shows the trading hours, holidays, and time zone of the Mexican Peso Futures (6M) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mexican Peso Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mexican Peso Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Mexican Peso Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mexican Peso Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mexican Peso Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Mexican Peso Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.8 6N

Introduction

This page shows the trading hours, holidays, and time zone of the New Zealand Dollar Futures (6N) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the New Zealand Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the New Zealand Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The New Zealand Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.9 6R

Introduction

This page shows the trading hours, holidays, and time zone of the Russian Ruble Futures (6R) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Russian Ruble Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Russian Ruble Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Russian Ruble Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Russian Ruble Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Russian Ruble Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Russian Ruble Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.10 6S

Introduction

This page shows the trading hours, holidays, and time zone of the Swiss Franc Futures (6S) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Swiss Franc Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Swiss Franc Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Swiss Franc Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Swiss Franc Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Swiss Franc Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Swiss Franc Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.11 6Z

Introduction

This page shows the trading hours, holidays, and time zone of the South African Rand Futures (6Z) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the South African Rand Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the South African Rand Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the South African Rand Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the South African Rand Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the South African Rand Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The South African Rand Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.12 ACD

Introduction

This page shows the trading hours, holidays, and time zone of the Australian Dollar/Canadian Dollar Futures (ACD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Australian Dollar/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Australian Dollar/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Australian Dollar/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Australian Dollar/Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Australian Dollar/Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Australian Dollar/Canadian Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.13 AJY

Introduction

This page shows the trading hours, holidays, and time zone of the Australian Dollar/Japanese Yen Futures (AJY) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Australian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Australian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Australian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Australian Dollar/Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Australian Dollar/Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Australian Dollar/Japanese Yen Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.14 ANE

Introduction

This page shows the trading hours, holidays, and time zone of the Australian Dollar/New Zealand Dollar Futures (ANE) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Australian Dollar/New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Australian Dollar/New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Australian Dollar/New Zealand Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Australian Dollar/New Zealand Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Australian Dollar/New Zealand Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Australian Dollar/New Zealand Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.15 BIO

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Nasdaq-100 Biotechnology Index Futures (BIO) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Nasdaq-100 Biotechnology Index Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.16 BTC

Introduction

This page shows the trading hours, holidays, and time zone of the Bitcoin Futures (BTC) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Bitcoin Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2017-12-25 2018-01-01 2018-03-30 2018-12-25 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Bitcoin Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 16:00:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Bitcoin Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.17 CB

Introduction

This page shows the trading hours, holidays, and time zone of the Cash-settled Butter Futures (CB) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Cash-settled Butter Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Cash-settled Butter Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Cash-settled Butter Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Cash-settled Butter Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Cash-settled Butter Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Cash-settled Butter Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.18 CJY

Introduction

This page shows the trading hours, holidays, and time zone of the Canadian Dollar/Japanese Yen Futures (CJY) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Canadian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Canadian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Canadian Dollar/Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Canadian Dollar/Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Canadian Dollar/Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Canadian Dollar/Japanese Yen Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.19 CNH

Introduction

This page shows the trading hours, holidays, and time zone of the Standard-Size USD/Offshore RMB (CNH) Futures (CNH) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Standard-Size USD/Offshore RMB (CNH) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.20 CSC

Introduction

This page shows the trading hours, holidays, and time zone of the Cash-Settled Cheese Futures (CSC) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Cash-Settled Cheese Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Cash-Settled Cheese Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Cash-Settled Cheese Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Cash-Settled Cheese Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Cash-Settled Cheese Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Cash-Settled Cheese Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.21 DC

Introduction

This page shows the trading hours, holidays, and time zone of the Class III Milk Futures (DC) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Class III Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Class III Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Class III Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Class III Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Class III Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Class III Milk Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.22 DY

Introduction

This page shows the trading hours, holidays, and time zone of the Dry Whey Futures (DY) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Dry Whey Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Dry Whey Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 13:55:00

Post Market Hours

The following table shows the post-market hours for the Dry Whey Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Dry Whey Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Dry Whey Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Dry Whey Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.23 E7

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Euro FX Futures (E7) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Euro FX Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Euro FX Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the E-mini Euro FX Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Euro FX Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.24 EAD

Introduction

This page shows the trading hours, holidays, and time zone of the Euro/Australian Dollar Futures (EAD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Euro/Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Euro/Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Euro/Australian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Euro/Australian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Euro/Australian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Euro/Australian Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.25 ECD

Introduction

This page shows the trading hours, holidays, and time zone of the Euro/Canadian Dollar Futures (ECD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Euro/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Euro/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Euro/Canadian Dollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Euro/Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Euro/Canadian Dollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Euro/Canadian Dollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.26 EI

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini FTSE Emerging Index Futures (EI) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini FTSE Emerging Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini FTSE Emerging Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini FTSE Emerging Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini FTSE Emerging Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini FTSE Emerging Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini FTSE Emerging Index Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.27 EMD

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini S&P MidCap 400 Futures (EMD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini S&P MidCap 400 Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini S&P MidCap 400 Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini S&P MidCap 400 Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini S&P MidCap 400 Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini S&P MidCap 400 Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini S&P MidCap 400 Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.28 ES

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini S&P 500 Futures (ES) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini S&P 500 Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini S&P 500 Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini S&P 500 Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini S&P 500 Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini S&P 500 Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini S&P 500 Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.29 ESK

Introduction

This page shows the trading hours, holidays, and time zone of the Euro/Swedish Krona Futures (ESK) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Euro/Swedish Krona Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Euro/Swedish Krona Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Euro/Swedish Krona Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Euro/Swedish Krona Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Euro/Swedish Krona Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Euro/Swedish Krona Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.30 ETH

Introduction

This page shows the trading hours, holidays, and time zone of the Ether Futures (ETH) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Ether Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Ether Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Ether Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.31 GD

Introduction

This page shows the trading hours, holidays, and time zone of the S&P-GSCI Commodity Index Futures (GD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the S&P-GSCI Commodity Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the S&P-GSCI Commodity Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the S&P-GSCI Commodity Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the S&P-GSCI Commodity Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the S&P-GSCI Commodity Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The S&P-GSCI Commodity Index Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.32 GDK

Introduction

This page shows the trading hours, holidays, and time zone of the Class IV Milk Futures (GDK) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Class IV Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Class IV Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Class IV Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Class IV Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Class IV Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Class IV Milk Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.33 GE

Introduction

This page shows the trading hours, holidays, and time zone of the Eurodollar Futures (GE) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Eurodollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Eurodollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Eurodollar Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Eurodollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-04-13 2020-12-25 2021-01-01 2021-12-24
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Eurodollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2008-12-31 15:15:00
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-03 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:15:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:00:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-10-05 15:15:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-04-03 10:15:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 08:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

The following table shows the late opens for the Eurodollar Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2009-01-02 05:00:00
2011-12-27 05:00:00
2012-01-03 05:00:00
2012-12-26 05:00:00
2013-01-02 05:00:00
2013-12-26 05:00:00
2014-01-02 05:00:00

Time Zone

The Eurodollar Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.34 GF

Introduction

This page shows the trading hours, holidays, and time zone of the Feeder Cattle Futures (GF) contract in the CME Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Feeder Cattle Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:05:00
Tuesday 08:30:00 to 13:05:00
Wednesday 08:30:00 to 13:05:00
Thursday 08:30:00 to 13:05:00
Friday 08:30:00 to 13:05:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Feeder Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2009-12-27
2010-01-01 2010-01-03 2010-01-17 2010-02-14 2010-04-02
2010-05-30 2010-07-04 2010-09-05 2010-10-10 2010-11-24
2010-12-24 2010-12-26 2011-01-02 2011-01-16 2011-02-20
2011-04-22 2011-04-24 2011-05-29 2011-05-30 2011-07-03
2011-07-04 2011-09-04 2011-09-05 2011-10-09 2011-11-23
2011-12-26 2012-01-02 2012-01-15 2012-01-16 2012-02-19
2012-02-20 2012-04-08 2012-05-27 2012-05-28 2012-07-03
2012-07-04 2012-09-02 2012-09-03 2012-10-07 2012-11-21
2012-12-25 2013-01-01 2013-01-20 2013-01-21 2013-02-17
2013-02-18 2013-03-31 2013-05-26 2013-05-27 2013-07-04
2013-09-01 2013-09-02 2013-11-28 2013-12-25 2014-01-01
2014-02-16 2014-02-17 2014-04-18 2014-04-20 2014-07-04
2014-12-25 2015-01-01 2015-04-03 2015-07-03 2015-12-25
2016-01-01 2016-03-25 2016-12-26 2017-01-02 2017-01-15
2017-01-16 2017-02-19 2017-02-20 2017-04-14 2017-05-28
2017-05-29 2017-07-04 2017-09-03 2017-09-04 2017-11-22
2017-11-23 2017-12-25 2018-01-01 2018-01-14 2018-01-15
2018-02-18 2018-02-19 2018-03-30 2018-05-27 2018-05-28
2018-07-04 2018-09-02 2018-09-03 2018-11-21 2018-11-22
2018-12-25 2019-01-01 2019-01-20 2019-01-21 2019-02-17
2019-02-18 2019-04-19 2019-05-26 2019-05-27 2019-07-04
2019-09-01 2019-09-02 2019-11-27 2019-11-28 2019-12-25
2020-01-01 2020-01-19 2020-01-20 2020-02-16 2020-02-17
2020-04-10 2020-05-24 2020-05-25 2020-07-03 2020-09-06
2020-09-07 2020-11-25 2020-11-26 2020-12-25 2020-12-27
2021-01-01 2021-01-17 2021-01-18 2021-02-14 2021-02-15
2021-04-02 2021-05-30 2021-05-31 2021-07-04 2021-07-05
2021-09-05 2021-09-06 2021-11-24 2021-11-25 2021-12-24
2021-12-25 2022-01-16 2022-01-17 2022-02-20 2022-02-21
2022-04-15 2022-05-29 2022-05-30 2022-06-19 2022-06-20
2022-07-03 2022-07-04 2022-09-04 2022-09-05 2022-11-23
2022-11-24 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Feeder Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2010-11-26 12:00:00
2010-12-31 12:15:00
2011-04-21 13:55:00
2011-11-25 12:15:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-07-03 12:15:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-04-17 13:55:00
2014-07-03 12:15:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-04-02 13:55:00
2015-07-02 12:15:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2015-12-31 13:55:00
2016-11-25 12:15:00
2016-12-23 12:15:00
2017-07-03 12:15:00
2017-11-24 12:15:00
2017-12-22 12:15:00
2018-07-03 12:15:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-07-03 12:15:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-07-02 12:15:00
2020-11-27 12:05:00
2020-12-24 12:05:00
2021-11-26 12:05:00
2022-11-25 12:05:00

Late Opens

The following table shows the late opens for the Feeder Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2011-11-24 17:00:00
2011-12-27 09:05:00
2012-01-03 09:05:00
2012-01-17 09:05:00
2012-02-21 09:05:00
2012-05-29 09:05:00
2012-07-05 09:05:00
2012-09-04 09:05:00
2012-11-22 17:00:00
2012-12-26 09:05:00
2013-01-02 09:05:00
2013-01-22 09:05:00
2013-02-19 09:05:00
2013-05-28 09:05:00
2013-07-05 09:05:00
2013-09-03 09:05:00
2013-11-29 09:05:00
2013-12-26 09:05:00
2014-01-02 09:05:00
2014-01-21 09:05:00
2014-02-18 09:05:00
2014-04-21 09:05:00
2014-05-27 09:05:00
2014-07-07 09:05:00
2014-09-02 09:05:00
2015-01-20 09:05:00
2015-02-17 09:05:00
2015-04-06 09:05:00
2015-05-26 09:05:00
2015-07-06 09:05:00
2015-09-08 09:05:00
2015-12-28 09:05:00
2016-01-04 09:05:00
2016-01-19 09:05:00
2016-02-16 09:05:00

Time Zone

The Feeder Cattle Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.35 GNF

Introduction

This page shows the trading hours, holidays, and time zone of the Nonfat Dry Milk Futures (GNF) contract in the CME Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Nonfat Dry Milk Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 13:55:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Nonfat Dry Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2010-01-01
2010-01-17 2010-02-14 2010-04-02 2010-05-30 2010-07-04
2010-09-05 2010-11-24 2010-11-25 2010-11-26 2010-12-24
2011-01-01 2011-01-16 2011-02-20 2011-04-22 2011-05-29
2011-07-03 2011-09-04 2011-11-23 2011-11-24 2011-11-25
2011-12-26 2012-01-15 2012-02-19 2012-04-06 2012-05-27
2012-07-03 2012-09-02 2012-11-21 2012-11-22 2012-11-23
2012-12-15 2013-01-02 2013-01-20 2013-02-17 2013-03-29
2013-05-26 2013-09-01 2013-11-28 2013-11-29 2014-01-01
2014-01-19 2014-02-16 2014-04-18 2014-05-25 2014-07-04
2014-08-31 2014-11-27 2014-11-28 2014-12-25 2015-01-01
2015-01-18 2015-02-15 2015-04-03 2015-05-24 2015-07-03
2015-09-06 2015-11-26 2015-11-27 2015-12-25 2016-01-01
2016-01-17 2016-02-14 2016-03-25 2016-05-29 2016-07-03
2016-09-04 2016-11-24 2016-11-25 2016-12-26 2017-01-02
2017-01-15 2017-02-19 2017-04-14 2017-05-28 2017-07-04
2017-09-03 2017-11-23 2017-11-24 2017-12-25 2018-01-01
2018-01-14 2018-02-18 2018-03-30 2018-05-27 2018-07-04
2018-09-02 2018-11-22 2018-11-23 2018-12-25 2019-01-01
2019-01-20 2019-02-17 2019-04-19 2019-05-26 2019-07-04
2019-09-01 2019-11-28 2019-11-29 2019-12-25 2020-01-01
2020-04-10 2020-07-03 2020-11-25 2020-11-26 2020-11-27
2020-12-25 2021-01-01 2021-04-02 2021-11-24 2021-11-25
2021-11-26 2021-12-24 2022-04-15 2022-11-23 2022-11-24
2022-11-25 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Nonfat Dry Milk Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2011-04-21 13:55:00
2011-12-31 12:15:00
2012-12-24 12:00:00
2013-03-28 13:55:00
2013-07-03 12:00:00
2013-12-24 12:00:00
2014-04-17 13:55:00
2014-07-03 12:00:00
2014-12-24 12:00:00
2014-12-26 13:55:00
2015-01-02 13:55:00
2015-03-24 13:55:00
2015-04-02 13:55:00
2015-07-02 12:00:00
2015-12-24 12:00:00
2015-12-31 13:55:00
2016-12-23 12:00:00
2016-12-30 13:55:00
2017-04-13 13:55:00
2017-07-03 12:00:00
2017-12-22 12:00:00
2017-12-31 13:55:00
2018-03-29 13:55:00
2018-07-03 12:00:00
2018-12-24 12:00:00
2018-12-31 13:55:00
2019-04-18 13:55:00
2019-07-03 12:00:00
2019-12-24 12:00:00
2019-12-31 13:55:00
2020-04-09 13:55:00
2020-07-02 12:00:00
2020-12-24 12:00:00
2020-12-31 13:55:00
2021-04-01 13:55:00
2022-04-14 13:55:00

Late Opens

There are no days with late opens.

Time Zone

The Nonfat Dry Milk Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.36 HE

Introduction

This page shows the trading hours, holidays, and time zone of the Lean Hog Futures (HE) contract in the CME Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Lean Hog Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:05:00
Tuesday 08:30:00 to 13:05:00
Wednesday 08:30:00 to 13:05:00
Thursday 08:30:00 to 13:05:00
Friday 08:30:00 to 13:05:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Lean Hog Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2009-12-27
2010-01-01 2010-01-03 2010-01-17 2010-02-14 2010-04-02
2010-05-30 2010-07-04 2010-09-05 2010-10-10 2010-11-24
2010-12-24 2010-12-26 2011-01-02 2011-01-16 2011-02-20
2011-04-22 2011-04-24 2011-05-29 2011-05-30 2011-07-03
2011-07-04 2011-09-04 2011-09-05 2011-10-09 2011-11-23
2011-12-26 2012-01-02 2012-01-15 2012-01-16 2012-02-19
2012-02-20 2012-04-08 2012-05-27 2012-05-28 2012-07-03
2012-07-04 2012-09-02 2012-09-03 2012-10-07 2012-11-21
2012-12-25 2013-01-01 2013-01-20 2013-01-21 2013-02-17
2013-02-18 2013-03-31 2013-05-26 2013-05-27 2013-07-04
2013-09-01 2013-09-02 2013-11-28 2013-12-25 2014-01-01
2014-02-16 2014-02-17 2014-04-18 2014-04-20 2014-07-04
2014-12-25 2015-01-01 2015-04-03 2015-07-03 2015-12-25
2016-01-01 2016-03-25 2016-12-26 2017-01-02 2017-01-15
2017-01-16 2017-02-19 2017-02-20 2017-04-14 2017-05-28
2017-05-29 2017-07-04 2017-09-03 2017-09-04 2017-11-22
2017-11-23 2017-12-25 2018-01-01 2018-01-14 2018-01-15
2018-02-18 2018-02-19 2018-03-30 2018-05-27 2018-05-28
2018-07-04 2018-09-02 2018-09-03 2018-11-21 2018-11-22
2018-12-25 2019-01-01 2019-01-20 2019-01-21 2019-02-17
2019-02-18 2019-04-19 2019-05-26 2019-05-27 2019-07-04
2019-09-01 2019-09-02 2019-11-27 2019-11-28 2019-12-25
2020-01-01 2020-01-19 2020-01-20 2020-02-16 2020-02-17
2020-04-10 2020-05-24 2020-05-25 2020-07-03 2020-09-06
2020-09-07 2020-11-25 2020-11-26 2020-12-25 2020-12-27
2021-01-01 2021-01-17 2021-01-18 2021-02-14 2021-02-15
2021-04-02 2021-05-30 2021-05-31 2021-07-04 2021-07-05
2021-09-05 2021-09-06 2021-11-24 2021-11-25 2021-12-24
2021-12-25 2022-01-16 2022-01-17 2022-02-20 2022-02-21
2022-04-15 2022-05-29 2022-05-30 2022-06-19 2022-06-20
2022-07-03 2022-07-04 2022-09-04 2022-09-05 2022-11-23
2022-11-24 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Lean Hog Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2010-11-26 12:00:00
2010-12-31 12:15:00
2011-04-21 13:55:00
2011-11-25 12:15:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-07-03 12:15:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-04-17 13:55:00
2014-07-03 12:15:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-04-02 13:55:00
2015-07-02 12:15:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2015-12-31 13:55:00
2016-11-25 12:15:00
2016-12-23 12:15:00
2017-07-03 12:15:00
2017-11-24 12:15:00
2017-12-22 12:15:00
2018-07-03 12:15:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-07-03 12:15:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-07-02 12:15:00
2020-11-27 12:05:00
2020-12-24 12:05:00
2021-11-26 12:05:00
2022-11-25 12:05:00

Late Opens

The following table shows the late opens for the Lean Hog Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2011-11-24 17:00:00
2011-12-27 09:05:00
2012-01-03 09:05:00
2012-01-17 09:05:00
2012-02-21 09:05:00
2012-05-29 09:05:00
2012-07-05 09:05:00
2012-09-04 09:05:00
2012-11-22 17:00:00
2012-12-26 09:05:00
2013-01-02 09:05:00
2013-01-22 09:05:00
2013-02-19 09:05:00
2013-05-28 09:05:00
2013-07-05 09:05:00
2013-09-03 09:05:00
2013-11-29 09:05:00
2013-12-26 09:05:00
2014-01-02 09:05:00
2014-01-21 09:05:00
2014-02-18 09:05:00
2014-04-21 09:05:00
2014-05-27 09:05:00
2014-07-07 09:05:00
2014-09-02 09:05:00
2015-01-20 09:05:00
2015-02-17 09:05:00
2015-04-06 09:05:00
2015-05-26 09:05:00
2015-07-06 09:05:00
2015-09-08 09:05:00
2015-12-28 09:05:00
2016-01-04 09:05:00
2016-01-19 09:05:00
2016-02-16 09:05:00

Time Zone

The Lean Hog Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.37 IBV

Introduction

This page shows the trading hours, holidays, and time zone of the USD-Denominated Ibovespa Index Futures (IBV) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the USD-Denominated Ibovespa Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the USD-Denominated Ibovespa Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the USD-Denominated Ibovespa Index Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the USD-Denominated Ibovespa Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the USD-Denominated Ibovespa Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The USD-Denominated Ibovespa Index Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.38 J7

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Japanese Yen Futures (J7) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Japanese Yen Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the E-mini Japanese Yen Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Japanese Yen Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.39 LBS

Introduction

This page shows the trading hours, holidays, and time zone of the Random Length Lumber Futures (LBS) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Random Length Lumber Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 06:00:00 to 09:00:00
Tuesday 06:00:00 to 09:00:00
Wednesday 06:00:00 to 09:00:00
Thursday 06:00:00 to 09:00:00
Friday 06:00:00 to 09:00:00

Regular Trading Hours

The following table shows the regular trading hours for the Random Length Lumber Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 09:00:00 to 15:05:00
Tuesday 09:00:00 to 15:05:00
Wednesday 09:00:00 to 15:05:00
Thursday 09:00:00 to 15:05:00
Friday 09:00:00 to 15:05:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Random Length Lumber Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2013-01-01 2013-01-21 2013-02-18 2013-03-29 2013-05-27
2013-07-04 2013-09-02 2013-11-28 2013-12-25 2014-01-01
2014-01-20 2014-02-17 2014-04-18 2014-04-21 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-01 2017-01-02 2017-01-16
2017-02-20 2017-04-14 2017-05-29 2017-07-04 2017-09-04
2017-11-23 2017-12-25 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-25
2019-01-01 2019-01-21 2019-02-18 2019-04-19 2019-05-27
2019-07-04 2019-09-02 2019-11-28 2019-12-25 2020-01-01
2020-01-20 2020-02-17 2020-04-10 2020-05-25 2020-07-03
2020-09-07 2020-11-26 2020-12-25 2021-01-01 2021-01-17
2021-01-18 2021-02-14 2021-02-15 2021-04-02 2021-05-30
2021-05-31 2021-07-04 2021-07-05 2021-09-05 2021-09-06
2021-11-24 2021-11-25 2021-12-24 2021-12-26 2022-01-16
2022-01-17 2022-02-20 2022-02-21 2022-04-15 2022-05-29
2022-05-30 2022-06-19 2022-06-20 2022-07-03 2022-07-04
2022-09-04 2022-09-05 2022-11-23 2022-11-24 2022-12-25
2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Random Length Lumber Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2013-07-03 12:00:00
2013-11-29 12:00:00
2013-12-24 12:00:00
2014-07-03 12:00:00
2014-11-28 12:00:00
2014-12-24 12:00:00
2015-07-02 12:00:00
2015-11-27 12:00:00
2015-12-24 12:00:00
2016-11-27 12:00:00
2016-12-24 12:00:00
2017-07-03 12:00:00
2017-11-24 12:00:00
2017-12-24 12:00:00
2018-07-03 12:00:00
2018-11-23 12:00:00
2018-12-24 12:00:00
2019-07-03 12:00:00
2019-11-29 12:05:00
2019-12-24 12:05:00
2020-07-02 12:05:00
2020-11-26 12:05:00
2020-11-27 12:05:00
2020-12-24 12:05:00
2022-11-25 12:05:00

Late Opens

There are no days with late opens.

Time Zone

The Random Length Lumber Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.40 LE

Introduction

This page shows the trading hours, holidays, and time zone of the Live Cattle Futures (LE) contract in the CME Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Live Cattle Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 13:05:00
Tuesday 08:30:00 to 13:05:00
Wednesday 08:30:00 to 13:05:00
Thursday 08:30:00 to 13:05:00
Friday 08:30:00 to 13:05:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Live Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-01-18 2009-02-15 2009-04-10 2009-05-24 2009-07-02
2009-09-06 2009-10-11 2009-11-25 2009-12-25 2009-12-27
2010-01-01 2010-01-03 2010-01-17 2010-02-14 2010-04-02
2010-05-30 2010-07-04 2010-09-05 2010-10-10 2010-11-24
2010-12-24 2010-12-26 2011-01-02 2011-01-16 2011-02-20
2011-04-22 2011-04-24 2011-05-29 2011-05-30 2011-07-03
2011-07-04 2011-09-04 2011-09-05 2011-10-09 2011-11-23
2011-12-26 2012-01-02 2012-01-15 2012-01-16 2012-02-19
2012-02-20 2012-04-08 2012-05-27 2012-05-28 2012-07-03
2012-07-04 2012-09-02 2012-09-03 2012-10-07 2012-11-21
2012-12-25 2013-01-01 2013-01-20 2013-01-21 2013-02-17
2013-02-18 2013-03-31 2013-05-26 2013-05-27 2013-07-04
2013-09-01 2013-09-02 2013-11-28 2013-12-25 2014-01-01
2014-02-16 2014-02-17 2014-04-18 2014-04-20 2014-07-04
2014-12-25 2015-01-01 2015-04-03 2015-07-03 2015-12-25
2016-01-01 2016-03-25 2016-12-26 2017-01-02 2017-01-15
2017-01-16 2017-02-19 2017-02-20 2017-04-14 2017-05-28
2017-05-29 2017-07-04 2017-09-03 2017-09-04 2017-11-22
2017-11-23 2017-12-25 2018-01-01 2018-01-14 2018-01-15
2018-02-18 2018-02-19 2018-03-30 2018-05-27 2018-05-28
2018-07-04 2018-09-02 2018-09-03 2018-11-21 2018-11-22
2018-12-25 2019-01-01 2019-01-20 2019-01-21 2019-02-17
2019-02-18 2019-04-19 2019-05-26 2019-05-27 2019-07-04
2019-09-01 2019-09-02 2019-11-27 2019-11-28 2019-12-25
2020-01-01 2020-01-19 2020-01-20 2020-02-16 2020-02-17
2020-04-10 2020-05-24 2020-05-25 2020-07-03 2020-09-06
2020-09-07 2020-11-25 2020-11-26 2020-12-25 2020-12-27
2021-01-01 2021-01-17 2021-01-18 2021-02-14 2021-02-15
2021-04-02 2021-05-30 2021-05-31 2021-07-04 2021-07-05
2021-09-05 2021-09-06 2021-11-24 2021-11-25 2021-12-24
2021-12-25 2022-01-16 2022-01-17 2022-02-20 2022-02-21
2022-04-15 2022-05-29 2022-05-30 2022-06-19 2022-06-20
2022-07-03 2022-07-04 2022-09-04 2022-09-05 2022-11-23
2022-11-24 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Live Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-11-27 12:00:00
2009-12-24 12:00:00
2010-11-26 12:00:00
2010-12-31 12:15:00
2011-04-21 13:55:00
2011-11-25 12:15:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-07-03 12:15:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-04-17 13:55:00
2014-07-03 12:15:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-04-02 13:55:00
2015-07-02 12:15:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2015-12-31 13:55:00
2016-11-25 12:15:00
2016-12-23 12:15:00
2017-07-03 12:15:00
2017-11-24 12:15:00
2017-12-22 12:15:00
2018-07-03 12:15:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-07-03 12:15:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-07-02 12:15:00
2020-11-27 12:05:00
2020-12-24 12:05:00
2021-11-26 12:05:00
2022-11-25 12:05:00

Late Opens

The following table shows the late opens for the Live Cattle Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/Chicago)
2011-11-24 17:00:00
2011-12-27 09:05:00
2012-01-03 09:05:00
2012-01-17 09:05:00
2012-02-21 09:05:00
2012-05-29 09:05:00
2012-07-05 09:05:00
2012-09-04 09:05:00
2012-11-22 17:00:00
2012-12-26 09:05:00
2013-01-02 09:05:00
2013-01-22 09:05:00
2013-02-19 09:05:00
2013-05-28 09:05:00
2013-07-05 09:05:00
2013-09-03 09:05:00
2013-11-29 09:05:00
2013-12-26 09:05:00
2014-01-02 09:05:00
2014-01-21 09:05:00
2014-02-18 09:05:00
2014-04-21 09:05:00
2014-05-27 09:05:00
2014-07-07 09:05:00
2014-09-02 09:05:00
2015-01-20 09:05:00
2015-02-17 09:05:00
2015-04-06 09:05:00
2015-05-26 09:05:00
2015-07-06 09:05:00
2015-09-08 09:05:00
2015-12-28 09:05:00
2016-01-04 09:05:00
2016-01-19 09:05:00
2016-02-16 09:05:00

Time Zone

The Live Cattle Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.41 M2K

Introduction

This page shows the trading hours, holidays, and time zone of the Micro E-mini Russell 2000 Index Futures (M2K) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro E-mini Russell 2000 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro E-mini Russell 2000 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro E-mini Russell 2000 Index Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.42 M6A

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures (M6A) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.43 M6B

Introduction

This page shows the trading hours, holidays, and time zone of the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures (M6B) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.44 M6C

Introduction

This page shows the trading hours, holidays, and time zone of the Micro USD/CAD Futures (M6C) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro USD/CAD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro USD/CAD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro USD/CAD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro USD/CAD Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro USD/CAD Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro USD/CAD Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.45 M6E

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Euro/U.S. Dollar (EUR/USD) Futures (M6E) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Euro/U.S. Dollar (EUR/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.46 M6J

Introduction

This page shows the trading hours, holidays, and time zone of the Micro USD/JPY Futures (M6J) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro USD/JPY Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro USD/JPY Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro USD/JPY Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro USD/JPY Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro USD/JPY Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro USD/JPY Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.47 M6S

Introduction

This page shows the trading hours, holidays, and time zone of the Micro USD/CHF Futures (M6S) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro USD/CHF Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro USD/CHF Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro USD/CHF Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro USD/CHF Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro USD/CHF Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro USD/CHF Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.48 MBT

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Bitcoin Futures (MBT) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Bitcoin Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Bitcoin Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Bitcoin Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Bitcoin Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.49 MCD

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures (MCD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.50 MES

Introduction

This page shows the trading hours, holidays, and time zone of the Micro E-mini Standard and Poor's 500 Stock Price Index Futures (MES) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro E-mini Standard and Poor's 500 Stock Price Index Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.51 MET

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Ether Futures (MET) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Ether Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Ether Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Ether Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Ether Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.52 MIR

Introduction

This page shows the trading hours, holidays, and time zone of the Micro INR/USD Futures (MIR) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro INR/USD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro INR/USD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro INR/USD Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro INR/USD Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro INR/USD Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro INR/USD Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.53 MJY

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures (MJY) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.54 MNH

Introduction

This page shows the trading hours, holidays, and time zone of the Micro USD/CNH Futures (MNH) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro USD/CNH Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro USD/CNH Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro USD/CNH Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro USD/CNH Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro USD/CNH Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro USD/CNH Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.55 MNQ

Introduction

This page shows the trading hours, holidays, and time zone of the Micro E-mini Nasdaq-100 Index Futures (MNQ) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro E-mini Nasdaq-100 Index Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.56 MRB

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures (MSF) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-04-03 2015-12-25 2016-01-01 2016-03-25 2016-12-26
2017-01-02 2017-04-14 2017-12-25 2018-01-01 2018-03-30
2018-12-25 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-12-24 2022-04-15
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/Chicago)
2009-01-16 15:15:00
2009-01-19 12:00:00
2009-02-13 15:15:00
2009-02-16 12:00:00
2009-04-09 15:15:00
2009-05-22 15:15:00
2009-05-25 12:00:00
2009-07-02 12:00:00
2009-09-04 15:15:00
2009-09-07 12:00:00
2009-10-09 15:00:00
2009-11-26 12:00:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-15 15:15:00
2010-01-18 12:00:00
2010-02-12 15:15:00
2010-02-15 12:00:00
2010-04-02 10:15:00
2010-05-28 15:15:00
2010-05-31 12:00:00
2010-07-02 15:15:00
2010-07-05 12:00:00
2010-09-03 15:15:00
2010-09-06 12:12:00
2010-10-08 15:15:00
2010-11-25 12:00:00
2010-11-26 12:15:00
2010-12-31 12:15:00
2011-01-14 15:15:00
2011-01-17 12:00:00
2011-02-18 15:15:00
2011-02-21 12:00:00
2011-05-27 15:15:00
2011-05-30 12:00:00
2011-07-01 15:15:00
2011-07-04 12:00:00
2011-09-02 15:15:00
2011-09-05 12:00:00
2011-10-07 15:15:00
2011-11-24 12:00:00
2011-11-25 12:15:00
2012-01-13 15:15:00
2012-01-16 12:00:00
2012-02-17 15:15:00
2012-02-20 12:00:00
2012-04-06 10:15:00
2012-05-25 15:15:00
2012-05-28 12:00:00
2012-07-04 12:00:00
2012-08-31 15:15:00
2012-09-03 12:00:00
2012-11-22 12:00:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-18 15:15:00
2013-01-21 12:00:00
2013-02-15 15:15:00
2013-02-18 12:00:00
2013-05-24 15:15:00
2013-05-27 12:00:00
2013-07-04 12:00:00
2013-08-30 15:15:00
2013-09-02 12:00:00
2013-11-28 12:00:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2014-01-17 15:15:00
2014-01-20 12:00:00
2014-02-14 15:15:00
2014-02-17 12:00:00
2014-05-23 15:15:00
2014-05-26 12:00:00
2014-07-04 12:00:00
2014-08-29 15:15:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-16 15:15:00
2015-01-19 12:00:00
2015-02-13 15:15:00
2015-02-16 12:00:00
2015-05-22 15:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-17 16:00:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 10:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-02-21 16:00:00
2022-05-30 16:00:00
2022-06-20 16:00:00
2022-07-04 16:00:00
2022-09-05 12:00:00
2022-11-24 16:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures contract in the CME Future market trades in the America/Chicago time zone.

 

3.7.7.3.3.57 MSF

Introduction

This page shows the trading hours, holidays, and time zone of the Nikkei/USD Futures (NKD) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the Nikkei/USD Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Nikkei/USD Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Nikkei/USD Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Nikkei/USD Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Nikkei/USD Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The Nikkei/USD Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.58 NKD

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Nasdaq-100 Futures (NQ) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Nasdaq-100 Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Nasdaq-100 Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Nasdaq-100 Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Nasdaq-100 Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini Nasdaq-100 Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Nasdaq-100 Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.59 NQ

Introduction

This page shows the trading hours, holidays, and time zone of the E-mini Russell 2000 Index Futures (RTY) contract in the CME Future market.

Pre Market Hours

The following table shows the pre-market hours for the E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the E-mini Russell 2000 Index Futures contract in the CME Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the E-mini Russell 2000 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-24
2011-01-01 2011-04-22 2011-12-26 2012-04-06 2012-12-25
2013-01-02 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-01
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-12-24
2022-01-01 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the E-mini Russell 2000 Index Futures contract in the CME Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 10:30:00
2009-02-16 10:30:00
2009-05-25 10:30:00
2009-07-03 10:30:00
2009-09-07 10:30:00
2009-11-26 10:30:00
2009-11-27 12:15:00
2009-12-24 12:15:00
2010-01-18 10:30:00
2010-02-15 10:30:00
2010-05-31 10:30:00
2010-07-05 10:30:00
2010-09-06 10:30:00
2010-11-25 10:30:00
2010-11-26 12:15:00
2011-01-17 10:30:00
2011-02-21 10:30:00
2011-05-30 10:30:00
2011-07-04 10:30:00
2011-09-05 10:30:00
2011-11-24 10:30:00
2011-11-25 12:15:00
2012-01-16 10:30:00
2012-02-20 10:30:00
2012-05-28 10:30:00
2012-07-03 12:15:00
2012-07-04 10:30:00
2012-09-03 10:30:00
2012-11-22 10:30:00
2012-11-23 12:15:00
2012-12-24 12:15:00
2013-01-21 10:30:00
2013-02-18 10:30:00
2013-05-27 10:30:00
2013-07-03 12:15:00
2013-07-04 10:30:00
2013-07-05 15:15:00
2013-09-02 10:30:00
2013-11-28 10:30:00
2013-11-29 12:15:00
2013-12-24 12:15:00
2013-12-26 15:15:00
2014-01-02 15:15:00
2014-01-20 10:30:00
2014-02-17 10:30:00
2014-05-26 12:00:00
2014-07-03 12:00:00
2014-09-01 12:00:00
2014-11-27 12:00:00
2014-11-28 12:15:00
2014-12-24 12:15:00
2015-01-19 12:00:00
2015-02-16 12:00:00
2015-04-03 08:15:00
2015-05-25 12:00:00
2015-07-03 12:00:00
2015-09-07 12:00:00
2015-11-26 12:00:00
2015-11-27 12:15:00
2015-12-24 12:15:00
2016-01-18 12:00:00
2016-02-15 12:00:00
2016-05-30 12:00:00
2016-07-04 12:00:00
2016-09-05 12:00:00
2016-11-24 12:00:00
2016-11-25 12:15:00
2017-01-16 12:00:00
2017-02-20 12:00:00
2017-05-29 12:00:00
2017-07-03 12:15:00
2017-07-04 12:00:00
2017-09-04 12:00:00
2017-11-23 12:00:00
2017-11-24 12:15:00
2018-01-15 12:00:00
2018-02-19 12:00:00
2018-05-28 12:00:00
2018-07-03 12:15:00
2018-07-04 12:00:00
2018-09-03 12:00:00
2018-11-22 12:00:00
2018-11-23 12:15:00
2018-12-24 12:15:00
2019-01-21 12:00:00
2019-02-18 12:00:00
2019-05-27 12:00:00
2019-07-03 12:15:00
2019-07-04 12:00:00
2019-09-02 12:00:00
2019-11-28 12:00:00
2019-11-29 12:15:00
2019-12-24 12:15:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:15:00
2020-12-24 12:15:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-04-02 8:15:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:15:00
2022-01-17 12:00:00
2022-02-21 12:00:00
2022-05-30 12:00:00
2022-06-20 12:00:00
2022-07-04 12:00:00
2022-09-05 12:00:00
2022-11-24 12:00:00
2022-11-25 12:15:00

Late Opens

There are no days with late opens.

Time Zone

The E-mini Russell 2000 Index Futures contract in the CME Future market trades in the America/New York time zone.

 

3.7.7.3.3.60 RTY

3.7.7.3.4 COMEX

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the COMEX Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the COMEX Future market:

Weekday Time (America/Chicago)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the COMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The COMEX Future market trades in the America/Chicago time zone.

Supported Assets

The following table shows the available contracts in the COMEX Future market. Some of these contracts may have different trading periods than the overall COMEX Future market.

Symbol Contract
AUP Aluminum MW U.S. Transaction Premium Platts (25MT) Futures
EDP Aluminium European Premium Duty-Paid (Metal Bulletin) Futures
GC Gold Futures
HG Copper Futures
MGC Micro Gold Futures
MGT Micro Gold TAS Futures
SI Silver Futures
SIL Micro Silver Futures

 

3.7.7.3.4.1 AUP

Introduction

This page shows the trading hours, holidays, and time zone of the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures (AUP) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Aluminum MW U.S. Transaction Premium Platts (25MT) Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.2 EDP

Introduction

This page shows the trading hours, holidays, and time zone of the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures (EDP) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Aluminium European Premium Duty-Paid (Metal Bulletin) Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.3 GC

Introduction

This page shows the trading hours, holidays, and time zone of the Gold Futures (GC) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gold Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.4 HG

Introduction

This page shows the trading hours, holidays, and time zone of the Copper Futures (HG) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Copper Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Copper Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Copper Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Copper Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the Copper Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Copper Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.5 MGC

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Gold Futures (MGC) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Gold Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Gold Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Gold Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Gold Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.6 MGT

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Gold TAS Futures (MGT) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Gold TAS Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Gold TAS Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Gold TAS Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Gold TAS Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Gold TAS Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Gold TAS Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.7 SI

Introduction

This page shows the trading hours, holidays, and time zone of the Silver Futures (SI) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Silver Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.4.8 SIL

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Silver Futures (SIL) contract in the COMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Silver Futures contract in the COMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Silver Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Silver Futures contract in the COMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Silver Futures contract in the COMEX Future market trades in the America/New York time zone.

 

3.7.7.3.5 ICE

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the ICE Futures market.

Supported Assets

The following table shows the available contracts in the ICE Future market. Some of these contracts may have different trading periods than the overall ICE Future market.

Symbol Contract
B Brent Crude Futures
CC Cocoa Futures
CT Cotton No. 2 Futures
DX US Dollar Index Futures
G Low Sulfur Gasoil
KC Coffee C Arabica Futures
OJ Frozen Concentrated Orange Juice
SB Sugar No. 11 Futures

 

3.7.7.3.5.1 B

Introduction

This page shows the trading hours, holidays, and time zone of the Brent Crude Futures (B) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Brent Crude Futures contract in the ICE Future market:

Weekday Time (America/New York)
Sunday 20:00:00 to 24:00:00
Monday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Tuesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Wednesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Thursday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Friday 00:00:00 to 18:00:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Brent Crude Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2013-01-01 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-04-03 2015-12-25 2016-01-01
2016-03-25 2016-12-25 2017-01-02 2017-04-14 2017-12-25
2018-01-01 2018-03-30 2018-12-25 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Brent Crude Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2013-01-21 13:30:00
2013-02-18 13:30:00
2013-05-27 13:30:00
2013-07-04 13:30:00
2013-09-02 13:30:00
2013-11-28 13:30:00
2013-11-29 14:00:00
2013-12-24 14:00:00
2013-12-31 15:00:00
2014-01-20 13:30:00
2014-02-17 13:30:00
2014-05-26 13:30:00
2014-07-04 13:30:00
2014-09-01 13:30:00
2014-11-27 13:30:00
2014-11-28 14:00:00
2014-12-24 14:00:00
2014-12-31 15:00:00
2015-01-19 13:30:00
2015-02-16 13:30:00
2015-06-03 13:30:00
2015-07-03 13:30:00
2015-09-07 13:30:00
2015-11-26 13:30:00
2015-11-27 14:00:00
2015-12-24 14:00:00
2015-12-31 15:00:00
2016-01-18 13:30:00
2016-02-15 13:30:00
2016-05-30 13:30:00
2016-07-04 13:30:00
2016-09-05 13:30:00
2016-11-26 13:30:00
2016-11-27 14:00:00
2016-12-24 14:00:00
2016-12-30 15:00:00
2017-09-04 13:30:00
2017-11-23 13:30:00
2017-11-24 14:00:00
2017-12-22 17:00:00
2017-12-29 17:00:00
2018-07-04 13:30:00
2018-09-03 13:30:00
2018-11-22 13:30:00
2018-11-23 14:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-05-27 13:30:00
2019-07-04 13:30:00
2019-09-02 13:30:00
2019-11-28 13:30:00
2019-11-29 14:00:00
2019-12-24 14:00:00
2019-12-31 15:00:00
2020-05-25 13:30:00
2020-07-03 13:30:00
2020-09-07 13:30:00
2020-11-26 13:30:00
2020-11-27 14:00:00
2020-12-24 14:00:00
2020-12-31 15:00:00

Late Opens

There are no days with late opens.

Time Zone

The Brent Crude Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.2 CC

Introduction

This page shows the trading hours, holidays, and time zone of the Cocoa Futures (CC) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Cocoa Futures contract in the ICE Future market:

Weekday Time (America/New York)
Monday 04:45:00 to 13:30:00
Tuesday 04:45:00 to 13:30:00
Wednesday 04:45:00 to 13:30:00
Thursday 04:45:00 to 13:30:00
Friday 04:45:00 to 13:30:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Cocoa Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2007-12-24 2007-12-25 2008-01-01 2008-01-21 2008-02-18
2008-03-21 2008-05-26 2008-07-04 2008-09-01 2008-11-27
2008-12-25 2009-01-01 2009-01-19 2009-02-16 2009-04-10
2009-05-25 2009-07-03 2009-09-07 2009-11-26 2009-12-25
2010-01-01 2010-01-18 2010-02-15 2010-04-02 2010-05-31
2010-07-05 2010-09-06 2010-11-25 2010-12-24 2011-01-03
2011-01-17 2011-02-21 2011-04-22 2011-05-30 2011-07-04
2011-09-05 2011-11-24 2011-12-26 2012-01-02 2012-01-16
2012-02-20 2012-04-06 2012-05-28 2012-07-04 2012-09-03
2012-11-22 2012-12-25 2013-01-01 2013-01-21 2013-02-18
2013-03-29 2013-05-27 2013-07-04 2013-09-02 2013-11-28
2013-12-25 2014-01-01 2014-01-20 2014-02-17 2014-04-18
2014-05-26 2014-07-04 2014-09-01 2014-11-27 2014-12-25
2015-01-01 2015-01-19 2015-02-16 2015-04-03 2015-05-25
2015-07-03 2015-09-07 2015-11-26 2015-12-25 2016-01-01
2016-01-18 2016-02-15 2016-03-25 2016-05-30 2016-07-04
2016-09-05 2016-11-24 2016-12-26 2017-01-02 2017-01-16
2017-02-20 2017-04-14 2017-05-29 2017-07-04 2017-09-04
2017-11-23 2017-12-25 2018-01-01 2018-01-15 2018-02-19
2018-03-30 2018-05-28 2018-07-04 2018-09-03 2018-11-22
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-12-24 2021-12-27 2021-12-31 2022-12-26 2023-01-02

Early Closes

The following table shows the early closes for the Cocoa Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2008-11-26 14:15:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2008-12-26 14:15:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:05:00
2016-11-25 13:00:00
2017-12-24 13:05:00
2019-12-24 13:05:00

Late Opens

The following table shows the late opens for the Cocoa Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2009-12-28 07:30:00
2010-12-27 07:30:00
2010-12-28 07:30:00
2011-12-27 07:30:00
2012-04-09 07:30:00
2012-12-26 07:30:00
2013-01-02 07:30:00
2013-04-01 07:30:00
2013-12-26 08:00:00
2014-01-02 08:00:00
2014-04-21 07:30:00
2014-12-26 08:00:00
2015-01-02 08:00:00
2015-04-06 07:30:00
2015-12-28 08:00:00
2016-12-27 08:00:00
2017-04-17 07:30:00
2017-12-26 08:00:00
2018-04-02 07:30:00
2018-12-26 08:00:00
2019-04-22 07:30:00
2019-12-26 08:00:00

Time Zone

The Cocoa Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.3 CT

Introduction

This page shows the trading hours, holidays, and time zone of the Cotton No. 2 Futures (CT) contract in the ICE Future market.

Pre Market Hours

The following table shows the pre-market hours for the Cotton No. 2 Futures contract in the ICE Future market:

Weekday Time (America/New York)
Sunday 19:30:00 to 21:00:00
Monday 19:30:00 to 21:00:00
Tuesday 19:30:00 to 21:00:00
Wednesday 19:30:00 to 21:00:00
Thursday 19:30:00 to 21:00:00

Regular Trading Hours

The following table shows the regular trading hours for the Cotton No. 2 Futures contract in the ICE Future market:

Weekday Time (America/New York)
Sunday 21:00:00 to 24:00:00
Monday 00:00:00 to 14:20:00, 21:00:00 to 24:00:00
Tuesday 00:00:00 to 14:20:00, 21:00:00 to 24:00:00
Wednesday 00:00:00 to 14:20:00, 21:00:00 to 24:00:00
Thursday 00:00:00 to 14:20:00, 21:00:00 to 24:00:00
Friday 00:00:00 to 14:20:00

Post Market Hours

The following table shows the post-market hours for the Cotton No. 2 Futures contract in the ICE Future market:

Weekday Time (America/New York)
Monday 14:50:00 to 18:00:00
Tuesday 14:50:00 to 18:00:00
Wednesday 14:50:00 to 18:00:00
Thursday 14:50:00 to 18:00:00
Friday 14:50:00 to 18:00:00

Holidays

The following table shows the dates of holidays for the Cotton No. 2 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2007-12-24 2007-12-25 2008-01-01 2008-01-21 2008-02-18
2008-03-21 2008-05-26 2008-07-04 2008-09-01 2008-11-27
2008-12-25 2009-01-01 2009-01-19 2009-02-16 2009-04-10
2009-05-25 2009-07-03 2009-09-07 2009-11-26 2009-12-25
2010-01-01 2010-01-18 2010-02-15 2010-04-02 2010-05-31
2010-07-05 2010-09-06 2010-11-25 2010-12-24 2011-01-17
2011-02-21 2011-04-22 2011-05-30 2011-07-04 2011-09-05
2011-11-24 2011-12-26 2012-01-02 2012-01-16 2012-02-20
2012-04-06 2012-05-28 2012-07-04 2012-09-03 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-25
2019-01-01 2019-01-21 2019-02-18 2019-04-19 2019-05-27
2019-07-04 2019-09-02 2019-11-28 2019-12-25 2020-01-01
2020-01-20 2020-02-17 2020-04-10 2020-05-25 2020-07-03
2020-09-07 2020-11-26 2020-12-25 2021-01-01 2022-12-25
2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Cotton No. 2 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2008-11-26 14:15:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2008-12-26 14:15:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:05:00
2016-11-25 13:00:00
2017-11-23 13:30:00
2017-11-24 13:30:00
2017-12-24 13:05:00
2019-11-29 13:30:00
2019-12-24 13:05:00

Late Opens

The following table shows the late opens for the Cotton No. 2 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2009-12-28 07:30:00
2010-12-27 07:30:00
2010-12-28 07:30:00
2011-12-27 07:30:00
2012-12-26 07:30:00
2013-01-02 07:30:00
2013-07-05 08:00:00
2013-11-29 08:00:00
2013-12-26 08:00:00
2014-01-02 08:00:00
2014-07-07 08:00:00
2014-11-28 08:00:00
2014-12-26 08:00:00
2015-01-02 08:00:00
2015-11-27 08:00:00
2015-12-28 08:00:00
2016-11-25 08:00:00
2017-11-24 08:00:00
2017-12-26 08:00:00
2018-11-23 08:00:00
2018-12-26 08:00:00
2019-11-29 08:00:00
2019-12-26 08:00:00

Time Zone

The Cotton No. 2 Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.4 DX

Introduction

This page shows the trading hours, holidays, and time zone of the US Dollar Index Futures (DX) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Dollar Index Futures contract in the ICE Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 20:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 20:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 20:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 20:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US Dollar Index Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2008-01-01 2008-03-21 2008-12-25 2009-01-01 2009-04-10
2009-12-25 2010-01-01 2010-12-24 2011-04-22 2011-12-26
2012-01-02 2013-01-01 2013-03-29 2013-12-25 2014-01-01
2014-04-18 2014-12-25 2015-01-01 2015-12-25 2016-01-01
2016-03-25 2016-12-26 2017-01-02 2017-04-14 2017-12-25
2018-01-01 2018-03-30 2018-12-25 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the US Dollar Index Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2007-12-24 13:15:00
2007-12-31 16:15:00
2008-01-21 13:00:00
2008-02-18 13:00:00
2008-03-20 16:15:00
2008-07-03 16:15:00
2008-07-04 13:00:00
2008-08-29 16:15:00
2008-09-01 13:00:00
2008-11-26 17:00:00
2008-11-27 13:00:00
2008-11-28 13:15:00
2008-12-24 13:15:00
2008-12-26 17:00:00
2008-12-31 17:00:00
2009-01-02 17:00:00
2009-01-16 16:15:00
2009-01-19 13:00:00
2009-02-13 16:15:00
2009-02-16 13:00:00
2009-04-09 16:15:00
2009-05-22 16:15:00
2009-05-25 13:00:00
2009-07-02 16:15:00
2009-07-03 13:00:00
2009-09-04 16:15:00
2009-09-07 13:00:00
2009-10-09 16:15:00
2009-11-25 17:00:00
2009-11-26 13:00:00
2009-11-27 13:15:00
2009-12-24 13:15:00
2009-12-31 17:00:00
2010-01-15 16:15:00
2010-01-18 13:00:00
2010-02-12 16:15:00
2010-02-15 13:00:00
2010-04-02 11:15:00
2010-05-28 16:15:00
2010-05-31 13:00:00
2010-07-02 16:15:00
2010-07-05 13:00:00
2010-09-03 16:15:00
2010-09-06 13:00:00
2010-10-08 16:15:00
2010-11-25 13:00:00
2010-11-26 13:15:00
2010-12-23 17:00:00
2010-12-31 13:15:00
2011-01-14 16:15:00
2011-01-17 13:00:00
2011-02-18 16:15:00
2011-02-21 13:00:00
2011-05-27 16:15:00
2011-05-30 13:00:00
2011-07-01 16:15:00
2011-07-04 13:00:00
2011-09-02 16:15:00
2011-09-05 13:00:00
2011-10-07 16:15:00
2011-11-24 13:00:00
2011-11-25 13:15:00
2012-02-17 16:15:00
2012-02-20 13:00:00
2012-04-06 11:15:00
2012-05-25 16:15:00
2012-05-28 13:00:00
2012-07-04 13:00:00
2012-08-31 16:15:00
2012-09-03 13:00:00
2012-10-05 16:15:00
2012-11-22 13:00:00
2012-11-23 13:15:00
2012-12-24 13:15:00
2013-02-15 16:15:00
2013-02-18 13:00:00
2013-05-24 16:15:00
2013-05-27 13:00:00
2013-07-04 13:00:00
2013-08-30 16:15:00
2013-09-02 13:00:00
2013-11-28 13:00:00
2013-11-29 13:15:00
2013-12-24 13:15:00
2014-01-17 16:15:00
2014-01-20 13:00:00
2014-02-14 16:15:00
2014-02-17 13:00:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:15:00
2014-12-24 13:15:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-04-03 11:15:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:15:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:15:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:15:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:15:00
2018-12-24 13:15:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:15:00
2019-12-24 13:15:00
2020-01-20 13:00:00

Late Opens

The following table shows the late opens for the US Dollar Index Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2008-12-26 06:00:00
2009-01-02 06:00:00
2011-12-27 06:00:00
2012-01-03 06:00:00
2012-12-26 06:00:00
2013-01-02 06:00:00
2013-12-26 06:00:00
2014-01-02 06:00:00

Time Zone

The US Dollar Index Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.5 G

Introduction

This page shows the trading hours, holidays, and time zone of the Low Sulfur Gasoil (G) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Low Sulfur Gasoil contract in the ICE Future market:

Weekday Time (America/New York)
Sunday 20:00:00 to 24:00:00
Monday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Tuesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Wednesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Thursday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Friday 00:00:00 to 18:00:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Low Sulfur Gasoil contract in the ICE Future market:

Date ( yyyy-mm-dd )
2013-01-01 2013-03-29 2013-12-25 2014-01-01 2014-04-18
2014-12-25 2015-01-01 2015-04-03 2015-12-25 2016-01-01
2016-03-25 2016-12-25 2017-01-02 2017-04-14 2017-12-25
2018-01-01 2018-03-30 2018-12-25 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Low Sulfur Gasoil contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2013-01-21 13:30:00
2013-02-18 13:30:00
2013-05-27 13:30:00
2013-07-04 13:30:00
2013-09-02 13:30:00
2013-11-28 13:30:00
2013-11-29 14:00:00
2013-12-24 14:00:00
2013-12-31 15:00:00
2014-01-20 13:30:00
2014-02-17 13:30:00
2014-05-26 13:30:00
2014-07-04 13:30:00
2014-09-01 13:30:00
2014-11-27 13:30:00
2014-11-28 14:00:00
2014-12-24 14:00:00
2014-12-31 15:00:00
2015-01-19 13:30:00
2015-02-16 13:30:00
2015-06-03 13:30:00
2015-07-03 13:30:00
2015-09-07 13:30:00
2015-11-26 13:30:00
2015-11-27 14:00:00
2015-12-24 14:00:00
2015-12-31 15:00:00
2016-01-18 13:30:00
2016-02-15 13:30:00
2016-05-30 13:30:00
2016-07-04 13:30:00
2016-09-05 13:30:00
2016-11-26 13:30:00
2016-11-27 14:00:00
2016-12-24 14:00:00
2016-12-30 15:00:00
2017-09-04 13:30:00
2017-11-23 13:30:00
2017-11-24 14:00:00
2017-12-22 17:00:00
2017-12-29 17:00:00
2018-07-04 13:30:00
2018-09-03 13:30:00
2018-11-22 13:30:00
2018-11-23 14:00:00
2018-12-24 17:00:00
2018-12-31 17:00:00
2019-05-27 13:30:00
2019-07-04 13:30:00
2019-09-02 13:30:00
2019-11-28 13:30:00
2019-11-29 14:00:00
2019-12-24 14:00:00
2019-12-31 15:00:00
2020-05-25 13:30:00
2020-07-03 13:30:00
2020-09-07 13:30:00
2020-11-26 13:30:00
2020-11-27 14:00:00
2020-12-24 14:00:00
2020-12-31 15:00:00

Late Opens

There are no days with late opens.

Time Zone

The Low Sulfur Gasoil contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.6 KC

Introduction

This page shows the trading hours, holidays, and time zone of the Coffee C Arabica Futures (KC) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Coffee C Arabica Futures contract in the ICE Future market:

Weekday Time (America/New York)
Monday 04:15:00 to 13:30:00
Tuesday 04:15:00 to 13:30:00
Wednesday 04:15:00 to 13:30:00
Thursday 04:15:00 to 13:30:00
Friday 04:15:00 to 13:30:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Coffee C Arabica Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2007-12-24 2007-12-25 2008-01-01 2008-01-21 2008-02-18
2008-03-21 2008-05-26 2008-07-04 2008-09-01 2008-11-27
2008-12-25 2009-01-01 2009-01-19 2009-02-16 2009-04-10
2009-05-25 2009-07-03 2009-09-07 2009-11-26 2009-12-25
2010-01-01 2010-01-18 2010-02-15 2010-04-02 2010-05-31
2010-07-05 2010-09-06 2010-11-25 2010-12-24 2011-01-03
2011-01-17 2011-02-21 2011-04-22 2011-05-30 2011-07-04
2011-09-05 2011-11-24 2011-12-26 2012-01-02 2012-01-16
2012-02-20 2012-04-06 2012-05-28 2012-07-04 2012-09-03
2012-11-22 2012-12-25 2013-01-01 2013-01-21 2013-02-18
2013-03-29 2013-05-27 2013-07-04 2013-09-02 2013-11-28
2013-12-25 2014-01-01 2014-01-20 2014-02-17 2014-04-18
2014-05-26 2014-07-04 2014-09-01 2014-11-27 2014-12-25
2015-01-01 2015-01-19 2015-02-16 2015-04-03 2015-05-25
2015-07-03 2015-09-07 2015-11-26 2015-12-25 2016-01-01
2016-01-18 2016-02-15 2016-03-25 2016-05-30 2016-07-04
2016-09-05 2016-11-24 2016-12-26 2017-01-02 2017-01-16
2017-02-20 2017-04-14 2017-05-29 2017-07-04 2017-09-04
2017-11-23 2017-12-25 2018-01-01 2018-01-15 2018-02-19
2018-03-30 2018-05-28 2018-07-04 2018-09-03 2018-11-22
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2022-12-26 2023-01-02

Early Closes

The following table shows the early closes for the Coffee C Arabica Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2008-11-26 14:15:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2008-12-26 14:15:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:05:00
2016-11-25 13:00:00
2017-12-24 13:05:00
2019-12-24 13:05:00

Late Opens

The following table shows the late opens for the Coffee C Arabica Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2009-12-28 07:30:00
2010-12-27 07:30:00
2010-12-28 07:30:00
2011-12-27 07:30:00
2012-04-09 07:30:00
2012-12-26 07:30:00
2013-01-02 07:30:00
2013-04-01 07:30:00
2013-12-26 08:00:00
2014-01-02 08:00:00
2014-04-21 07:30:00
2014-12-26 08:00:00
2015-01-02 08:00:00
2015-04-06 07:30:00
2015-12-28 08:00:00
2016-12-27 08:00:00
2017-04-17 07:30:00
2017-12-26 08:00:00
2018-04-02 07:30:00
2018-12-26 08:00:00
2019-04-22 07:30:00
2019-12-26 08:00:00

Time Zone

The Coffee C Arabica Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.7 OJ

Introduction

This page shows the trading hours, holidays, and time zone of the Frozen Concentrated Orange Juice (OJ) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Frozen Concentrated Orange Juice contract in the ICE Future market:

Weekday Time (America/New York)
Monday 08:00:00 to 14:00:00
Tuesday 08:00:00 to 14:00:00
Wednesday 08:00:00 to 14:00:00
Thursday 08:00:00 to 14:00:00
Friday 08:00:00 to 14:00:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Frozen Concentrated Orange Juice contract in the ICE Future market:

Date ( yyyy-mm-dd )
2007-12-24 2007-12-25 2008-01-01 2008-01-21 2008-02-18
2008-03-21 2008-05-26 2008-07-04 2008-09-01 2008-11-27
2008-12-25 2009-01-01 2009-01-19 2009-02-16 2009-04-10
2009-05-25 2009-07-03 2009-09-07 2009-11-26 2009-12-25
2010-01-01 2010-01-18 2010-02-15 2010-04-02 2010-05-31
2010-07-05 2010-09-06 2010-11-25 2010-12-24 2011-01-17
2011-02-21 2011-04-22 2011-05-30 2011-07-04 2011-09-05
2011-11-24 2011-12-26 2012-01-02 2012-01-16 2012-02-20
2012-04-06 2012-05-28 2012-07-04 2012-09-03 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-25
2019-01-01 2019-01-21 2019-02-18 2019-04-19 2019-05-27
2019-07-04 2019-09-02 2019-11-28 2019-12-25 2020-01-01
2020-01-20 2020-02-17 2020-04-10 2020-05-25 2020-07-03
2020-09-07 2020-11-26 2020-12-25 2021-01-01 2022-12-26
2023-01-02

Early Closes

The following table shows the early closes for the Frozen Concentrated Orange Juice contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2008-11-26 14:15:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2008-12-26 14:15:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:05:00
2016-11-25 13:00:00
2017-11-23 13:30:00
2017-11-24 13:30:00
2017-12-24 13:05:00
2019-11-29 13:30:00
2019-12-24 13:05:00

Late Opens

The following table shows the late opens for the Frozen Concentrated Orange Juice contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2012-12-26 07:30:00

Time Zone

The Frozen Concentrated Orange Juice contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.5.8 SB

Introduction

This page shows the trading hours, holidays, and time zone of the Sugar No. 11 Futures (SB) contract in the ICE Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Sugar No. 11 Futures contract in the ICE Future market:

Weekday Time (America/New York)
Monday 03:30:00 to 13:00:00
Tuesday 03:30:00 to 13:00:00
Wednesday 03:30:00 to 13:00:00
Thursday 03:30:00 to 13:00:00
Friday 03:30:00 to 13:00:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Sugar No. 11 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd )
2007-12-24 2007-12-25 2008-01-01 2008-01-21 2008-02-18
2008-03-21 2008-05-26 2008-07-04 2008-09-01 2008-11-27
2008-12-25 2009-01-01 2009-01-19 2009-02-16 2009-04-10
2009-05-25 2009-07-03 2009-09-07 2009-11-26 2009-12-25
2010-01-01 2010-01-18 2010-02-15 2010-04-02 2010-05-31
2010-07-05 2010-09-06 2010-11-25 2010-12-24 2011-01-03
2011-01-17 2011-02-21 2011-04-22 2011-05-30 2011-07-04
2011-09-05 2011-11-24 2011-12-26 2012-01-02 2012-01-16
2012-02-20 2012-04-06 2012-05-28 2012-07-04 2012-09-03
2012-11-22 2012-12-25 2013-01-01 2013-01-21 2013-02-18
2013-03-29 2013-05-27 2013-07-04 2013-09-02 2013-11-28
2013-12-25 2014-01-01 2014-01-20 2014-02-17 2014-04-18
2014-05-26 2014-07-04 2014-09-01 2014-11-27 2014-12-25
2015-01-01 2015-01-19 2015-02-16 2015-04-03 2015-05-25
2015-07-03 2015-09-07 2015-11-26 2015-12-25 2016-01-01
2016-01-18 2016-02-15 2016-03-25 2016-05-30 2016-07-04
2016-09-05 2016-11-24 2016-12-26 2017-01-02 2017-01-16
2017-02-20 2017-04-14 2017-05-29 2017-07-04 2017-09-04
2017-11-23 2017-12-25 2018-01-01 2018-01-15 2018-02-19
2018-03-30 2018-05-28 2018-07-04 2018-09-03 2018-11-22
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2022-12-26 2023-01-02

Early Closes

The following table shows the early closes for the Sugar No. 11 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2008-11-26 14:15:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2008-12-26 14:15:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00

Late Opens

The following table shows the late opens for the Sugar No. 11 Futures contract in the ICE Future market:

Date ( yyyy-mm-dd ) Time Of Market Open (America/New York)
2009-12-28 07:30:00
2010-12-27 07:30:00
2010-12-28 07:30:00
2011-12-27 07:30:00
2012-04-09 07:30:00
2012-12-26 07:30:00
2013-01-02 07:30:00
2013-04-01 07:30:00
2013-12-26 08:00:00
2014-01-02 08:00:00
2014-04-21 07:30:00
2014-12-26 08:00:00
2015-01-02 08:00:00
2015-04-06 07:30:00
2015-12-28 08:00:00
2016-12-27 08:00:00
2017-04-17 07:30:00
2017-12-26 08:00:00
2018-04-02 07:30:00
2018-12-26 08:00:00
2019-04-22 07:30:00
2019-12-26 08:00:00

Time Zone

The Sugar No. 11 Futures contract in the ICE Future market trades in the America/New York time zone.

 

3.7.7.3.6 INDIA

Introduction

This page shows the trading hours, holidays, and time zone of the India Future market.

Pre-market Hours

The following table shows the pre-market hours for the India Future market:

Weekday Time (Asia/Kolkata)
Monday 09:00:00 to 09:15:00
Tuesday 09:00:00 to 09:15:00
Wednesday 09:00:00 to 09:15:00
Thursday 09:00:00 to 09:15:00
Friday 09:00:00 to 09:15:00

Regular Trading Hours

The following table shows the regular trading hours for the India Future market:

Weekday Time (Asia/Kolkata)
Monday 09:15:00 to 15:30:00
Tuesday 09:15:00 to 15:30:00
Wednesday 09:15:00 to 15:30:00
Thursday 09:15:00 to 15:30:00
Friday 09:15:00 to 15:30:00

Post-market Hours

The following table shows the post-market hours for the India Future market:

Weekday Time (Asia/Kolkata)
Monday 15:40:00 to 16:00:00
Tuesday 15:40:00 to 16:00:00
Wednesday 15:40:00 to 16:00:00
Thursday 15:40:00 to 16:00:00
Friday 15:40:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the India Future market:

Date ( yyyy-mm-dd )
2004-01-26 2004-04-14 2005-01-26 2005-04-14 2005-08-15
2006-01-26 2006-04-14 2006-05-01 2006-08-15 2006-10-02
2006-12-25 2007-01-26 2007-05-01 2007-08-15 2007-10-02
2007-12-25 2008-04-14 2008-05-01 2008-08-15 2008-10-02
2008-12-25 2009-01-26 2009-04-14 2009-05-01 2009-10-02
2009-12-25 2010-01-26 2010-04-14 2011-01-26 2011-03-02
2011-04-12 2011-04-14 2011-04-22 2011-08-15 2011-08-31
2011-09-01 2011-10-06 2011-10-26 2011-10-27 2011-11-07
2011-11-10 2011-12-06 2012-01-26 2012-02-20 2012-03-08
2012-04-05 2012-04-06 2012-05-01 2012-08-15 2012-08-20
2012-09-19 2012-10-02 2012-10-24 2012-11-14 2012-11-28
2012-12-25 2013-03-27 2013-03-29 2013-04-19 2013-04-24
2013-05-01 2013-08-09 2013-08-15 2013-09-09 2013-10-02
2013-10-16 2013-11-04 2013-11-15 2013-12-25 2014-02-27
2014-03-17 2014-04-08 2014-04-14 2014-04-18 2014-04-24
2014-05-01 2014-07-29 2014-08-15 2014-08-29 2014-10-02
2014-10-03 2014-10-06 2014-10-15 2014-10-24 2014-11-04
2014-11-06 2014-12-25 2015-01-26 2015-02-17 2015-03-06
2015-04-02 2015-04-03 2015-04-14 2015-05-01 2015-09-17
2015-09-25 2015-10-02 2015-10-22 2015-11-12 2015-11-25
2015-12-25 2016-01-26 2016-03-07 2016-03-24 2016-03-25
2016-04-14 2016-04-15 2016-04-19 2016-07-06 2016-08-15
2016-09-05 2016-09-13 2016-10-11 2016-10-12 2016-10-31
2016-11-14 2017-01-26 2017-02-24 2017-03-13 2017-04-04
2017-04-14 2017-05-01 2017-06-26 2017-08-15 2017-08-25
2017-10-02 2017-10-20 2017-12-25 2018-01-26 2018-02-13
2018-03-02 2018-03-29 2018-03-30 2018-05-01 2018-08-15
2018-08-22 2018-09-13 2018-09-20 2018-10-02 2018-10-18
2018-11-08 2018-11-23 2018-12-25 2019-03-04 2019-03-21
2019-04-17 2019-04-19 2019-04-29 2019-05-01 2019-06-05
2019-08-12 2019-08-15 2019-09-02 2019-09-10 2019-10-02
2019-10-08 2019-10-21 2019-10-28 2019-11-12 2019-12-25
2020-02-21 2020-03-10 2020-04-02 2020-04-06 2020-04-10
2020-04-14 2020-05-01 2020-05-25 2020-10-02 2020-11-16
2020-11-30 2020-12-25 2021-01-26 2021-03-11 2021-03-29
2021-04-02 2021-04-14 2021-04-21 2021-05-13 2021-07-21
2021-08-19 2021-09-10 2021-10-15 2021-11-05 2021-11-19
2022-01-26 2022-04-14 2022-08-15 2023-01-26 2023-04-14
2023-05-01 2023-08-15 2023-10-02 2023-12-25 2024-01-26

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The India Future market trades in the Asia/Kolkata time zone.

 

3.7.7.3.7 NFO

Introduction

This page shows the trading hours, holidays, and time zone of the NFO Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NFO Future market:

Weekday Time (Asia/Kolkata)
Monday 09:15:00 to 15:30:00
Tuesday 09:15:00 to 15:30:00
Wednesday 09:15:00 to 15:30:00
Thursday 09:15:00 to 15:30:00
Friday 09:15:00 to 15:30:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NFO Future market:

Date ( yyyy-mm-dd )
2004-01-26 2004-04-14 2005-01-26 2005-04-14 2005-08-15
2006-01-26 2006-04-14 2006-05-01 2006-08-15 2006-10-02
2006-12-25 2007-01-26 2007-05-01 2007-08-15 2007-10-02
2007-12-25 2008-04-14 2008-05-01 2008-08-15 2008-10-02
2008-12-25 2009-01-26 2009-04-14 2009-05-01 2009-10-02
2009-12-25 2010-01-26 2010-04-14 2011-01-26 2011-03-02
2011-04-12 2011-04-14 2011-04-22 2011-08-15 2011-08-31
2011-09-01 2011-10-06 2011-10-26 2011-10-27 2011-11-07
2011-11-10 2011-12-06 2012-01-26 2012-02-20 2012-03-08
2012-04-05 2012-04-06 2012-05-01 2012-08-15 2012-08-20
2012-09-19 2012-10-02 2012-10-24 2012-11-14 2012-11-28
2012-12-25 2013-03-27 2013-03-29 2013-04-19 2013-04-24
2013-05-01 2013-08-09 2013-08-15 2013-09-09 2013-10-02
2013-10-16 2013-11-04 2013-11-15 2013-12-25 2014-02-27
2014-03-17 2014-04-08 2014-04-14 2014-04-18 2014-04-24
2014-05-01 2014-07-29 2014-08-15 2014-08-29 2014-10-02
2014-10-03 2014-10-06 2014-10-15 2014-10-24 2014-11-04
2014-11-06 2014-12-25 2015-01-26 2015-02-17 2015-03-06
2015-04-02 2015-04-03 2015-04-14 2015-05-01 2015-09-17
2015-09-25 2015-10-02 2015-10-22 2015-11-12 2015-11-25
2015-12-25 2016-01-26 2016-03-07 2016-03-24 2016-03-25
2016-04-14 2016-04-15 2016-04-19 2016-07-06 2016-08-15
2016-09-05 2016-09-13 2016-10-11 2016-10-12 2016-10-31
2016-11-14 2017-01-26 2017-02-24 2017-03-13 2017-04-04
2017-04-14 2017-05-01 2017-06-26 2017-08-15 2017-08-25
2017-10-02 2017-10-20 2017-12-25 2018-01-26 2018-02-13
2018-03-02 2018-03-29 2018-03-30 2018-05-01 2018-08-15
2018-08-22 2018-09-13 2018-09-20 2018-10-02 2018-10-18
2018-11-08 2018-11-23 2018-12-25 2019-03-04 2019-03-21
2019-04-17 2019-04-19 2019-04-29 2019-05-01 2019-06-05
2019-08-12 2019-08-15 2019-09-02 2019-09-10 2019-10-02
2019-10-08 2019-10-21 2019-10-28 2019-11-12 2019-12-25
2020-02-21 2020-03-10 2020-04-02 2020-04-06 2020-04-10
2020-04-14 2020-05-01 2020-05-25 2020-10-02 2020-11-16
2020-11-30 2020-12-25 2021-01-26 2021-03-11 2021-03-29
2021-04-02 2021-04-14 2021-04-21 2021-05-13 2021-07-21
2021-08-19 2021-09-10 2021-10-15 2021-11-05 2021-11-19
2022-01-26 2022-04-14 2022-08-15 2023-01-26 2023-04-14
2023-05-01 2023-08-15 2023-10-02 2023-12-25 2024-01-26

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The NFO Future market trades in the Asia/Kolkata time zone.

 

3.7.7.3.8 NYMEX

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the NYMEX Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The NYMEX Future market trades in the America/New York time zone.

Supported Assets

The following table shows the available contracts in the NYMEX Future market. Some of these contracts may have different trading periods than the overall NYMEX Future market.

Symbol Contract
1S Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures
22 Argus Propane Far East Index BALMO Futures
A0D Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
A0F Mini Singapore Fuel Oil 180 cst (Platts) Futures
A1L Gulf Coast ULSD (Platts) Up-Down BALMO Futures
A1M Gulf Coast Jet (Platts) Up-Down BALMO Futures
A1R Propane Non-LDH Mont Belvieu (OPIS) Futures
A32 European Propane CIF ARA (Argus) BALMO Futures
A3G Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures
A7E Argus Propane Far East Index Futures
A7I Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures
A7Q Mont Belvieu Natural Gasoline (OPIS) Futures
A8J Mont Belvieu Normal Butane (OPIS) BALMO Futures
A8K Conway Propane (OPIS) Futures
A8O Mont Belvieu LDH Propane (OPIS) BALMO Futures
A91 Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures
A9N Argus Propane (Saudi Aramco) Futures
AA6 Group Three ULSD (Platts) vs. NY Harbor ULSD Futures
AA8 Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures
ABS Singapore Fuel Oil 180 cst (Platts) BALMO Futures
ABT Singapore Fuel Oil 380 cst (Platts) BALMO Futures
AC0 Mont Belvieu Ethane (OPIS) Futures
AD0 Mont Belvieu Normal Butane (OPIS) Futures
ADB Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures
AE5 Argus LLS vs. WTI (Argus) Trade Month Futures
AGA Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures
AJL Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures
AJS Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures
AKL Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures
AKZ European Naphtha (Platts) BALMO Futures
APS European Propane CIF ARA (Argus) Futures
AR0 Mont Belvieu Natural Gasoline (OPIS) BALMO Futures
ARE RBOB Gasoline Crack Spread Futures
AVZ Gulf Coast HSFO (Platts) BALMO Futures
AYV Mars (Argus) vs. WTI Trade Month Futures
AYX Mars (Argus) vs. WTI Financial Futures
AZ1 Ethanol T2 FOB Rdam Including Duty (Platts) Futures
B0 Mont Belvieu LDH Propane (OPIS) Futures
B7H Gasoline Euro-bob Oxy NWE Barges (Argus) Futures
BK WTI-Brent Financial Futures
BOO 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures
BR7 Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures
BZ Brent Last Day Financial Futures
CL Crude Oil Futures
CRB Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures
CSW Clearbrook Bakken Sweet (NE2) Monthly Index Futures
CSX WTI Financial Futures
CU Chicago Ethanol (Platts) Futures
D1N Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures
DCB Dubai Crude Oil (Platts) Financial Futures
E6 Japan C&F Naphtha (Platts) BALMO Futures
EN European Naphtha (Platts) Crack Spread Futures
EPN European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures
EVC Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
EWG East-West Gasoline Spread (Platts-Argus) Futures
EWN East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures
EXR RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures
FO 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures
FRC Freight Route TC14 (Baltic) Futures
FSS 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
GCU Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
HCL WTI Houston Crude Oil Futures
HH Natural Gas (Henry Hub) Last-day Financial Futures
HO NY Harbor ULSD Futures
HP Natural Gas (Henry Hub) Penultimate Financial Futures
HRC U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
HTT WTI Houston (Argus) vs. WTI Trade Month Futures
M1B Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures
M35 Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures
M5F Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures
MAF Micro Singapore Fuel Oil 380CST (Platts) Futures
MCL Micro WTI Crude Oil Futures
MEF Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
NG Henry Hub Natural Gas Futures
PA Palladium Futures
PAM Micro Palladium Futures
PL Platinum Futures
R5O Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures
RB RBOB Gasoline Futures
S5O Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures
YO No. 11 Sugar Futures

 

3.7.7.3.8.1 1S

Introduction

This page shows the trading hours, holidays, and time zone of the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures (1S) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.2 22

Introduction

This page shows the trading hours, holidays, and time zone of the Argus Propane Far East Index BALMO Futures (22) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Argus Propane Far East Index BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.3 A0D

Introduction

This page shows the trading hours, holidays, and time zone of the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures (A0D) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.4 A0F

Introduction

This page shows the trading hours, holidays, and time zone of the Mini Singapore Fuel Oil 180 cst (Platts) Futures (A0F) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mini Singapore Fuel Oil 180 cst (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.5 A1L

Introduction

This page shows the trading hours, holidays, and time zone of the Gulf Coast ULSD (Platts) Up-Down BALMO Futures (A1L) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gulf Coast ULSD (Platts) Up-Down BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.6 A1M

Introduction

This page shows the trading hours, holidays, and time zone of the Gulf Coast Jet (Platts) Up-Down BALMO Futures (A1M) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gulf Coast Jet (Platts) Up-Down BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.7 A1R

Introduction

This page shows the trading hours, holidays, and time zone of the Propane Non-LDH Mont Belvieu (OPIS) Futures (A1R) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Propane Non-LDH Mont Belvieu (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.8 A32

Introduction

This page shows the trading hours, holidays, and time zone of the European Propane CIF ARA (Argus) BALMO Futures (A32) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The European Propane CIF ARA (Argus) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.9 A3G

Introduction

This page shows the trading hours, holidays, and time zone of the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures (A3G) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.10 A7E

Introduction

This page shows the trading hours, holidays, and time zone of the Argus Propane Far East Index Futures (A7E) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Argus Propane Far East Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Argus Propane Far East Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Argus Propane Far East Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Argus Propane Far East Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Argus Propane Far East Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Argus Propane Far East Index Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.11 A7I

Introduction

This page shows the trading hours, holidays, and time zone of the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures (A7I) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.12 A7Q

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu Natural Gasoline (OPIS) Futures (A7Q) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu Natural Gasoline (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.13 A8J

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu Normal Butane (OPIS) BALMO Futures (A8J) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu Normal Butane (OPIS) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.14 A8K

Introduction

This page shows the trading hours, holidays, and time zone of the Conway Propane (OPIS) Futures (A8K) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Conway Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Conway Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Conway Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Conway Propane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Conway Propane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Conway Propane (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.15 A8O

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu LDH Propane (OPIS) BALMO Futures (A8O) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu LDH Propane (OPIS) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.16 A91

Introduction

This page shows the trading hours, holidays, and time zone of the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures (A91) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2020-08-31 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.17 A9N

Introduction

This page shows the trading hours, holidays, and time zone of the Argus Propane (Saudi Aramco) Futures (A9N) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Argus Propane (Saudi Aramco) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.18 AA6

Introduction

This page shows the trading hours, holidays, and time zone of the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures (AA6) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Group Three ULSD (Platts) vs. NY Harbor ULSD Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.19 AA8

Introduction

This page shows the trading hours, holidays, and time zone of the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures (AA8) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.20 ABS

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore Fuel Oil 180 cst (Platts) BALMO Futures (ABS) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Singapore Fuel Oil 180 cst (Platts) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.21 ABT

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore Fuel Oil 380 cst (Platts) BALMO Futures (ABT) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Singapore Fuel Oil 380 cst (Platts) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.22 AC0

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu Ethane (OPIS) Futures (AC0) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu Ethane (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.23 AD0

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu Normal Butane (OPIS) Futures (AD0) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu Normal Butane (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.24 ADB

Introduction

This page shows the trading hours, holidays, and time zone of the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures (ADB) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2020-08-31 2022-12-25 2022-12-26
2023-01-01 2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.25 AE5

Introduction

This page shows the trading hours, holidays, and time zone of the Argus LLS vs. WTI (Argus) Trade Month Futures (AE5) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-05-25 2020-12-25 2021-11-25 2022-12-25
2022-12-26 2023-01-01 2023-01-02 2023-12-25

Early Closes

The following table shows the early closes for the Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Argus LLS vs. WTI (Argus) Trade Month Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.26 AGA

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures (AGA) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2020-08-31 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.27 AJL

Introduction

This page shows the trading hours, holidays, and time zone of the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures (AJL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.28 AJS

Introduction

This page shows the trading hours, holidays, and time zone of the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures (AJS) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.29 AKL

Introduction

This page shows the trading hours, holidays, and time zone of the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures (AKL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.30 AKZ

Introduction

This page shows the trading hours, holidays, and time zone of the European Naphtha (Platts) BALMO Futures (AKZ) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The European Naphtha (Platts) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.31 APS

Introduction

This page shows the trading hours, holidays, and time zone of the European Propane CIF ARA (Argus) Futures (APS) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The European Propane CIF ARA (Argus) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.32 AR0

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures (AR0) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu Natural Gasoline (OPIS) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.33 ARE

Introduction

This page shows the trading hours, holidays, and time zone of the RBOB Gasoline Crack Spread Futures (ARE) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The RBOB Gasoline Crack Spread Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.34 AVZ

Introduction

This page shows the trading hours, holidays, and time zone of the Gulf Coast HSFO (Platts) BALMO Futures (AVZ) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gulf Coast HSFO (Platts) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.35 AYV

Introduction

This page shows the trading hours, holidays, and time zone of the Mars (Argus) vs. WTI Trade Month Futures (AYV) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mars (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.36 AYX

Introduction

This page shows the trading hours, holidays, and time zone of the Mars (Argus) vs. WTI Financial Futures (AYX) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mars (Argus) vs. WTI Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.37 AZ1

Introduction

This page shows the trading hours, holidays, and time zone of the Ethanol T2 FOB Rdam Including Duty (Platts) Futures (AZ1) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Ethanol T2 FOB Rdam Including Duty (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.38 B0

Introduction

This page shows the trading hours, holidays, and time zone of the Mont Belvieu LDH Propane (OPIS) Futures (B0) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Mont Belvieu LDH Propane (OPIS) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.39 B7H

Introduction

This page shows the trading hours, holidays, and time zone of the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures (B7H) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gasoline Euro-bob Oxy NWE Barges (Argus) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.40 BK

Introduction

This page shows the trading hours, holidays, and time zone of the WTI-Brent Financial Futures (BK) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the WTI-Brent Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the WTI-Brent Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the WTI-Brent Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the WTI-Brent Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the WTI-Brent Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The WTI-Brent Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.41 BOO

Introduction

This page shows the trading hours, holidays, and time zone of the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures (BOO) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.42 BR7

Introduction

This page shows the trading hours, holidays, and time zone of the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures (BR7) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.43 BZ

Introduction

This page shows the trading hours, holidays, and time zone of the Brent Last Day Financial Futures (BZ) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Brent Last Day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Brent Last Day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Brent Last Day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Brent Last Day Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2019-12-31 2020-01-01 2020-08-31 2020-12-31 2021-12-31
2022-12-25 2022-12-26 2022-12-30 2023-01-01 2023-01-02
2023-12-29 2024-03-29

Early Closes

The following table shows the early closes for the Brent Last Day Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Brent Last Day Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.44 CL

Introduction

This page shows the trading hours, holidays, and time zone of the Crude Oil Futures (CL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Crude Oil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Crude Oil Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.45 CRB

Introduction

This page shows the trading hours, holidays, and time zone of the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures (CRB) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.46 CSW

Introduction

This page shows the trading hours, holidays, and time zone of the Clearbrook Bakken Sweet (NE2) Monthly Index Futures (CSW) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Clearbrook Bakken Sweet (NE2) Monthly Index Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.47 CSX

Introduction

This page shows the trading hours, holidays, and time zone of the WTI Financial Futures (CSX) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the WTI Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the WTI Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the WTI Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The WTI Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.48 CU

Introduction

This page shows the trading hours, holidays, and time zone of the Chicago Ethanol (Platts) Futures (CU) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Chicago Ethanol (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Chicago Ethanol (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Chicago Ethanol (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Chicago Ethanol (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Chicago Ethanol (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Chicago Ethanol (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.49 D1N

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures (D1N) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.50 DCB

Introduction

This page shows the trading hours, holidays, and time zone of the Dubai Crude Oil (Platts) Financial Futures (DCB) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2020-08-31 2022-12-25 2022-12-26
2023-01-01 2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Dubai Crude Oil (Platts) Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.51 E6

Introduction

This page shows the trading hours, holidays, and time zone of the Japan C&F Naphtha (Platts) BALMO Futures (E6) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Japan C&F Naphtha (Platts) BALMO Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.52 EN

Introduction

This page shows the trading hours, holidays, and time zone of the European Naphtha (Platts) Crack Spread Futures (EN) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The European Naphtha (Platts) Crack Spread Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.53 EPN

Introduction

This page shows the trading hours, holidays, and time zone of the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures (EPN) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.54 EVC

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures (EVC) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.55 EWG

Introduction

This page shows the trading hours, holidays, and time zone of the East-West Gasoline Spread (Platts-Argus) Futures (EWG) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The East-West Gasoline Spread (Platts-Argus) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.56 EWN

Introduction

This page shows the trading hours, holidays, and time zone of the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures (EWN) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-07-31 2020-08-31 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.57 EXR

Introduction

This page shows the trading hours, holidays, and time zone of the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures (EXR) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.58 FO

Introduction

This page shows the trading hours, holidays, and time zone of the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures (FO) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The 3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.59 FRC

Introduction

This page shows the trading hours, holidays, and time zone of the Freight Route TC14 (Baltic) Futures (FRC) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Freight Route TC14 (Baltic) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.60 FSS

Introduction

This page shows the trading hours, holidays, and time zone of the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures (FSS) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The 1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.61 GCU

Introduction

This page shows the trading hours, holidays, and time zone of the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures (GCU) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-08-31 2022-12-25 2022-12-26 2023-01-01
2023-01-02 2024-03-29

Early Closes

The following table shows the early closes for the Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.62 HCL

Introduction

This page shows the trading hours, holidays, and time zone of the WTI Houston Crude Oil Futures (HCL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the WTI Houston Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the WTI Houston Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the WTI Houston Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the WTI Houston Crude Oil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the WTI Houston Crude Oil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The WTI Houston Crude Oil Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.63 HH

Introduction

This page shows the trading hours, holidays, and time zone of the Natural Gas (Henry Hub) Last-day Financial Futures (HH) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Natural Gas (Henry Hub) Last-day Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.64 HO

Introduction

This page shows the trading hours, holidays, and time zone of the NY Harbor ULSD Futures (HO) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the NY Harbor ULSD Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the NY Harbor ULSD Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The NY Harbor ULSD Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.65 HP

Introduction

This page shows the trading hours, holidays, and time zone of the Natural Gas (Henry Hub) Penultimate Financial Futures (HP) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2024-03-29

Early Closes

The following table shows the early closes for the Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The Natural Gas (Henry Hub) Penultimate Financial Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.66 HRC

Introduction

This page shows the trading hours, holidays, and time zone of the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures (HRC) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.67 HTT

Introduction

This page shows the trading hours, holidays, and time zone of the WTI Houston (Argus) vs. WTI Trade Month Futures (HTT) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00

Late Opens

There are no days with late opens.

Time Zone

The WTI Houston (Argus) vs. WTI Trade Month Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.68 M1B

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures (M1B) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.69 M35

Introduction

This page shows the trading hours, holidays, and time zone of the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures (M35) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.70 M5F

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures (M5F) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.71 MAF

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Singapore Fuel Oil 380CST (Platts) Futures (MAF) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Singapore Fuel Oil 380CST (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.72 MCL

Introduction

This page shows the trading hours, holidays, and time zone of the Micro WTI Crude Oil Futures (MCL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro WTI Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro WTI Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro WTI Crude Oil Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro WTI Crude Oil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro WTI Crude Oil Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro WTI Crude Oil Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.73 MEF

Introduction

This page shows the trading hours, holidays, and time zone of the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures (MEF) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.74 NG

Introduction

This page shows the trading hours, holidays, and time zone of the Henry Hub Natural Gas Futures (NG) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Henry Hub Natural Gas Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Henry Hub Natural Gas Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Henry Hub Natural Gas Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Henry Hub Natural Gas Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Henry Hub Natural Gas Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.75 PA

Introduction

This page shows the trading hours, holidays, and time zone of the Palladium Futures (PA) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Palladium Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Palladium Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.76 PAM

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Palladium Futures (PAM) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Palladium Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Palladium Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Palladium Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Palladium Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.77 PL

Introduction

This page shows the trading hours, holidays, and time zone of the Platinum Futures (PL) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Platinum Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Platinum Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Platinum Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Platinum Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Platinum Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.78 R5O

Introduction

This page shows the trading hours, holidays, and time zone of the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures (R5O) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.79 RB

Introduction

This page shows the trading hours, holidays, and time zone of the RBOB Gasoline Futures (RB) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the RBOB Gasoline Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the RBOB Gasoline Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The RBOB Gasoline Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.80 S5O

Introduction

This page shows the trading hours, holidays, and time zone of the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures (S5O) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 09:30:00
Tuesday 00:00:00 to 09:30:00
Wednesday 00:00:00 to 09:30:00
Thursday 00:00:00 to 09:30:00
Friday 00:00:00 to 09:30:00

Regular Trading Hours

The following table shows the regular trading hours for the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 09:30:00 to 17:00:00
Tuesday 09:30:00 to 17:00:00
Wednesday 09:30:00 to 17:00:00
Thursday 09:30:00 to 17:00:00
Friday 09:30:00 to 17:00:00

Post Market Hours

The following table shows the post-market hours for the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market:

Weekday Time (America/New York)
Monday 18:00:00 to 24:00:00
Tuesday 18:00:00 to 24:00:00
Wednesday 18:00:00 to 24:00:00
Thursday 18:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2009-04-10 2009-07-03 2009-12-25 2010-01-01 2010-04-02
2010-12-24 2011-01-01 2011-04-22 2012-04-06 2012-12-25
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2014-12-25
2015-01-01 2015-04-03 2015-12-25 2016-01-01 2016-03-25
2016-12-26 2017-01-02 2017-04-14 2017-12-25 2018-01-02
2018-03-30 2018-12-25 2019-01-01 2019-04-19 2019-12-25
2020-01-01 2020-04-10 2020-12-25 2021-01-01 2021-04-02
2021-12-24 2022-04-15 2022-12-25 2022-12-26 2023-01-01
2023-01-02

Early Closes

The following table shows the early closes for the Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2009-01-19 17:15:00
2009-02-16 17:15:00
2009-05-22 16:15:00
2009-05-25 13:15:00
2009-09-04 16:15:00
2009-09-07 13:15:00
2009-10-09 16:15:00
2009-11-26 13:15:00
2009-11-27 13:45:00
2009-12-24 13:45:00
2010-01-15 16:15:00
2010-01-18 13:15:00
2010-02-12 16:15:00
2010-02-15 13:15:00
2010-05-28 16:15:00
2010-05-31 13:15:00
2010-07-02 16:15:00
2010-07-05 13:15:00
2010-09-03 16:15:00
2010-09-06 13:15:00
2010-10-08 16:15:00
2010-11-25 13:15:00
2010-11-26 13:45:00
2011-01-14 16:15:00
2011-01-17 13:15:00
2011-02-21 13:15:00
2011-05-30 13:15:00
2011-07-04 13:15:00
2011-09-05 13:15:00
2011-11-24 13:15:00
2011-11-25 13:45:00
2011-12-31 16:15:00
2012-01-16 13:15:00
2012-02-20 13:15:00
2012-05-28 13:15:00
2012-07-04 13:15:00
2012-09-03 13:15:00
2012-11-22 13:15:00
2012-11-23 13:45:00
2012-12-24 13:45:00
2013-01-21 13:15:00
2013-02-18 13:15:00
2013-05-27 13:15:00
2013-07-04 13:15:00
2013-09-02 13:15:00
2013-11-28 13:15:00
2013-11-29 13:45:00
2013-12-24 13:45:00
2014-01-20 13:15:00
2014-02-17 13:15:00
2014-05-26 13:00:00
2014-07-04 13:00:00
2014-09-01 13:00:00
2014-11-27 13:00:00
2014-11-28 13:45:00
2014-12-24 13:45:00
2015-01-19 13:00:00
2015-02-16 13:00:00
2015-05-25 13:00:00
2015-07-03 13:00:00
2015-09-07 13:00:00
2015-11-26 13:00:00
2015-11-27 13:45:00
2015-12-24 13:45:00
2016-01-18 13:00:00
2016-02-15 13:00:00
2016-05-30 13:00:00
2016-07-04 13:00:00
2016-09-05 13:00:00
2016-11-24 13:00:00
2016-11-25 13:45:00
2016-12-23 17:00:00
2017-01-16 13:00:00
2017-02-20 13:00:00
2017-05-29 13:00:00
2017-07-04 13:00:00
2017-09-04 13:00:00
2017-11-23 13:00:00
2017-11-24 13:45:00
2017-12-22 17:00:00
2017-12-26 17:00:00
2018-01-15 13:00:00
2018-02-19 13:00:00
2018-05-28 13:00:00
2018-07-04 13:00:00
2018-09-03 13:00:00
2018-11-22 13:00:00
2018-11-23 13:45:00
2018-12-24 13:45:00
2019-01-21 13:00:00
2019-02-18 13:00:00
2019-05-27 13:00:00
2019-07-04 13:00:00
2019-09-02 13:00:00
2019-11-28 13:00:00
2019-11-29 13:45:00
2019-12-24 13:45:00
2020-01-20 12:00:00
2020-02-17 12:00:00
2020-05-25 12:00:00
2020-07-03 12:00:00
2020-09-07 12:00:00
2020-11-26 12:00:00
2020-11-27 12:45:00
2020-12-24 12:45:00
2021-01-18 12:00:00
2021-02-15 12:00:00
2021-05-31 12:00:00
2021-07-05 12:00:00
2021-09-06 12:00:00
2021-11-25 12:00:00
2021-11-26 12:45:00
2022-01-17 13:30:00
2022-02-21 13:30:00
2022-05-30 13:30:00
2022-06-20 13:30:00
2022-07-04 13:30:00
2022-09-05 12:00:00
2022-11-24 13:30:00
2022-11-25 12:45:00

Late Opens

There are no days with late opens.

Time Zone

The Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures contract in the NYMEX Future market trades in the America/New York time zone.

 

3.7.7.3.8.81 YO

Introduction

This page shows the trading hours, holidays, and time zone of the No. 11 Sugar Futures (YO) contract in the NYMEX Future market.

Pre Market Hours

The following table shows the pre-market hours for the No. 11 Sugar Futures contract in the NYMEX Future market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 08:30:00
Tuesday 00:00:00 to 08:30:00
Wednesday 00:00:00 to 08:30:00
Thursday 00:00:00 to 08:30:00
Friday 00:00:00 to 08:30:00

Regular Trading Hours

The following table shows the regular trading hours for the No. 11 Sugar Futures contract in the NYMEX Future market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 16:00:00
Tuesday 08:30:00 to 16:00:00
Wednesday 08:30:00 to 16:00:00
Thursday 08:30:00 to 16:00:00
Friday 08:30:00 to 16:00:00

Post Market Hours

The following table shows the post-market hours for the No. 11 Sugar Futures contract in the NYMEX Future market:

Weekday Time (America/Chicago)
Monday 17:00:00 to 24:00:00
Tuesday 17:00:00 to 24:00:00
Wednesday 17:00:00 to 24:00:00
Thursday 17:00:00 to 24:00:00

Holidays

The following table shows the dates of holidays for the No. 11 Sugar Futures contract in the NYMEX Future market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The No. 11 Sugar Futures contract in the NYMEX Future market trades in the America/Chicago time zone.

 

3.7.7.3.9 NYSELIFFE

Introduction

This page shows the trading hours, holidays, and time zone of the NYSELIFFE Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the NYSELIFFE Future market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 18:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the NYSELIFFE Future market:

Date ( yyyy-mm-dd )
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2023-04-07 2023-12-25 2024-01-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The NYSELIFFE Future market trades in the America/New York time zone.

 

3.7.7.3.10 SGX

Introduction

This page shows the trading hours, holidays, time zone, and supported assets of the SGX Future market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the SGX Future market:

Weekday Time (Asia/Singapore)
Monday 09:00:00 to 12:00:00, 13:00:00 to 17:00:00
Tuesday 09:00:00 to 12:00:00, 13:00:00 to 17:00:00
Wednesday 09:00:00 to 12:00:00, 13:00:00 to 17:00:00
Thursday 09:00:00 to 12:00:00, 13:00:00 to 17:00:00
Friday 09:00:00 to 12:00:00, 13:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the SGX Future market:

Date ( yyyy-mm-dd )
2016-01-01 2016-02-08 2016-02-09 2016-03-25 2016-05-01
2016-05-21 2016-07-06 2016-08-09 2016-09-12 2016-10-29
2016-12-25 2017-01-01 2017-01-28 2017-01-29 2017-04-14
2017-05-01 2017-05-10 2017-06-25 2017-08-09 2017-09-01
2017-10-18 2017-12-25 2018-01-01 2018-02-16 2018-02-17
2018-03-30 2018-05-01 2018-05-29 2018-06-15 2018-08-09
2018-08-22 2018-11-06 2018-12-25 2019-01-01 2019-02-05
2019-02-06 2019-04-19 2019-05-01 2019-05-20 2019-06-05
2019-08-09 2019-08-12 2019-10-28 2019-12-25 2020-01-01
2020-01-27 2020-04-10 2020-05-01 2020-05-07 2020-05-25
2020-07-31 2020-08-10 2020-11-14 2020-12-25 2021-01-01
2021-02-12 2021-04-02 2021-05-01 2021-08-09 2021-12-25
2022-01-03 2022-01-31 2022-02-01 2022-02-02 2022-04-15
2022-05-02 2022-08-09 2022-12-26 2022-12-31

Early Closes

The following table shows the early closes for the SGX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (Asia/Singapore)
2018-02-15 12:00:00
2018-12-24 12:00:00
2018-12-31 12:00:00
2019-04-02 12:00:00
2019-12-24 12:00:00
2019-12-31 12:00:00
2020-01-24 12:00:00
2020-12-24 12:00:00
2020-12-31 12:00:00
2021-02-11 12:00:00
2021-12-24 12:00:00
2021-12-31 12:00:00
2022-01-31 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The SGX Future market trades in the Asia/Singapore time zone.

Supported Assets

The following table shows the available contracts in the SGX Future market. Some of these contracts may have different trading periods than the overall SGX Future market.

Symbol Contract
IN Nifty Indices Futures
NK SGX Nikkei 225 Index Futures
TW MSCI Taiwan Index Futures

 

3.7.7.3.10.1 IN

Introduction

This page shows the trading hours, holidays, and time zone of the Nifty Indices Futures (IN) contract in the SGX Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Nifty Indices Futures contract in the SGX Future market:

Weekday Time (Asia/Singapore)
Monday 08:45:00 to 18:15:00, 18:30:00 to 24:00:00
Tuesday 00:00:00 to 06:15:00, 08:45:00 to 18:15:00, 18:30:00 to 24:00:00
Wednesday 00:00:00 to 06:15:00, 08:45:00 to 18:15:00, 18:30:00 to 24:00:00
Thursday 00:00:00 to 06:15:00, 08:45:00 to 18:15:00, 18:30:00 to 24:00:00
Friday 00:00:00 to 06:15:00, 08:45:00 to 18:15:00, 18:30:00 to 24:00:00
Saturday 00:00:00 to 06:15:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Nifty Indices Futures contract in the SGX Future market:

Date ( yyyy-mm-dd )
2016-01-01 2016-02-08 2016-02-09 2016-03-25 2016-05-01
2016-05-21 2016-07-06 2016-08-09 2016-09-12 2016-10-29
2016-12-25 2017-01-01 2017-01-28 2017-01-29 2017-04-14
2017-05-01 2017-05-10 2017-06-25 2017-08-09 2017-09-01
2017-10-18 2017-12-25 2018-01-01 2018-02-16 2018-02-17
2018-03-30 2018-05-01 2018-05-29 2018-06-15 2018-08-09
2018-08-22 2018-11-06 2018-12-25 2019-01-01 2019-02-05
2019-02-06 2019-04-19 2019-05-01 2019-05-20 2019-06-05
2019-08-09 2019-08-12 2019-10-28 2019-12-25 2020-01-01
2020-01-27 2020-04-10 2020-05-01 2020-05-07 2020-05-25
2020-07-31 2020-08-10 2020-11-14 2020-12-25 2021-01-01
2021-02-12 2021-04-02 2021-05-01 2021-08-09 2021-12-25
2022-01-03 2022-01-31 2022-02-01 2022-02-02 2022-04-15
2022-05-02 2022-08-09 2022-12-26 2022-12-31

Early Closes

The following table shows the early closes for the Nifty Indices Futures contract in the SGX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (Asia/Singapore)
2018-02-15 12:00:00
2018-12-24 12:00:00
2018-12-31 12:00:00
2019-04-02 12:00:00
2019-12-24 12:00:00
2019-12-31 12:00:00
2020-01-24 12:00:00
2020-12-24 12:00:00
2020-12-31 12:00:00
2021-02-11 12:00:00
2021-12-24 12:00:00
2021-12-31 12:00:00
2022-01-31 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The Nifty Indices Futures contract in the SGX Future market trades in the Asia/Singapore time zone.

 

3.7.7.3.10.2 NK

Introduction

This page shows the trading hours, holidays, and time zone of the SGX Nikkei 225 Index Futures (NK) contract in the SGX Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the SGX Nikkei 225 Index Futures contract in the SGX Future market:

Weekday Time (Asia/Singapore)
Monday 07:15:00 to 14:30:00, 14:45:00 to 24:00:00
Tuesday 00:00:00 to 05:15:00, 07:15:00 to 14:30:00, 14:45:00 to 24:00:00
Wednesday 00:00:00 to 05:15:00, 07:15:00 to 14:30:00, 14:45:00 to 24:00:00
Thursday 00:00:00 to 05:15:00, 07:15:00 to 14:30:00, 14:45:00 to 24:00:00
Friday 00:00:00 to 05:15:00, 07:15:00 to 14:30:00, 14:45:00 to 24:00:00
Saturday 00:00:00 to 05:15:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the SGX Nikkei 225 Index Futures contract in the SGX Future market:

Date ( yyyy-mm-dd )
2016-01-01 2016-02-08 2016-02-09 2016-03-25 2016-05-01
2016-05-21 2016-07-06 2016-08-09 2016-09-12 2016-10-29
2016-12-25 2017-01-01 2017-01-28 2017-01-29 2017-04-14
2017-05-01 2017-05-10 2017-06-25 2017-08-09 2017-09-01
2017-10-18 2017-12-25 2018-01-01 2018-02-16 2018-02-17
2018-03-30 2018-05-01 2018-05-29 2018-06-15 2018-08-09
2018-08-22 2018-11-06 2018-12-25 2019-01-01 2019-02-05
2019-02-06 2019-04-19 2019-05-01 2019-05-20 2019-06-05
2019-08-09 2019-08-12 2019-10-28 2019-12-25 2020-01-01
2020-01-27 2020-04-10 2020-05-01 2020-05-07 2020-05-25
2020-07-31 2020-08-10 2020-11-14 2020-12-25 2021-01-01
2021-02-12 2021-04-02 2021-05-01 2021-08-09 2021-12-25
2022-01-03 2022-01-31 2022-02-01 2022-02-02 2022-04-15
2022-05-02 2022-08-09 2022-12-26 2022-12-31

Early Closes

The following table shows the early closes for the SGX Nikkei 225 Index Futures contract in the SGX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (Asia/Singapore)
2018-02-15 12:00:00
2018-12-24 12:00:00
2018-12-31 12:00:00
2019-04-02 12:00:00
2019-12-24 12:00:00
2019-12-31 12:00:00
2020-01-24 12:00:00
2020-12-24 12:00:00
2020-12-31 12:00:00
2021-02-11 12:00:00
2021-12-24 12:00:00
2021-12-31 12:00:00
2022-01-31 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The SGX Nikkei 225 Index Futures contract in the SGX Future market trades in the Asia/Singapore time zone.

 

3.7.7.3.10.3 TW

Introduction

This page shows the trading hours, holidays, and time zone of the MSCI Taiwan Index Futures (TW) contract in the SGX Future market.

Pre Market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the MSCI Taiwan Index Futures contract in the SGX Future market:

Weekday Time (Asia/Singapore)
Monday 08:30:00 to 13:50:00, 14:05:00 to 24:00:00
Tuesday 00:00:00 to 05:15:00, 08:30:00 to 13:50:00, 14:05:00 to 24:00:00
Wednesday 00:00:00 to 05:15:00, 08:30:00 to 13:50:00, 14:05:00 to 24:00:00
Thursday 00:00:00 to 05:15:00, 08:30:00 to 13:50:00, 14:05:00 to 24:00:00
Friday 00:00:00 to 05:15:00, 08:30:00 to 13:50:00, 14:05:00 to 24:00:00
Saturday 00:00:00 to 05:15:00

Post Market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the MSCI Taiwan Index Futures contract in the SGX Future market:

Date ( yyyy-mm-dd )
2016-01-01 2016-02-08 2016-02-09 2016-03-25 2016-05-01
2016-05-21 2016-07-06 2016-08-09 2016-09-12 2016-10-29
2016-12-25 2017-01-01 2017-01-28 2017-01-29 2017-04-14
2017-05-01 2017-05-10 2017-06-25 2017-08-09 2017-09-01
2017-10-18 2017-12-25 2018-01-01 2018-02-16 2018-02-17
2018-03-30 2018-05-01 2018-05-29 2018-06-15 2018-08-09
2018-08-22 2018-11-06 2018-12-25 2019-01-01 2019-02-05
2019-02-06 2019-04-19 2019-05-01 2019-05-20 2019-06-05
2019-08-09 2019-08-12 2019-10-28 2019-12-25 2020-01-01
2020-01-27 2020-04-10 2020-05-01 2020-05-07 2020-05-25
2020-07-31 2020-08-10 2020-11-14 2020-12-25 2021-01-01
2021-02-12 2021-04-02 2021-05-01 2021-08-09 2021-12-25
2022-01-03 2022-01-31 2022-02-01 2022-02-02 2022-04-15
2022-05-02 2022-08-09 2022-12-26 2022-12-31

Early Closes

The following table shows the early closes for the MSCI Taiwan Index Futures contract in the SGX Future market:

Date ( yyyy-mm-dd ) Time Of Market Close (Asia/Singapore)
2018-02-15 12:00:00
2018-12-24 12:00:00
2018-12-31 12:00:00
2019-04-02 12:00:00
2019-12-24 12:00:00
2019-12-31 12:00:00
2020-01-24 12:00:00
2020-12-24 12:00:00
2020-12-31 12:00:00
2021-02-11 12:00:00
2021-12-24 12:00:00
2021-12-31 12:00:00
2022-01-31 12:00:00

Late Opens

There are no days with late opens.

Time Zone

The MSCI Taiwan Index Futures contract in the SGX Future market trades in the Asia/Singapore time zone.

 

3.7.7.3.11 SGX

3.7.8 Future Options

Future Option contracts give the buyer a window of opportunity to buy or sell the underlying Future contract at a specific price.

See Also

BasicTemplateFutureOptionAlgorithm.py
BasicTemplateFutureOptionAlgorithm.cs

 

3.7.8.1 Requesting Data

Introduction

Request Future Options data in your algorithm to receive a feed of contract prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Future Options dataset listing . To trade Future Options live, you can use our Future Options data feed or one of the brokerage data feeds . We currently only support American-style Options for Future Options.

Create Subscriptions

Before you can subscribe to a Future Option contract, you may configure the underlying volatility model and you must get the contract Symbol .

Configure the Underlying Volatility Model

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Get Contract Symbols

To subscribe to a Future Option contract, you need the contract Symbol . You can get the contract Symbol from the CreateOption method or from the OptionChainProvider . If you use the CreateOption method, you need to provide the contract details.

_futureContractSymbol = QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini,
    Market.CME, new DateTime(2022, 6, 17));
_optionContractSymbol = QuantConnect.Symbol.CreateOption(_futureContractSymbol,
    Market.CME, OptionStyle.American, OptionRight.Call, 3600, new DateTime(2022, 6, 17))
self.future_contract_symbol = Symbol.CreateFuture(Futures.Indices.SP500EMini,
    Market.CME, datetime(2022, 6, 17))
self.option_contract_symbol = Symbol.CreateOption(self.future_contract_symbol,
    Market.CME, OptionStyle.American, OptionRight.Call, 3600, datetime(2022, 6, 17))

Another way to get a Future Option contract Symbol is to use the OptionChainProvider . The GetOptionContractList method of OptionChainProvider returns a list of Symbol objects that reference the available Option contracts for a given underlying Future contract on a given date. The Symbol you pass to the method can reference any of the following Futures contracts:

To filter and select contracts that the GetOptionContractList method returns, you can use the following properties of each Symbol object:

Property Description
ID.Date The expiration date of the contract.
ID.StrikePrice The strike price of the contract.
ID.OptionRight The contract type. The OptionRight enumeration has the following members:
ID.OptionStyle The contract style. The OptionStyle enumeration has the following members:
We currently only support American-style Options for Future Options.
var optionContractSymbols = OptionChainProvider.GetOptionContractList(_futureContractSymbol, Time);
var expiry = optionContractSymbols.Select(symbol => symbol.ID.Date).Min();
var filteredSymbols = optionContractSymbols.Where(symbol => symbol.ID.Date == expiry && symbol.ID.OptionRight == OptionRight.Call);
_optionContractSymbol = filteredSymbols.OrderByDescending(symbol => symbol.ID.StrikePrice).Last();
option_contract_symbols = self.OptionChainProvider.GetOptionContractList(self.future_contract_symbol, self.Time)
expiry = min([symbol.ID.Date for symbol in option_contract_symbols])
filtered_symbols = [symbol for symbol in option_contract_symbols if symbol.ID.Date == expiry and symbol.ID.OptionRight == OptionRight.Call]
self.option_contract_symbol = sorted(filtered_symbols, key=lambda symbol: symbol.ID.StrikePrice)[0]

Subscribe to Contracts

To create a Future Option contract subscription, pass the contract Symbol to the AddFutureOptionContract method. Save a reference to the contract Symbol so you can easily access the Option contract in the OptionChain that LEAN passes to the OnData method. To override the default pricing model of the Option, set a pricing model .

var option = AddFutureOptionContract(_optionContractSymbol);
option.PriceModel = OptionPriceModels.BjerksundStensland();
option = self.AddFutureOptionContract(self.option_contract_symbol)
option.PriceModel = OptionPriceModels.BjerksundStensland()

The AddFutureOptionContract method creates a subscription for a single Option contract and adds it to your user-defined universe. To create a dynamic universe of Future Option contracts, add a Future Options universe .

Warm Up Contract Prices

If you subscribe to a Future Option contract with AddFutureOptionContract , you'll need to wait until the next Slice to receive data and trade the contract. To trade the contract in the same time step you subscribe to the contract, set the current price of the contract in a security initializer .

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, seeder, this));
seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, seeder, self))

Supported Assets

To view the supported assets in the US Future Options dataset, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for Future Option contract subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick

Second

Minute green check green check
Hour green check green check
Daily green check green check

There is only one resolution option, so you don't need to pass a resolution argument to the AddFutureOptionContract method.

AddFutureOptionContract(_optionContractSymbol, Resolution.Minute);
self.AddFutureOptionContract(self.option_contract_symbol, Resolution.Minute)

To create custom resolution periods, see Consolidating Data .

Supported Markets

The following Market enumeration members are available for Future Options:

You don't need to pass a Market argument to the AddFutureOptionContract method because the contract Symbol already contains the market.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddFutureOptionContract(_optionContractSymbol, fillForward: false);
self.AddFutureOptionContract(self.option_contract_symbol, fillForward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. Future Options are already leveraged products, so you can't change their leverage.

Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours argument when you create the security subscription.

AddFutureOptionContract(_optionContractSymbol, extendedMarketHours: true);
self.AddFutureOptionContract(self.option_contract_symbol, extendedMarketHours=True)

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see Market Hours .

Remove Subscriptions

To remove a contract subscription that you created with AddFutureOptionContract , call the RemoveOptionContract method. This method is an alias for RemoveSecurity .

RemoveOptionContract(_optionContractSymbol);
self.RemoveOptionContract(self.option_contract_symbol)

The RemoveOptionContract method cancels your open orders for the contract and liquidates your holdings.

Properties

The AddFutureOptionContract method returns an Option object, which have the following properties:

 

3.7.8.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the Futures Option contract ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the Option contract Symbol . If the Option contract doesn't actively trade or you are in the same time step as when you added the Option contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your Option contract before you index the Slice with the Option contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_optionContractSymbol))
    {
        var tradeBar = slice.Bars[_optionContractSymbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_optionContractSymbol))
    {
        var tradeBar = tradeBars[_optionContractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.option_contract_symbol in slice.Bars:
        trade_bar = slice.Bars[self.option_contract_symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the Option contract Symbol . If the Option contract doesn't actively get quotes or you are in the same time step as when you added the Option contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your Option contract before you index the Slice with the Option contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_optionContractSymbol))
    {
        var quoteBar = slice.QuoteBars[_optionContractSymbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_optionContractSymbol))
    {
        var quoteBar = quoteBars[_optionContractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.option_contract_symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.option_contract_symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Futures Chains

FuturesChain objects represent an entire chain of contracts for a single underlying Future. They have the following properties:

To get the FuturesChain , index the FuturesChains property of the Slice with the continuous contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_futureContractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.future_contract_symbol.Canonical)
    if chain:
        contracts = chain.Contracts

You can also loop through the FuturesChains property to get each FuturesChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(FuturesChains futuresChains)
{
    foreach (var kvp in futuresChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for continuous_contract_symbol, chain in slice.FuturesChains.items():
        contracts = chain.Contracts

Futures Contracts

FuturesContract objects represent the data of a single Futures contract in the market. They have the following properties:

To get the Futures contracts in the Slice , use the Contracts property of the FuturesChain .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_futureContractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_futureContractSymbol, out var contract))
        {
            var price = contract.LastPrice;
        }
    }
}

public void OnData(FuturesChains futuresChains)
{
    if (futuresChains.TryGetValue(_futureContractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_futureContractSymbol, out var contract))
        {
            var price = contract.LastPrice;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.future_contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.future_contract_symbol)
        if contract:
            price = contract.LastPrice

Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , index the OptionChains property of the Slice with the canonical Symbol .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_optionContractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_optionContractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.option_contract_symbol.Canonical)
    if chain:
        contracts = chain.Contracts

You can also loop through the OptionChains property to get each OptionChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalFOPSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var canonicalFOPSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for canonical_fop_symbol, chain in slice.OptionChains.items():
        contracts = chain.Contracts

Option Contracts

OptionContract objects represent the data of a single Option contract in the market. They have the following properties:

To get the Option contracts in the Slice , use the Contracts property of the OptionChain .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_optionContractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_optionContractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_optionContractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_optionContractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.option_contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.option_contract_symbol)
        if contract:
            price = contract.Price

You can also iterate through the FuturesChains first.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var futuresChain = kvp.Value;
        
        // Select a Future Contract and create its canonical FOP Symbol
        var futuresContract = futuresChain.First();
        var canonicalFOPSymbol = QuantConnect.Symbol.CreateCanonicalOption(futuresContract.Symbol);
        if (slice.OptionChains.TryGetValue(canonicalFOPSymbol, out var optionChain))
        {
            if (optionChain.Contracts.TryGetValue(_optionContractSymbol, out var optionContract))
            {
                var price = optionContract.Price;
            }
        }
    }
}

public void OnData(FuturesChains futuresChains)
{
    foreach (var kvp in futuresChains)
    {
        var continuousContractSymbol = kvp.Key;
        var futuresChain = kvp.Value;
        
        // Select a Future Contract and create its canonical FOP Symbol
        var futuresContract = futuresChain.First();
        var canonicalFOPSymbol = QuantConnect.Symbol.CreateCanonicalOption(futuresContract.Symbol);
        if (slice.OptionChains.TryGetValue(canonicalFOPSymbol, out var optionChain))
        {
            if (optionChain.Contracts.TryGetValue(_optionContractSymbol, out var optionContract))
            {
                var price = optionContract.Price;
            }
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for continuous_future_symbol, futures_chain in slice.FuturesChains.items():
        # Select a Future Contract and create its canonical FOP Symbol
        futures_contract = [contract for contract in futures_chain][0]
        canonical_fop_symbol = Symbol.CreateCanonicalOption(futures_contract.Symbol)
        option_chain = slice.OptionChains.get(canonical_fop_symbol)
        if option_chain:
            option_contract = option_chain.Contracts.get(self.option_contract_symbol)
            if option_contract:
                price = option_contract.Price

Greeks and Implied Volatility

To get the Greeks and implied volatility of an Option contract, use the Greeks and ImpliedVolatility members.

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_optionContractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_optionContractSymbol, out var contract))
        {
            var delta = contract.Greeks.Delta;
            var iv = contract.ImpliedVolatility;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.option_contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.option_contract_symbol)
        if contract:
            delta = contract.Greeks.Delta
            iv = contract.ImpliedVolatility

LEAN only calculates Greeks and implied volatility when you request them because they are expensive operations. If you invoke the Greeks member, the Greeks aren't calculated. However, if you invoke the Greeks.Delta member, LEAN calculates the delta. To avoid unecessary computation in your algorithm, only request the Greeks and implied volatility when you need them. For more information about the Greeks and implied volatility, see Options Pricing .

Open Interest

Open interest is the number of outstanding contracts that haven't been settled. It provides a measure of investor interest and the market liquidity, so it's a popular metric to use for contract selection. Open interest is calculated once per day. To get the latest open interest value, use the OpenInterest property of the Option or OptionContract .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            open_interest = contract.OpenInterest

 

3.7.8.3 Market Hours

Introduction

The Future Option markets have the same hours as the Futures market. For more information, see the supported contracts and the market hours of Future markets .

 

3.7.9 Index

There are cash Indices and volatility Indices. The former is a hypothetical portfolio that represents a segment of the financial market and the latter shows the expected level of price fluctuation in an Index Option.

See Also

BasicTemplateIndexAlgorithm.py
BasicTemplateIndexAlgorithm.cs

 

3.7.9.1 Requesting Data

Introduction

Request Index data in your algorithm to receive a feed of Index prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Cash Indices dataset listing . To trade live with Index data, you can use one of the brokerage data feeds .

Create Subscriptions

To create an Index subscription, in the Initialize method, call the AddIndex method. The AddIndex method returns an Index object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the Index data in the Slice .

_symbol = AddIndex("VIX").Symbol;
self.symbol = self.AddIndex("VIX").Symbol

To view the supported assets in the US Cash Indices dataset, see the Supported Indices .

Resolutions

The following table shows the available resolutions and data formats for Index subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check
Second green check
Minute green check
Hour green check
Daily green check

The default resolution for Index subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddIndex method.

_symbol = AddIndex("VIX", Resolution.Daily).Symbol;
self.symbol = self.AddIndex("VIX", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

The only market available for Indices is Market.USA , so you don't need to pass a market argument to the AddIndex method.

_symbol = AddIndex("VIX", market: Market.USA).Symbol;
self.symbol = self.AddIndex("VIX", market=Market.USA).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddIndex("VIX", fillForward: false).Symbol;
self.symbol = self.AddIndex("VIX", fillForward=False).Symbol

Properties

The AddIndex method returns an Index object, which have the following properties:

 

3.7.9.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a Tick argument, it only receives Tick objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the Ticks DataDictionary is made up of Tick objects. To access individual data points in the dictionary, you can index the dictionary with the Index ticker or Symbol , but we recommend you use the Symbol .

Bars

You can't trade Indices, but TradeBar objects are bars that represent the open, high, low, and close of an Index price over a period of time.

Trade bar breakdown

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the Index Symbol . The Slice may not contain data for your Symbol at every time step. To avoid issues, check if the Slice contains data for your Index before you index the Slice with the Index Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        var value = tradeBar.Value;
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_symbol))
    {
        var tradeBar = tradeBars[_symbol];
        var value = tradeBar.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        value = trade_bar.Value

Ticks

Tick objects represent a price for the Index at a moment in time. Tick objects have the following properties:

Index ticks have a non-zero value for the Price property, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . The Slice may not contain data for your Symbol at every time step. To avoid issues, check if the Slice contains data for your Index before you index the Slice with the Index Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var value = tick.Value;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var value = tick.Value;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            value = tick.Value

 

3.7.9.3 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the US Indices market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Indices market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:20:00
Tuesday 08:30:00 to 15:20:00
Wednesday 08:30:00 to 15:20:00
Thursday 08:30:00 to 15:20:00
Friday 08:30:00 to 15:20:00

Post-market Hours

Post-market trading is not available.

Holidays

LEAN uses the trading holidays from the NYSE website.

The following table shows the dates of holidays for the US Indices market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

The following table shows the early closes for the US Indices market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
1999-11-26 13:00:00
2000-07-03 13:00:00
2000-11-24 13:00:00
2001-07-03 13:00:00
2001-11-23 13:00:00
2001-12-24 13:00:00
2002-07-05 13:00:00
2002-11-29 13:00:00
2002-12-24 13:00:00
2003-07-03 13:00:00
2003-11-28 13:00:00
2003-12-24 13:00:00
2003-12-26 13:00:00
2004-11-26 13:00:00
2005-11-25 13:00:00
2006-07-03 13:00:00
2006-11-24 13:00:00
2007-07-03 13:00:00
2007-11-23 13:00:00
2007-12-24 13:00:00
2008-07-03 13:00:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-07-03 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-07-03 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-07-03 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:00:00
2016-11-25 13:00:00
2017-07-03 13:00:00
2017-11-24 13:00:00
2017-12-24 13:00:00
2018-07-03 13:00:00
2018-11-23 13:00:00
2018-12-24 13:00:00
2019-07-03 13:00:00
2019-11-29 13:00:00
2019-12-24 13:00:00
2020-11-27 13:00:00
2020-12-24 13:00:00
2021-11-26 13:00:00
2022-11-25 13:00:00

Late Opens

There are no days with late opens.

Time Zone

The US Indices market trades in the following time zones:

Assets With Other Hours

The following table shows the indices that have different trading periods than the overall US Indices market.

Symbol Index
NDX Nasdaq 100 Index
SPX S&P 500 Index
VIX CBOE Volatility Index

 

3.7.9.3.1 NDX

Introduction

This page shows the trading hours, holidays, and time zone of the Nasdaq 100 Index market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Nasdaq 100 Index market:

Weekday Time (America/New York)
Monday 09:30:00 to 16:00:00
Tuesday 09:30:00 to 16:00:00
Wednesday 09:30:00 to 16:00:00
Thursday 09:30:00 to 16:00:00
Friday 09:30:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Nasdaq 100 Index market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Nasdaq 100 Index market trades in the America/New York time zone.

 

3.7.9.3.2 SPX

Introduction

This page shows the trading hours, holidays, and time zone of the S&P 500 Index market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the S&P 500 Index market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:00:00
Tuesday 08:30:00 to 15:00:00
Wednesday 08:30:00 to 15:00:00
Thursday 08:30:00 to 15:00:00
Friday 08:30:00 to 15:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the S&P 500 Index market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The S&P 500 Index market trades in the America/Chicago time zone.

 

3.7.9.3.3 VIX

Introduction

This page shows the trading hours, holidays, and time zone of the CBOE Volatility Index market.

Pre-market Hours

The following table shows the pre-market hours for the CBOE Volatility Index market:

Weekday Time (America/Chicago)
Monday 02:15:00 to 08:15:00
Tuesday 02:15:00 to 08:15:00
Wednesday 02:15:00 to 08:15:00
Thursday 02:15:00 to 08:15:00
Friday 02:15:00 to 08:15:00

Regular Trading Hours

The following table shows the regular trading hours for the CBOE Volatility Index market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:15:00
Tuesday 08:30:00 to 15:15:00
Wednesday 08:30:00 to 15:15:00
Thursday 08:30:00 to 15:15:00
Friday 08:30:00 to 15:15:00

Post-market Hours

The following table shows the post-market hours for the CBOE Volatility Index market:

Weekday Time (America/Chicago)
Monday 15:15:00 to 16:00:00
Tuesday 15:15:00 to 16:00:00
Wednesday 15:15:00 to 16:00:00
Thursday 15:15:00 to 16:00:00
Friday 15:15:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the CBOE Volatility Index market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The CBOE Volatility Index market trades in the America/Chicago time zone.

 

3.7.10 Index Options

Index Options are a financial derivative that gives the holder the right (but not the obligation) to buy or sell the value of an underlying Index, such as the S&P 500 index, at the stated exercise price. No actual assets are bought or sold.

See Also

BasicTemplateIndexOptionsAlgorithm.py
BasicTemplateIndexOptionsAlgorithm.cs

 

3.7.10.1 Requesting Data

Introduction

Request Index Options data in your algorithm to receive a feed of contract prices in the OnData method. For more information about the specific dataset we use for backtests, see the US Index Options dataset listing . To trade Index Options live, you can use one of the brokerage data feeds . We currently only support European-style Options for Index Options.

Create Subscriptions

Before you can subscribe to an Index Option contract, you must configure the underlying Index and get the contract Symbol .

Configure the Underlying Index

In the Initialize method, subscribe to the underlying Index .

_symbol = AddIndex("SPX").Symbol;
self.symbol = self.AddIndex("SPX").Symbol

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Get Contract Symbols

To get Index Option contract Symbol objects, call the CreateOption method or use the OptionChainProvider . If you use the CreateOption method, you need to know the specific contract details.

_symbol = QuantConnect.Symbol.Create("SPX", SecurityType.Index, Market.USA);

// Standard contracts
_contractSymbol = QuantConnect.Symbol.CreateOption(_symbol, Market.USA,
    OptionStyle.European, OptionRight.Call, 3650, new DateTime(2022, 6, 17));

// Weekly contracts
_weeklyContractSymbol = QuantConnect.Symbol.CreateOption(_symbol, "SPXW", Market.USA,
    OptionStyle.European, OptionRight.Call, 3650, new DateTime(2022, 6, 17));
self.symbol = Symbol.Create("SPX", SecurityType.Index, Market.USA)

# Standard contracts
self.contract_symbol = Symbol.CreateOption(self.symbol, Market.USA,
    OptionStyle.European, OptionRight.Call, 3650, datetime(2022, 6, 17))

# Weekly contracts
self.weekly_contract_symbol = Symbol.CreateOption(self.symbol, "SPXW", Market.USA,
    OptionStyle.European, OptionRight.Call, 3650, datetime(2022, 6, 17))

Another way to get an Index Option contract Symbol is to use the OptionChainProvider . The GetOptionContractList method of OptionChainProvider returns a list of Symbol objects that reference the available Option contracts for a given underlying Index on a given date. To filter and select contracts, you can use the following properties of each Symbol object:

Property Description
ID.Date The expiration date of the contract.
ID.StrikePrice The strike price of the contract.
ID.OptionRight The contract type. The OptionRight enumeration has the following members:
ID.OptionStyle The contract style. The OptionStyle enumeration has the following members:
We currently only support European-style Options for Index Options.
// Standard contracts
_canonicalSymbol = QuantConnect.Symbol.CreateCanonicalOption(_symbol, Market.USA, "?SPX");
var contractSymbols = OptionChainProvider.GetOptionContractList(_canonicalSymbol, Time);
var expiry = contractSymbols.Select(symbol => symbol.ID.Date).Min();
var filteredSymbols = contractSymbols.Where(symbol => symbol.ID.Date == expiry && symbol.ID.OptionRight == OptionRight.Call);
_contractSymbol = filteredSymbols.OrderByDescending(symbol => symbol.ID.StrikePrice).Last();

// Weekly contracts
_weeklyCanonicalSymbol = QuantConnect.Symbol.CreateCanonicalOption(_symbol, "SPXW", Market.USA, "?SPXW");
var weeklyContractSymbols = OptionChainProvider.GetOptionContractList(_weeklyCanonicalSymbol, Time)
    .Where(symbol => OptionSymbol.IsWeekly(symbol));
var weeklyExpiry = weeklyContractSymbols.Select(symbol => symbol.ID.Date).Min();
filteredSymbols = contractSymbols.Where(symbol => symbol.ID.Date == weeklyExpiry && symbol.ID.OptionRight == OptionRight.Call);
_weeklyContractSymbol = filteredSymbols.OrderByDescending(symbol => symbol.ID.StrikePrice).Last();
# Standard contracts
self.canonical_symbol = Symbol.CreateCanonicalOption(self.symbol, Market.USA, "?SPX")       
contract_symbols = self.OptionChainProvider.GetOptionContractList(self.canonical_symbol, self.Time)
expiry = min([symbol.ID.Date for symbol in contract_symbols])
filtered_symbols = [symbol for symbol in contract_symbols if symbol.ID.Date == expiry and symbol.ID.OptionRight == OptionRight.Call]
self.contract_symbol = sorted(filtered_symbols, key=lambda symbol: symbol.ID.StrikePrice)[0]

# Weekly contracts
self.weekly_canonical_symbol = Symbol.CreateCanonicalOption(self.symbol, "SPXW", Market.USA, "?SPXW")
weekly_contract_symbols = self.OptionChainProvider.GetOptionContractList(self.weekly_canonical_symbol, self.Time)
weekly_contract_symbols = [symbol for symbol in weekly_contract_symbols if OptionSymbol.IsWeekly(symbol)]
weekly_expiry = min([symbol.ID.Date for symbol in weekly_contract_symbols])
weekly_filtered_symbols = [symbol for symbol in weekly_contract_symbols if symbol.ID.Date == weekly_expiry and symbol.ID.OptionRight == OptionRight.Call]
self.weekly_contract_symbol = sorted(weekly_filtered_symbols, key=lambda symbol: symbol.ID.StrikePrice)[0]

Subscribe to Contracts

To create an Index Option contract subscription, pass the contract Symbol to the AddIndexOptionContract method. Save a reference to the contract Symbol so you can easily access the contract in the OptionChain that LEAN passes to the OnData method. To override the default pricing model of the Option, set a pricing model .

var option = AddIndexOptionContract(_contractSymbol);
option.PriceModel = OptionPriceModels.BlackScholes();
option = self.AddIndexOptionContract(self.contract_symbol)
option.PriceModel = OptionPriceModels.BlackScholes()

The AddIndexOptionContract method creates a subscription for a single Index Option contract and adds it to your user-defined universe. To create a dynamic universe of Index Option contracts, add an Index Option universe .

Warm Up Contract Prices

If you subscribe to an Index Option contract with AddIndexOptionContract , you'll need to wait until the next Slice to receive data and trade the contract. To trade the contract in the same time step you subscribe to the contract, set the current price of the contract in a security initializer .

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, seeder, this));
seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, seeder, self))

Supported Assets

To view the supported assets in the US Index Options dataset, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for Index Option contract subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick

Second

Minute green check green check
Hour green check green check
Daily green check green check

The default resolution for Index Option subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddIndexOptionContract method.

AddIndexOptionContract(_contractSymbol, Resolution.Hour);
self.AddIndexOptionContract(self.contract_symbol, Resolution.Hour)

To create custom resolution periods, see Consolidating Data .

Supported Markets

The following Market enumeration members are available for Index Options:

You don't need to pass a Market argument to the AddIndexOptionContract method because the contract Symbol already contains the market.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

AddIndexOptionContract(_contractSymbol, fillForward: false);
self.AddIndexOptionContract(self.contract_symbol, fillForward=False)

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. Options are already leveraged products, so you can't change their leverage.

Remove Subscriptions

To remove a contract subscription that you created with AddIndexOptionContract , call the RemoveOptionContract method. This method is an alias for RemoveSecurity .

RemoveOptionContract(_contractSymbol);
self.RemoveOptionContract(self.contract_symbol)

The RemoveOptionContract method cancels your open orders for the contract and liquidates your holdings.

Properties

The AddIndexOptionContract method returns an Option object, which have the following properties:

 

3.7.10.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a TradeBar argument, it only receives TradeBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the TradeBars DataDictionary is made up of TradeBar objects. To access individual data points in the dictionary, you can index the dictionary with the contract ticker or Symbol , but we recommend you use the Symbol .

Trades

TradeBar objects are price bars that consolidate individual trades from the exchanges. They contain the open, high, low, close, and volume of trading activity over a period of time.

Tradebar decomposition

TradeBar objects have the following properties:

To get the TradeBar objects in the Slice , index the Slice or index the Bars property of the Slice with the contract Symbol . If the contract doesn't actively trade or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_contractSymbol))
    {
        var tradeBar = slice.Bars[_contractSymbol];
    }
}

public void OnData(TradeBars tradeBars)
{
    if (tradeBars.ContainsKey(_contractSymbol))
    {
        var tradeBar = tradeBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.Bars:
        trade_bar = slice.Bars[self.contract_symbol]

You can also iterate through the TradeBars dictionary. The keys of the dictionary are the Symbol objects and the values are the TradeBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}

public void OnData(TradeBars tradeBars)
{
    foreach (var kvp in tradeBars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        var closePrice = tradeBar.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        close_price = trade_bar.Close

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the contract Symbol . If the contract doesn't actively get quotes or you are in the same time step as when you added the contract subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your contract before you index the Slice with the contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = slice.QuoteBars[_contractSymbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_contractSymbol))
    {
        var quoteBar = quoteBars[_contractSymbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.contract_symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.contract_symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , index the OptionChains property of the Slice with the canonical Symbol .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contracts = chain.Contracts

You can also loop through the OptionChains property to get each OptionChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        contracts = chain.Contracts

Option Contracts

OptionContract objects represent the data of a single Option contract in the market. They have the following properties:

To get the Option contracts in the Slice , use the Contracts property of the OptionChain .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var price = contract.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            price = contract.Price

Greeks and Implied Volatility

To get the Greeks and implied volatility of an Option contract, use the Greeks and ImpliedVolatility members.

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var delta = contract.Greeks.Delta;
            var iv = contract.ImpliedVolatility;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            delta = contract.Greeks.Delta
            iv = contract.ImpliedVolatility

LEAN only calculates Greeks and implied volatility when you request them because they are expensive operations. If you invoke the Greeks member, the Greeks aren't calculated. However, if you invoke the Greeks.Delta member, LEAN calculates the delta. To avoid unecessary computation in your algorithm, only request the Greeks and implied volatility when you need them. For more information about the Greeks and implied volatility, see Options Pricing .

Open Interest

Open interest is the number of outstanding contracts that haven't been settled. It provides a measure of investor interest and the market liquidity, so it's a popular metric to use for contract selection. Open interest is calculated once per day. To get the latest open interest value, use the OpenInterest property of the Option or OptionContract .

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_contractSymbol.Canonical, out var chain))
    {
        if (chain.Contracts.TryGetValue(_contractSymbol, out var contract))
        {
            var openInterest = contract.OpenInterest;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.contract_symbol.Canonical)
    if chain:
        contract = chain.Contracts.get(self.contract_symbol)
        if contract:
            open_interest = contract.OpenInterest

 

3.7.10.3 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the US Index Option market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Index Option market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:20:00
Tuesday 08:30:00 to 15:20:00
Wednesday 08:30:00 to 15:20:00
Thursday 08:30:00 to 15:20:00
Friday 08:30:00 to 15:20:00

Post-market Hours

Post-market trading is not available.

Holidays

LEAN uses the trading holidays from the NYSE website.

The following table shows the dates of holidays for the US Index Option market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

The following table shows the early closes for the US Index Option market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
1999-11-26 13:00:00
2000-07-03 13:00:00
2000-11-24 13:00:00
2001-07-03 13:00:00
2001-11-23 13:00:00
2001-12-24 13:00:00
2002-07-05 13:00:00
2002-11-29 13:00:00
2002-12-24 13:00:00
2003-07-03 13:00:00
2003-11-28 13:00:00
2003-12-24 13:00:00
2003-12-26 13:00:00
2004-11-26 13:00:00
2005-11-25 13:00:00
2006-07-03 13:00:00
2006-11-24 13:00:00
2007-07-03 13:00:00
2007-11-23 13:00:00
2007-12-24 13:00:00
2008-07-03 13:00:00
2008-11-28 13:00:00
2008-12-24 13:00:00
2009-11-27 13:00:00
2009-12-24 13:00:00
2010-11-26 13:00:00
2011-11-25 13:00:00
2012-07-03 13:00:00
2012-11-23 13:00:00
2012-12-24 13:00:00
2013-07-03 13:00:00
2013-11-29 13:00:00
2013-12-24 13:00:00
2014-07-03 13:00:00
2014-11-28 13:00:00
2014-12-24 13:00:00
2015-11-27 13:00:00
2015-12-24 13:00:00
2016-11-25 13:00:00
2017-07-03 13:00:00
2017-11-24 13:00:00
2017-12-24 13:00:00
2018-07-03 13:00:00
2018-11-23 13:00:00
2018-12-24 13:00:00
2019-07-03 13:00:00
2019-11-29 13:00:00
2019-12-24 13:00:00
2020-11-27 13:00:00
2020-12-24 13:00:00
2021-11-26 13:00:00
2022-11-25 13:00:00

Late Opens

There are no days with late opens.

Time Zone

The US Index Option market trades in the following time zones:

Assets With Other Hours

The following table shows the contracts that have different trading periods than the overall US Index Option market.

Symbol Name
NDX Nasdaq 100 Index
SPX S&P 500 Index
VIX CBOE Volatility Index

 

3.7.10.3.1 NDX

Introduction

This page shows the trading hours, holidays, and time zone of the Nasdaq 100 Index Option contracts market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Nasdaq 100 Index Option contracts market:

Weekday Time (America/New York)
Monday 09:30:00 to 16:15:00
Tuesday 09:30:00 to 16:15:00
Wednesday 09:30:00 to 16:15:00
Thursday 09:30:00 to 16:15:00
Friday 09:30:00 to 16:15:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Nasdaq 100 Index Option contracts market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Nasdaq 100 Index Option contracts market trades in the America/New York time zone.

 

3.7.10.3.2 SPX

Introduction

This page shows the trading hours, holidays, and time zone of the S&P 500 Index Option contracts market.

Pre-market Hours

The following table shows the pre-market hours for the S&P 500 Index Option contracts market:

Weekday Time (America/Chicago)
Sunday 19:15:00 to 1:00:00:00
Monday 00:00:00 to 08:15:00
Tuesday 00:00:00 to 08:15:00
Wednesday 00:00:00 to 08:15:00
Thursday 00:00:00 to 08:15:00
Friday 00:00:00 to 08:15:00

Regular Trading Hours

The following table shows the regular trading hours for the S&P 500 Index Option contracts market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:15:00
Tuesday 08:30:00 to 15:15:00
Wednesday 08:30:00 to 15:15:00
Thursday 08:30:00 to 15:15:00
Friday 08:30:00 to 15:15:00

Post-market Hours

The following table shows the post-market hours for the S&P 500 Index Option contracts market:

Weekday Time (America/Chicago)
Monday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Tuesday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Wednesday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Thursday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Friday 15:15:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the S&P 500 Index Option contracts market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The S&P 500 Index Option contracts market trades in the America/Chicago time zone.

 

3.7.10.3.3 VIX

Introduction

This page shows the trading hours, holidays, and time zone of the CBOE Volatility Index Option contracts market.

Pre-market Hours

The following table shows the pre-market hours for the CBOE Volatility Index Option contracts market:

Weekday Time (America/Chicago)
Sunday 19:15:00 to 1:00:00:00
Monday 00:00:00 to 08:15:00
Tuesday 00:00:00 to 08:15:00
Wednesday 00:00:00 to 08:15:00
Thursday 00:00:00 to 08:15:00
Friday 00:00:00 to 08:15:00

Regular Trading Hours

The following table shows the regular trading hours for the CBOE Volatility Index Option contracts market:

Weekday Time (America/Chicago)
Monday 08:30:00 to 15:15:00
Tuesday 08:30:00 to 15:15:00
Wednesday 08:30:00 to 15:15:00
Thursday 08:30:00 to 15:15:00
Friday 08:30:00 to 15:15:00

Post-market Hours

The following table shows the post-market hours for the CBOE Volatility Index Option contracts market:

Weekday Time (America/Chicago)
Monday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Tuesday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Wednesday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Thursday 15:15:00 to 16:00:00, 19:15:00 to 1:00:00:00
Friday 15:15:00 to 16:00:00

Holidays

The following table shows the dates of holidays for the CBOE Volatility Index Option contracts market:

Date ( yyyy-mm-dd )
1998-01-01 1998-01-19 1998-02-16 1998-04-10 1998-05-25
1998-07-03 1998-09-07 1998-11-26 1998-12-25 1999-01-01
1999-01-18 1999-02-15 1999-04-02 1999-05-31 1999-07-05
1999-09-06 1999-11-25 1999-12-24 2000-01-17 2000-02-21
2000-04-21 2000-05-29 2000-07-04 2000-09-04 2000-11-23
2000-12-25 2001-01-01 2001-01-15 2001-02-19 2001-04-13
2001-05-28 2001-07-04 2001-09-03 2001-09-11 2001-09-12
2001-09-13 2001-09-14 2001-11-22 2001-12-25 2002-01-01
2002-01-21 2002-02-18 2002-03-29 2002-05-27 2002-07-04
2002-09-02 2002-11-28 2002-12-25 2003-01-01 2003-01-20
2003-02-17 2003-04-18 2003-05-26 2003-07-04 2003-09-01
2003-11-27 2003-12-25 2004-01-01 2004-01-19 2004-02-16
2004-04-09 2004-05-31 2004-06-11 2004-07-05 2004-09-06
2004-11-25 2004-12-24 2005-01-17 2005-02-21 2005-03-25
2005-05-30 2005-07-04 2005-09-05 2005-11-24 2005-12-26
2006-01-02 2006-01-16 2006-02-20 2006-04-14 2006-05-29
2006-07-04 2006-09-04 2006-11-23 2006-12-25 2007-01-01
2007-01-02 2007-01-15 2007-02-19 2007-04-06 2007-05-28
2007-07-04 2007-09-03 2007-11-22 2007-12-25 2008-01-01
2008-01-21 2008-02-18 2008-03-21 2008-05-26 2008-07-04
2008-09-01 2008-11-27 2008-12-25 2009-01-01 2009-01-19
2009-02-16 2009-04-10 2009-05-25 2009-07-03 2009-09-07
2009-11-26 2009-12-25 2010-01-01 2010-01-18 2010-02-15
2010-04-02 2010-05-31 2010-07-05 2010-09-06 2010-11-25
2010-12-24 2011-01-01 2011-01-17 2011-02-21 2011-04-22
2011-05-30 2011-07-04 2011-09-05 2011-11-24 2011-12-26
2012-01-02 2012-01-16 2012-02-20 2012-04-06 2012-05-28
2012-07-04 2012-09-03 2012-10-29 2012-10-30 2012-11-22
2012-12-25 2013-01-01 2013-01-21 2013-02-18 2013-03-29
2013-05-27 2013-07-04 2013-09-02 2013-11-28 2013-12-25
2014-01-01 2014-01-20 2014-02-17 2014-04-18 2014-05-26
2014-07-04 2014-09-01 2014-11-27 2014-12-25 2015-01-01
2015-01-19 2015-02-16 2015-04-03 2015-05-25 2015-07-03
2015-09-07 2015-11-26 2015-12-25 2016-01-01 2016-01-18
2016-02-15 2016-03-25 2016-05-30 2016-07-04 2016-09-05
2016-11-24 2016-12-26 2017-01-02 2017-01-16 2017-02-20
2017-04-14 2017-05-29 2017-07-04 2017-09-04 2017-11-23
2017-12-25 2018-01-01 2018-01-15 2018-02-19 2018-03-30
2018-05-28 2018-07-04 2018-09-03 2018-11-22 2018-12-05
2018-12-25 2019-01-01 2019-01-21 2019-02-18 2019-04-19
2019-05-27 2019-07-04 2019-09-02 2019-11-28 2019-12-25
2020-01-01 2020-01-20 2020-02-17 2020-04-10 2020-05-25
2020-07-03 2020-09-07 2020-11-26 2020-12-25 2021-01-01
2021-01-18 2021-02-15 2021-04-02 2021-05-31 2021-07-05
2021-09-06 2021-11-25 2021-12-24 2022-01-01 2022-01-17
2022-02-21 2022-04-15 2022-05-30 2022-06-20 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02 2023-01-16
2023-02-20 2023-04-07 2023-05-29 2023-06-19 2023-07-04
2023-09-04 2023-11-23 2023-12-25

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The CBOE Volatility Index Option contracts market trades in the America/Chicago time zone.

 

3.7.11 CFD

A contract for difference (CFD) is a contract between a buyer and a seller that stipulates that the buyer must pay the seller the difference between the current value of an asset and its value at contract time.

See Also

BasicTemplateCfdAlgorithm.py
BasicTemplateCfdAlgorithm.cs

 

3.7.11.1 Requesting Data

Introduction

Request Contract for Difference (CFD) data in your algorithm to receive a feed of contract prices in the OnData method. For more information about the specific dataset we use for backtests, see the CFD dataset listing . To trade CFDs live, you can use our CFD data feed .

Create Subscriptions

To create a CFD subscription, in the Initialize method, call the AddCfd method. The AddCfd method returns a Cfd object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

_symbol = AddCfd("XAUUSD").Symbol;
self.symbol = self.AddCfd("XAUUSD").Symbol

To view the supported CFD contracts, see Supported Assets .

Resolutions

The following table shows the available resolutions and data formats for CFD subscriptions:

Resolution TradeBar QuoteBar Trade Tick Quote Tick
Tick green check
Second
green check
Minute
green check
Hour
green check
Daily
green check

The default resolution for CFD subscriptions is Resolution.Minute . To change the resolution, pass a resolution argument to the AddCfd method.

_symbol = AddCfd("XAUUSD", Resolution.Daily).Symbol;
self.symbol = self.AddCfd("XAUUSD", Resolution.Daily).Symbol

To create custom resolution periods, see Consolidating Data .

Supported Markets

The only market available for CFD contracts is Market.Oanda , so you don't need to pass a market argument to the AddCfd method.

_symbol = AddCfd("XAUUSD", market: Market.Oanda).Symbol;
self.symbol = self.AddCfd("XAUUSD", market=Market.Oanda).Symbol

The brokerage models have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

Fill Forward

Fill forward means if there is no data point for the current slice , LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.

To disable fill forward for a security, set the fillForward argument to false when you create the security subscription.

_symbol = AddCfd("XAUUSD", fillForward: false).Symbol;
self.symbol = self.AddCfd("XAUUSD", fillForward=False).Symbol

Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. The Oanda brokerage let's you use up to 50x leverage on margin accounts. To change the amount of leverage you can use for a CFD contract, pass a leverage argument to the AddCfd method.

_symbol = AddCfd("XAUUSD", leverage: 35).Symbol;
self.symbol = self.AddCfd("XAUUSD", leverage=35).Symbol

Properties

The AddCfd method returns a Cfd object, which have the following properties:

 

3.7.11.2 Handling Data

Introduction

LEAN passes the data you request to the OnData method so you can make trading decisions. The default OnData method accepts a Slice object, but you can define additional OnData methods that accept different data types. For example, if you define an OnData method that accepts a QuoteBar argument, it only receives QuoteBar objects. The Slice object that the OnData method receives groups all the data together at a single moment in time. To access the Slice outside of the OnData method, use the CurrentSlice property of your algorithm.

All the data formats use DataDictionary objects to group data by Symbol and provide easy access to information. The plural of the type denotes the collection of objects. For instance, the QuoteBars DataDictionary is made up of QuoteBar objects. To access individual data points in the dictionary, you can index the dictionary with the CFD ticker or Symbol , but we recommend you use the Symbol .

Quotes

QuoteBar objects are bars that consolidate NBBO quotes from the exchanges. They contain the open, high, low, and close prices of the bid and ask. The Open , High , Low , and Close properties of the QuoteBar object are the mean of the respective bid and ask prices. If the bid or ask portion of the QuoteBar has no data, the Open , High , Low , and Close properties of the QuoteBar copy the values of either the Bid or Ask instead of taking their mean.

Quotebar decomposition

QuoteBar objects have the following properties:

To get the QuoteBar objects in the Slice , index the QuoteBars property of the Slice with the CFD Symbol . If the CFD doesn't actively get quotes or you are in the same time step as when you added the CFD subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your CFD before you index the Slice with the CFD Symbol .

public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
    }
}

public void OnData(QuoteBars quoteBars)
{
    if (quoteBars.ContainsKey(_symbol))
    {
        var quoteBar = quoteBars[_symbol];
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]

You can also iterate through the QuoteBars dictionary. The keys of the dictionary are the Symbol objects and the values are the QuoteBar objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}

public void OnData(QuoteBars quoteBars)
{
    foreach (var kvp in quoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        var askPrice = quoteBar.Ask.Close;
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        ask_price = quote_bar.Ask.Close

QuoteBar objects let LEAN incorporate spread costs into your simulated trade fills to make backtest results more realistic.

Ticks

Tick objects represent a single trade or quote at a moment in time. A trade tick is a record of a transaction for the CFD. A quote tick is an offer to buy or sell the CFD at a specific price. Tick objects have the following properties:

Trade ticks have a non-zero value for the Quantity and Price properties, but they have a zero value for the BidPrice , BidSize , AskPrice , and AskSize properties. Quote ticks have non-zero values for BidPrice and BidSize properties or have non-zero values for AskPrice and AskSize properties. To check if a tick is a trade or a quote, use the TickType property.

In backtests, LEAN groups ticks into one millisecond buckets. In live trading, LEAN groups ticks into ~70-millisecond buckets. To get the Tick objects in the Slice , index the Ticks property of the Slice with a Symbol . If the CFD doesn't actively trade or you are in the same time step as when you added the CFD subscription, the Slice may not contain data for your Symbol . To avoid issues, check if the Slice contains data for your CFD before you index the Slice with the CFD Symbol .

public override void OnData(Slice slice)
{
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    if (ticks.ContainsKey(_symbol))
    {
        foreach (var tick in ticks[_symbol])
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            price = tick.Price

You can also iterate through the Ticks dictionary. The keys of the dictionary are the Symbol objects and the values are the List<Tick> list[Tick] objects.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            var price = tick.Price;
        }
    }
}

public void OnData(Ticks ticks)
{
    foreach (var kvp in ticks)
    {
        var symbol = kvp.Key;
        foreach (var tick in kvp.Value)
        {
            var price = tick.Price;
        }
    }
}
def OnData(self, slice: Slice) -> None:
    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            price = tick.Price

Tick data is raw and unfiltered, so it can contain bad ticks that skew your trade results. For example, some ticks come from dark pools, which aren't tradable. We recommend you only use tick data if you understand the risks and are able to perform your own online tick filtering.

 

3.7.11.3 Market Hours

Introduction

This page shows the trading hours, holidays, and time zone of the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the CFD market:

Weekday Time (America/New York)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 24:00:00
Tuesday 00:00:00 to 24:00:00
Wednesday 00:00:00 to 24:00:00
Thursday 00:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the CFD market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

The following table shows the early closes for the CFD market:

Date ( yyyy-mm-dd ) Time Of Market Close (America/New York)
2018-12-31 17:00:00

Late Opens

There are no days with late opens.

Time Zone

The CFD market trades in the following time zones:

Assets With Other Hours

The following table shows the contracts that have different trading periods than the overall CFD market:

Symbol Name
AU200AUD Australia 200
BCOUSD Brent Crude Oil
CH20CHF Swiss 20
CORNUSD Corn
DE10YBEUR Bund
DE30EUR Germany 30
EU50EUR Europe 50
FR40EUR France 40
HK33HKD Hong Kong 33
JP225USD Japan 225
NAS100USD US Nas 100
NATGASUSD Natural Gas
NL25EUR Netherlands 25
SG30SGD Singapore 30
SOYBNUSD Soybeans
SPX500USD US SPX 500
SUGARUSD Sugar
UK100GBP UK 100
UK10YBGBP UK 10Y Gilt
US2000USD US Russ 2000
US30USD US Wall St 30
USB02YUSD US 2Y T-Note
USB05YUSD US 5Y T-Note
USB10YUSD US 10Y T-Note
USB30YUSD US T-Bond
WHEATUSD Wheat
WTICOUSD West Texas Oil
XAGAUD Silver/AUD
XAGCAD Silver/CAD
XAGCHF Silver/CHF
XAGEUR Silver/EUR
XAGGBP Silver/GBP
XAGHKD Silver/HKD
XAGJPY Silver/JPY
XAGNZD Silver/NZD
XAGSGD Silver/SGD
XAGUSD Silver
XAUAUD Gold/AUD
XAUCAD Gold/CAD
XAUCHF Gold/CHF
XAUEUR Gold/EUR
XAUGBP Gold/GBP
XAUHKD Gold/HKD
XAUJPY Gold/JPY
XAUNZD Gold/NZD
XAUSGD Gold/SGD
XAUUSD Gold
XAUXAG Gold/Silver
XCUUSD Copper
XPDUSD Palladium
XPTUSD Platinum

 

3.7.11.3.1 AU200AUD

Introduction

This page shows the trading hours, holidays, and time zone of the Australia 200 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Australia 200 contract in the CFD market:

Weekday Time (Australia/Sydney)
Monday 09:50:00 to 16:30:00, 17:10:00 to 24:00:00
Tuesday 00:00:00 to 08:00:00, 09:50:00 to 16:30:00, 17:10:00 to 24:00:00
Wednesday 00:00:00 to 08:00:00, 09:50:00 to 16:30:00, 17:10:00 to 24:00:00
Thursday 00:00:00 to 08:00:00, 09:50:00 to 16:30:00, 17:10:00 to 24:00:00
Friday 00:00:00 to 08:00:00, 09:50:00 to 16:30:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Australia 200 contract in the CFD market:

Date ( yyyy-mm-dd )
2004-04-09 2004-12-26 2004-12-27 2005-03-25 2005-12-25
2005-12-26 2006-04-14 2006-12-25 2007-01-26 2007-04-06
2007-12-25 2008-03-21 2008-04-25 2008-12-25 2008-12-26
2009-04-10 2009-12-25 2010-01-01 2010-04-02 2010-12-26
2010-12-27 2011-04-22 2011-04-25 2011-12-25 2011-12-26
2011-12-27 2012-01-02 2012-01-26 2012-04-06 2012-04-09
2012-04-25 2012-12-24 2012-12-25 2012-12-31 2013-01-28
2013-03-29 2013-12-25 2014-01-27 2014-04-18 2014-04-25
2014-12-25 2014-12-26 2015-04-03 2015-12-24 2015-12-25
2015-12-31 2016-01-01 2016-03-25 2016-12-23 2016-12-25
2016-12-26 2016-12-30 2017-04-14 2017-12-25 2018-03-30
2018-12-24 2018-12-25 2018-12-31 2019-01-01 2019-01-28
2019-04-19 2019-04-22 2019-04-25 2019-06-10 2019-12-25
2019-12-26 2020-01-01 2020-01-27 2020-04-10 2020-04-13
2020-04-25 2020-06-08 2020-12-25 2020-12-26 2020-12-28
2021-01-01 2021-01-26 2021-04-02 2021-04-05 2021-04-26
2021-06-14 2021-12-25 2021-12-26 2021-12-27 2021-12-28
2022-01-03 2022-01-26 2022-04-15 2022-04-18 2022-04-25
2022-06-13 2022-12-25 2022-12-26 2022-12-27 2023-01-02
2023-01-26 2023-04-07 2023-04-10 2023-04-25 2023-06-12
2023-12-25 2023-12-26 2024-01-01 2024-01-26 2024-03-29
2024-04-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Australia 200 contract in the CFD market trades in the Australia/Sydney time zone.

 

3.7.11.3.2 BCOUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Brent Crude Oil contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Brent Crude Oil contract in the CFD market:

Weekday Time (America/New York)
Sunday 20:00:00 to 24:00:00
Monday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Tuesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Wednesday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Thursday 00:00:00 to 18:00:00, 20:00:00 to 24:00:00
Friday 00:00:00 to 18:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Brent Crude Oil contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2017-12-25 2018-01-01 2018-03-30 2018-12-25
2019-01-01 2019-12-25 2020-01-01 2020-04-10 2020-12-25
2021-01-01 2021-04-02 2022-04-15 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Brent Crude Oil contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.3 CH20CHF

Introduction

This page shows the trading hours, holidays, and time zone of the Swiss 20 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Swiss 20 contract in the CFD market:

Weekday Time (Europe/Zurich)
Monday 08:00:00 to 22:00:00
Tuesday 08:00:00 to 22:00:00
Wednesday 08:00:00 to 22:00:00
Thursday 08:00:00 to 22:00:00
Friday 08:00:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Swiss 20 contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-04-14 2017-04-17 2017-05-01 2017-05-25
2017-06-05 2017-08-01 2017-12-25 2017-12-26 2018-01-01
2018-03-30 2018-04-02 2018-05-01 2018-05-10 2018-05-21
2018-08-01 2018-12-25 2018-12-26 2019-01-01 2019-04-19
2019-04-22 2019-05-01 2019-05-30 2019-06-10 2019-08-01
2019-12-25 2019-12-26 2020-01-01 2020-04-10 2020-04-13
2020-05-01 2020-06-01 2020-12-25 2021-01-01 2021-04-02
2021-04-05 2021-05-13 2021-05-24 2021-12-24 2021-12-31
2022-04-15 2022-04-18 2022-05-26 2022-06-06 2022-08-01
2022-12-26 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Swiss 20 contract in the CFD market trades in the Europe/Zurich time zone.

 

3.7.11.3.4 CORNUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Corn contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Corn contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Tuesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Wednesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Thursday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Friday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Corn contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Corn contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.5 DE10YBEUR

Introduction

This page shows the trading hours, holidays, and time zone of the Bund contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Bund contract in the CFD market:

Weekday Time (Europe/Berlin)
Monday 01:15:00 to 22:00:00
Tuesday 01:15:00 to 22:00:00
Wednesday 01:15:00 to 22:00:00
Thursday 01:15:00 to 22:00:00
Friday 01:15:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Bund contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2017-04-17 2017-05-01 2017-06-05 2017-10-03
2017-10-31 2017-12-25 2017-12-26 2018-01-01 2018-03-30
2018-04-02 2018-05-01 2018-05-21 2018-10-03 2018-10-31
2018-12-25 2018-12-26 2019-01-01 2019-04-19 2019-04-22
2019-05-01 2019-06-10 2019-10-03 2019-10-31 2019-12-25
2019-12-26 2020-01-01 2020-04-10 2020-04-13 2020-05-01
2020-06-01 2020-12-25 2021-01-01 2021-04-02 2021-04-05
2021-05-01 2021-05-24 2021-12-24 2021-12-31 2022-04-15
2022-04-18 2022-05-01 2022-06-06 2022-10-03 2022-10-31
2022-12-26 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Bund contract in the CFD market trades in the Europe/Berlin time zone.

 

3.7.11.3.6 DE30EUR

Introduction

This page shows the trading hours, holidays, and time zone of the Germany 30 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Germany 30 contract in the CFD market:

Weekday Time (Europe/Berlin)
Monday 01:15:00 to 22:00:00
Tuesday 01:15:00 to 22:00:00
Wednesday 01:15:00 to 22:00:00
Thursday 01:15:00 to 22:00:00
Friday 01:15:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Germany 30 contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2017-04-17 2017-05-01 2017-06-05 2017-10-03
2017-10-31 2017-12-25 2017-12-26 2018-01-01 2018-03-30
2018-04-02 2018-05-01 2018-05-21 2018-10-03 2018-10-31
2018-12-25 2018-12-26 2019-01-01 2019-04-19 2019-04-22
2019-05-01 2019-06-10 2019-10-03 2019-10-31 2019-12-25
2019-12-26 2020-01-01 2020-04-10 2020-04-13 2020-05-01
2020-06-01 2020-12-25 2021-01-01 2021-04-02 2021-04-05
2021-05-01 2021-05-24 2021-12-24 2021-12-31 2022-04-15
2022-04-18 2022-05-01 2022-06-06 2022-10-03 2022-10-31
2022-12-26 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Germany 30 contract in the CFD market trades in the Europe/Berlin time zone.

 

3.7.11.3.7 EU50EUR

Introduction

This page shows the trading hours, holidays, and time zone of the Europe 50 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Europe 50 contract in the CFD market:

Weekday Time (Europe/Berlin)
Monday 01:15:00 to 22:00:00
Tuesday 01:15:00 to 22:00:00
Wednesday 01:15:00 to 22:00:00
Thursday 01:15:00 to 22:00:00
Friday 01:15:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Europe 50 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-04-21 2003-05-01 2003-12-25 2003-12-26
2004-01-01 2004-04-09 2004-04-12 2004-12-26 2005-03-25
2005-03-28 2005-05-01 2005-12-25 2005-12-26 2006-01-01
2006-04-14 2006-04-17 2006-05-01 2006-12-25 2006-12-26
2007-01-01 2007-04-06 2007-04-09 2007-05-01 2007-12-25
2007-12-26 2008-01-01 2008-03-21 2008-03-24 2008-05-01
2008-12-25 2008-12-26 2009-01-01 2009-04-10 2009-04-13
2009-05-01 2009-12-25 2010-01-01 2010-04-02 2010-04-05
2010-12-26 2011-04-22 2011-04-25 2011-05-01 2011-12-25
2011-12-26 2012-01-01 2012-04-06 2012-04-09 2012-05-01
2012-12-25 2013-01-01 2013-03-29 2013-04-01 2013-05-01
2013-12-25 2013-12-26 2014-01-01 2014-04-18 2014-04-21
2014-05-01 2014-12-25 2014-12-26 2015-01-01 2015-04-03
2015-04-06 2015-05-01 2015-12-25 2016-01-01 2016-03-25
2016-03-28 2016-05-01 2016-12-25 2016-12-26 2017-01-01
2017-04-14 2017-04-14 2017-04-17 2017-05-01 2017-12-25
2017-12-26 2018-01-01 2018-03-30 2018-04-02 2018-05-01
2018-12-25 2018-12-26 2019-01-01 2019-04-19 2019-04-22
2019-05-01 2019-12-25 2019-12-26 2020-01-01 2020-04-10
2020-04-13 2020-05-01 2020-12-25 2020-12-26 2021-01-01
2021-04-02 2021-04-05 2021-05-01 2021-12-25 2021-12-26
2022-01-01 2022-04-15 2022-04-18 2022-05-01 2022-12-25
2022-12-26 2023-01-01 2023-01-02 2023-04-07 2023-04-10
2023-05-01 2023-12-25 2023-12-26 2024-01-01 2024-03-29
2024-04-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Europe 50 contract in the CFD market trades in the Europe/Berlin time zone.

 

3.7.11.3.8 FR40EUR

Introduction

This page shows the trading hours, holidays, and time zone of the France 40 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the France 40 contract in the CFD market:

Weekday Time (Europe/Paris)
Monday 08:00:00 to 22:00:00
Tuesday 08:00:00 to 22:00:00
Wednesday 08:00:00 to 22:00:00
Thursday 08:00:00 to 22:00:00
Friday 08:00:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the France 40 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-04-21 2003-05-01 2003-12-25 2003-12-26
2004-01-01 2004-04-09 2004-04-12 2004-12-26 2005-03-25
2005-03-28 2005-05-01 2005-12-25 2005-12-26 2006-01-01
2006-04-14 2006-04-17 2006-05-01 2006-12-25 2006-12-26
2007-01-01 2007-04-06 2007-04-09 2007-05-01 2007-12-25
2007-12-26 2008-01-01 2008-03-21 2008-03-24 2008-05-01
2008-12-25 2008-12-26 2009-01-01 2009-04-10 2009-04-13
2009-05-01 2009-12-25 2010-01-01 2010-04-02 2010-04-05
2010-12-26 2011-04-22 2011-04-25 2011-05-01 2011-12-25
2011-12-26 2012-01-01 2012-04-06 2012-04-09 2012-05-01
2012-12-25 2013-01-01 2013-03-29 2013-04-01 2013-05-01
2013-12-25 2013-12-26 2014-01-01 2014-04-18 2014-04-21
2014-05-01 2014-12-25 2014-12-26 2015-01-01 2015-04-03
2015-04-06 2015-05-01 2015-12-25 2016-01-01 2016-03-25
2016-03-28 2016-05-01 2016-12-25 2016-12-26 2017-01-01
2017-04-14 2017-04-17 2017-05-01 2017-12-25 2017-12-26
2018-01-01 2018-03-30 2018-04-02 2018-05-01 2018-12-25
2018-12-26 2019-01-01 2019-04-19 2019-04-22 2019-05-01
2019-12-25 2019-12-26 2020-01-01 2020-04-10 2020-04-13
2020-05-01 2020-12-25 2020-12-26 2021-01-01 2021-04-02
2021-04-05 2021-05-01 2021-12-25 2021-12-26 2022-01-01
2022-04-15 2022-04-18 2022-05-01 2022-12-25 2022-12-26
2023-01-01 2023-01-02 2023-04-07 2023-04-10 2023-05-01
2023-12-25 2023-12-26 2024-01-01 2024-03-29 2024-04-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The France 40 contract in the CFD market trades in the Europe/Paris time zone.

 

3.7.11.3.9 HK33HKD

Introduction

This page shows the trading hours, holidays, and time zone of the Hong Kong 33 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Hong Kong 33 contract in the CFD market:

Weekday Time (Asia/Hong Kong)
Monday 09:15:00 to 12:00:00, 13:00:00 to 16:30:00, 17:15:00 to 24:00:00
Tuesday 00:00:00 to 03:00:00, 09:15:00 to 12:00:00, 13:00:00 to 16:30:00, 17:15:00 to 24:00:00
Wednesday 00:00:00 to 03:00:00, 09:15:00 to 12:00:00, 13:00:00 to 16:30:00, 17:15:00 to 24:00:00
Thursday 00:00:00 to 03:00:00, 09:15:00 to 12:00:00, 13:00:00 to 16:30:00, 17:15:00 to 24:00:00
Friday 00:00:00 to 03:00:00, 09:15:00 to 12:00:00, 13:00:00 to 16:30:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Hong Kong 33 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-01-31 2003-02-02 2003-02-03 2003-04-18 2003-04-21
2003-05-01 2003-05-08 2003-06-04 2003-07-01 2003-09-12
2003-10-01 2003-12-25 2003-12-26 2004-01-01 2004-01-22
2004-01-23 2004-04-05 2004-04-09 2004-04-12 2004-05-26
2004-06-22 2004-07-01 2004-09-29 2004-10-01 2004-10-22
2004-12-26 2004-12-27 2005-02-09 2005-02-10 2005-02-11
2005-03-25 2005-03-28 2005-04-05 2005-05-02 2005-05-16
2005-07-01 2005-09-19 2005-10-11 2005-12-25 2005-12-26
2005-12-27 2006-01-02 2006-01-29 2006-01-30 2006-01-31
2006-04-05 2006-04-14 2006-04-17 2006-05-01 2006-05-05
2006-05-31 2006-10-02 2006-10-30 2006-12-25 2006-12-26
2007-01-01 2007-02-18 2007-02-19 2007-02-20 2007-04-05
2007-04-06 2007-04-09 2007-05-01 2007-05-24 2007-06-19
2007-07-02 2007-09-26 2007-10-01 2007-10-19 2007-12-25
2007-12-26 2008-01-01 2008-02-07 2008-02-08 2008-03-21
2008-03-24 2008-04-04 2008-05-01 2008-05-12 2008-06-09
2008-07-01 2008-08-06 2008-08-22 2008-09-15 2008-10-01
2008-10-07 2008-12-25 2008-12-26 2009-01-01 2009-01-26
2009-01-27 2009-01-28 2009-04-10 2009-04-13 2009-05-01
2009-05-28 2009-07-01 2009-10-01 2009-10-04 2009-10-26
2009-12-25 2010-01-01 2010-02-14 2010-02-15 2010-02-16
2010-04-02 2010-04-05 2010-04-06 2010-05-21 2010-06-16
2010-07-01 2010-09-23 2010-10-01 2010-12-26 2010-12-27
2011-02-03 2011-02-04 2011-04-05 2011-04-22 2011-04-25
2011-05-02 2011-05-10 2011-06-06 2011-07-01 2011-09-13
2011-09-29 2011-10-05 2011-12-25 2011-12-26 2011-12-27
2012-01-02 2012-01-23 2012-01-24 2012-01-25 2012-12-25
2013-01-01 2013-02-10 2013-02-11 2013-02-12 2013-02-13
2013-03-29 2013-04-01 2013-04-04 2013-05-01 2013-05-17
2013-06-12 2013-07-01 2013-08-14 2013-09-20 2013-10-01
2013-10-14 2013-12-25 2013-12-26 2014-01-01 2014-01-31
2014-02-02 2014-02-03 2014-04-18 2014-04-21 2014-05-01
2014-05-06 2014-06-02 2014-07-01 2014-09-09 2014-10-01
2014-10-02 2014-12-25 2014-12-26 2015-01-01 2015-02-19
2015-02-20 2015-04-03 2015-04-06 2015-05-01 2015-05-25
2015-12-24 2015-12-25 2015-12-31 2016-01-01 2016-02-08
2016-02-09 2016-03-25 2016-07-01 2016-09-16 2016-12-25
2016-12-26 2017-01-29 2017-01-30 2017-04-14 2017-12-25
2018-02-16 2018-02-18 2018-03-30 2018-12-24 2018-12-25
2018-12-31 2019-01-01 2019-02-05 2019-02-05 2019-02-06
2019-02-06 2019-02-07 2019-04-05 2019-04-19 2019-04-22
2019-05-01 2019-05-13 2019-06-07 2019-07-01 2019-09-14
2019-10-01 2019-10-07 2019-12-25 2019-12-26 2020-01-01
2020-01-25 2020-01-26 2020-01-27 2020-01-28 2020-04-04
2020-04-10 2020-04-13 2020-04-30 2020-05-01 2020-06-25
2020-07-01 2020-10-01 2020-10-02 2020-10-26 2020-12-25
2020-12-26 2021-01-01 2021-02-12 2021-02-13 2021-02-14
2021-02-15 2021-04-02 2021-04-05 2021-04-06 2021-05-01
2021-05-19 2021-06-14 2021-07-01 2021-09-22 2021-10-01
2021-10-14 2021-12-25 2021-12-26 2021-12-27 2022-01-01
2022-02-01 2022-02-02 2022-02-03 2022-04-05 2022-04-15
2022-04-18 2022-05-02 2022-05-09 2022-06-03 2022-07-01
2022-09-11 2022-10-01 2022-10-04 2022-12-25 2022-12-26
2022-12-27 2023-01-02 2023-01-22 2023-01-23 2023-01-24
2023-01-25 2023-04-05 2023-04-07 2023-04-10 2023-05-01
2023-05-26 2023-06-22 2023-07-01 2023-09-30 2023-10-02
2023-10-23 2023-12-25 2023-12-26 2024-01-01 2024-02-10
2024-02-11 2024-02-12 2024-02-13 2024-03-29 2024-04-01
2024-04-04

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Hong Kong 33 contract in the CFD market trades in the Asia/Hong Kong time zone.

 

3.7.11.3.10 JP225USD

Introduction

This page shows the trading hours, holidays, and time zone of the Japan 225 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Japan 225 contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Japan 225 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-05-26 2003-07-04 2003-09-01 2003-11-27
2003-12-25 2004-01-01 2004-01-19 2004-02-16 2004-04-09
2004-05-31 2004-06-11 2004-09-06 2004-11-25 2004-12-24
2005-01-17 2005-02-21 2005-03-25 2005-05-30 2005-07-04
2005-12-26 2006-01-02 2006-04-14 2006-12-25 2007-01-01
2007-12-25 2008-01-01 2008-03-21 2008-12-25 2009-01-01
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2015-12-25 2016-01-01
2016-03-25 2017-04-14 2018-03-30 2019-01-01 2019-01-02
2019-01-03 2019-01-14 2019-02-11 2019-03-21 2019-04-29
2019-05-03 2019-05-04 2019-05-06 2019-07-15 2019-08-12
2019-09-16 2019-09-23 2019-10-14 2019-11-04 2019-11-23
2019-12-23 2019-12-31 2020-01-01 2020-01-02 2020-01-03
2020-01-13 2020-02-11 2020-03-20 2020-04-29 2020-05-04
2020-05-04 2020-05-05 2020-07-20 2020-08-11 2020-09-21
2020-09-22 2020-10-12 2020-11-03 2020-11-23 2020-12-23
2020-12-31 2021-01-01 2021-01-02 2021-01-04 2021-01-11
2021-02-11 2021-03-20 2021-04-29 2021-05-03 2021-05-04
2021-05-05 2021-07-19 2021-08-11 2021-09-20 2021-09-23
2021-10-11 2021-11-03 2021-11-23 2021-12-23 2021-12-31
2022-01-01 2022-01-03 2022-01-03 2022-01-10 2022-02-11
2022-03-21 2022-04-29 2022-05-03 2022-05-04 2022-05-05
2022-07-18 2022-08-11 2022-09-19 2022-09-23 2022-10-10
2022-11-03 2022-11-23 2022-12-23 2022-12-25 2022-12-26
2022-12-31 2023-01-01 2023-01-02 2023-01-02 2023-01-03
2023-01-09 2023-02-11 2023-03-21 2023-04-29 2023-05-03
2023-05-04 2023-05-05 2023-07-17 2023-08-11 2023-09-18
2023-09-23 2023-10-09 2023-11-03 2023-11-23 2023-12-23
2024-01-01 2024-01-01 2024-01-02 2024-01-03 2024-01-08
2024-02-12 2024-03-20

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Japan 225 contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.11 NAS100USD

Introduction

This page shows the trading hours, holidays, and time zone of the US Nas 100 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Nas 100 contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US Nas 100 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-07-04 2003-12-25 2004-01-01 2004-04-09
2004-06-11 2004-12-24 2005-03-25 2006-04-14 2006-12-25
2007-01-01 2007-12-25 2008-01-01 2008-03-21 2008-12-25
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2015-12-25
2016-03-25 2017-04-14 2018-03-30 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2021-04-02 2021-12-24 2022-01-01 2022-04-15 2022-12-25
2022-12-26 2023-01-01 2023-01-02 2023-04-07 2023-12-25
2024-01-01 2024-03-29

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US Nas 100 contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.12 NATGASUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Natural Gas contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Natural Gas contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Natural Gas contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-29 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-09-07 2020-11-26 2020-12-25
2021-01-01 2021-01-18 2021-02-15 2021-04-02 2021-05-31
2021-09-06 2021-11-25 2021-12-24 2022-01-17 2022-02-21
2022-04-15 2022-05-30 2022-07-04 2022-09-05 2022-11-24
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Natural Gas contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.13 NL25EUR

Introduction

This page shows the trading hours, holidays, and time zone of the Netherlands 25 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Netherlands 25 contract in the CFD market:

Weekday Time (Europe/Amsterdam)
Monday 08:00:00 to 22:00:00
Tuesday 08:00:00 to 22:00:00
Wednesday 08:00:00 to 22:00:00
Thursday 08:00:00 to 22:00:00
Friday 08:00:00 to 22:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Netherlands 25 contract in the CFD market:

Date ( yyyy-mm-dd )
2008-03-21 2008-03-24 2008-05-01 2008-12-25 2008-12-26
2009-01-01 2009-04-10 2009-04-13 2009-05-01 2009-12-25
2010-01-01 2010-04-02 2010-04-05 2010-12-26 2011-04-22
2011-04-25 2011-05-01 2011-12-25 2011-12-26 2012-01-01
2012-04-06 2012-04-09 2012-05-01 2012-12-25 2013-01-01
2013-03-29 2013-04-01 2013-05-01 2013-12-25 2013-12-26
2014-01-01 2014-04-18 2014-04-21 2014-05-01 2014-12-25
2014-12-26 2015-01-01 2015-04-03 2015-04-06 2015-05-01
2015-12-25 2016-01-01 2016-03-25 2016-03-28 2016-05-01
2016-12-25 2016-12-26 2017-01-01 2017-04-14 2017-04-17
2017-05-01 2017-12-25 2017-12-26 2018-01-01 2018-03-30
2018-04-02 2018-05-01 2018-12-25 2018-12-26 2019-01-01
2019-04-19 2019-04-22 2019-05-01 2019-12-25 2019-12-26
2020-01-01 2020-04-10 2020-04-13 2020-05-01 2020-12-25
2020-12-26 2021-01-01 2021-04-02 2021-04-05 2021-05-01
2021-12-25 2021-12-26 2022-01-01 2022-04-15 2022-04-18
2022-05-01 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2023-04-07 2023-04-10 2023-05-01 2023-12-25 2023-12-26
2024-01-01 2024-03-29 2024-04-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Netherlands 25 contract in the CFD market trades in the Europe/Amsterdam time zone.

 

3.7.11.3.14 SG30SGD

Introduction

This page shows the trading hours, holidays, and time zone of the Singapore 30 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Singapore 30 contract in the CFD market:

Weekday Time (Asia/Singapore)
Monday 08:30:00 to 17:20:00, 17:50:00 to 24:00:00
Tuesday 00:00:00 to 04:45:00, 08:30:00 to 17:20:00, 17:50:00 to 24:00:00
Wednesday 00:00:00 to 04:45:00, 08:30:00 to 17:20:00, 17:50:00 to 24:00:00
Thursday 00:00:00 to 04:45:00, 08:30:00 to 17:20:00, 17:50:00 to 24:00:00
Friday 00:00:00 to 04:45:00, 08:30:00 to 17:20:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Singapore 30 contract in the CFD market:

Date ( yyyy-mm-dd )
2010-02-15 2011-02-13 2012-01-23 2013-02-11 2014-01-31
2015-02-19 2016-02-08 2017-01-02 2017-01-30 2017-04-14
2017-05-01 2017-05-10 2017-06-26 2017-08-09 2017-09-01
2017-10-18 2017-12-25 2018-01-01 2018-02-16 2018-02-16
2018-03-30 2018-05-01 2018-08-09 2018-12-25 2019-01-01
2019-02-05 2019-02-05 2019-04-19 2019-05-01 2019-08-09
2019-12-25 2020-01-01 2020-01-25 2020-01-27 2020-04-10
2020-05-01 2020-08-10 2020-12-25 2021-01-01 2021-02-12
2021-04-02 2021-05-01 2021-08-09 2021-12-25 2022-01-01
2022-02-01 2022-04-15 2022-05-02 2022-08-09 2022-12-26
2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Singapore 30 contract in the CFD market trades in the Asia/Singapore time zone.

 

3.7.11.3.15 SOYBNUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Soybeans contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Soybeans contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Tuesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Wednesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Thursday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Friday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Soybeans contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Soybeans contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.16 SPX500USD

Introduction

This page shows the trading hours, holidays, and time zone of the US SPX 500 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US SPX 500 contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US SPX 500 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-07-04 2003-12-25 2004-01-01 2004-04-09
2004-06-11 2004-12-24 2005-03-25 2006-04-14 2006-12-25
2007-01-01 2007-12-25 2008-01-01 2008-03-21 2008-12-25
2009-01-01 2009-04-10 2009-12-25 2010-01-01 2010-12-24
2011-04-22 2011-12-26 2012-01-02 2012-12-25 2013-01-01
2013-03-29 2013-12-25 2014-01-01 2014-04-18 2015-12-25
2016-03-25 2017-04-14 2018-03-30 2019-01-01 2019-04-19
2019-12-25 2020-01-01 2020-04-10 2020-12-25 2021-01-01
2021-04-02 2021-12-24 2022-01-01 2022-04-15 2022-12-25
2022-12-26 2023-01-01 2023-01-02 2023-04-07 2023-12-25
2024-01-01 2024-03-29

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US SPX 500 contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.17 SUGARUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Sugar contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Sugar contract in the CFD market:

Weekday Time (America/New York)
Monday 03:30:00 to 13:00:00
Tuesday 03:30:00 to 13:00:00
Wednesday 03:30:00 to 13:00:00
Thursday 03:30:00 to 13:00:00
Friday 03:30:00 to 13:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Sugar contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2022-01-17 2022-02-21 2022-04-15 2022-05-30 2022-07-04
2022-09-05 2022-11-24 2022-12-26 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Sugar contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.18 UK100GBP

Introduction

This page shows the trading hours, holidays, and time zone of the UK 100 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the UK 100 contract in the CFD market:

Weekday Time (Europe/London)
Monday 01:00:00 to 21:00:00
Tuesday 01:00:00 to 21:00:00
Wednesday 01:00:00 to 21:00:00
Thursday 01:00:00 to 21:00:00
Friday 01:00:00 to 21:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the UK 100 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-04-21 2003-05-05 2003-05-26 2003-08-25
2003-12-25 2003-12-26 2004-01-01 2004-04-09 2004-04-12
2004-05-03 2004-05-31 2004-08-30 2004-12-26 2004-12-27
2004-12-28 2005-01-03 2005-03-25 2005-03-28 2005-05-02
2005-05-30 2005-08-29 2005-12-25 2005-12-26 2005-12-27
2006-01-02 2006-04-14 2006-04-17 2006-05-01 2006-05-29
2006-08-28 2006-12-25 2006-12-26 2007-01-01 2007-04-06
2007-04-09 2007-05-07 2007-05-28 2007-08-27 2007-12-25
2007-12-26 2008-01-01 2008-03-21 2008-03-24 2008-05-05
2008-05-26 2008-08-25 2008-12-25 2008-12-26 2009-01-01
2009-04-10 2009-04-13 2009-05-04 2009-05-25 2009-08-31
2009-12-25 2009-12-28 2010-01-01 2010-04-02 2010-04-05
2010-05-03 2010-05-31 2010-08-30 2010-12-26 2010-12-27
2010-12-28 2011-01-03 2011-04-22 2011-04-25 2011-05-02
2011-05-30 2011-08-29 2011-12-25 2011-12-26 2011-12-27
2012-01-02 2012-12-25 2013-01-01 2013-03-29 2013-04-01
2013-05-06 2013-05-27 2013-08-26 2013-12-25 2013-12-26
2014-01-01 2014-04-18 2014-04-21 2014-05-05 2014-05-26
2014-08-25 2014-12-25 2014-12-26 2015-01-01 2015-04-03
2015-04-06 2015-05-04 2015-05-25 2015-08-31 2015-12-25
2016-01-01 2016-03-25 2016-12-25 2016-12-26 2017-04-14
2017-12-25 2018-03-30 2018-12-25 2019-01-01 2019-04-19
2019-04-22 2019-05-06 2019-05-27 2019-08-26 2019-12-25
2019-12-26 2020-01-01 2020-04-10 2020-04-13 2020-05-04
2020-05-25 2020-08-31 2020-12-25 2020-12-26 2020-12-28
2021-01-01 2021-04-02 2021-04-05 2021-05-03 2021-05-31
2021-08-30 2021-12-25 2021-12-26 2021-12-27 2021-12-28
2022-01-03 2022-04-15 2022-04-18 2022-05-02 2022-05-30
2022-08-29 2022-12-25 2022-12-26 2022-12-27 2023-01-02
2023-04-07 2023-04-10 2023-05-01 2023-05-29 2023-08-28
2023-12-25 2023-12-26 2024-01-01 2024-03-29 2024-04-01

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The UK 100 contract in the CFD market trades in the Europe/London time zone.

 

3.7.11.3.19 UK10YBGBP

Introduction

This page shows the trading hours, holidays, and time zone of the UK 10Y Gilt contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the UK 10Y Gilt contract in the CFD market:

Weekday Time (Europe/London)
Monday 08:00:00 to 18:00:00
Tuesday 08:00:00 to 18:00:00
Wednesday 08:00:00 to 18:00:00
Thursday 08:00:00 to 18:00:00
Friday 08:00:00 to 18:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the UK 10Y Gilt contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2017-04-17 2017-05-01 2017-12-25 2017-12-26
2018-01-01 2018-03-20 2018-04-02 2018-05-01 2018-12-25
2018-12-26 2019-01-01 2019-04-19 2019-04-22 2019-05-01
2019-12-25 2019-12-26 2020-01-01 2020-04-10 2020-04-13
2020-05-01 2020-12-25 2021-01-01 2021-04-02 2021-04-05
2022-04-15 2022-04-18 2022-12-26 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The UK 10Y Gilt contract in the CFD market trades in the Europe/London time zone.

 

3.7.11.3.20 US2000USD

Introduction

This page shows the trading hours, holidays, and time zone of the US Russ 2000 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Russ 2000 contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 16:15:00, 16:30:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 16:15:00, 16:30:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 16:15:00, 16:30:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 16:15:00, 16:30:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 16:15:00, 16:30:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US Russ 2000 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-12-25 2004-01-01 2004-04-09 2004-06-11
2004-12-24 2005-03-25 2006-04-14 2006-12-25 2007-01-01
2007-12-25 2008-01-01 2008-03-21 2008-12-25 2009-01-01
2009-04-10 2009-12-25 2010-01-01 2010-12-24 2011-04-22
2011-12-26 2012-01-02 2012-12-25 2013-01-01 2013-03-29
2013-12-25 2014-01-01 2014-04-18 2014-12-25 2015-01-01
2015-12-25 2016-01-01 2016-03-25 2017-04-14 2018-03-30
2019-01-01 2019-04-19 2019-12-25 2020-01-01 2020-04-10
2020-12-25 2021-01-01 2021-04-02 2021-12-24 2022-01-01
2022-04-15 2022-12-25 2022-12-26 2023-01-01 2023-01-02
2023-04-07 2023-12-25 2024-01-01 2024-03-29

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US Russ 2000 contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.21 US30USD

Introduction

This page shows the trading hours, holidays, and time zone of the US Wall St 30 contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US Wall St 30 contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 15:15:00, 15:30:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US Wall St 30 contract in the CFD market:

Date ( yyyy-mm-dd )
2003-04-18 2003-05-26 2003-07-04 2003-09-01 2003-11-27
2003-12-25 2004-01-01 2004-01-19 2004-02-16 2004-04-09
2004-05-31 2004-06-11 2004-07-05 2004-09-06 2004-11-25
2004-12-24 2005-01-17 2005-02-21 2005-03-25 2005-05-30
2005-07-04 2005-09-05 2005-11-24 2005-12-26 2006-01-02
2006-01-16 2006-02-20 2006-04-14 2006-11-23 2006-12-25
2007-01-01 2007-01-15 2007-02-19 2007-11-22 2007-12-25
2008-01-01 2008-03-21 2008-12-25 2009-01-01 2009-04-10
2009-12-25 2010-01-01 2010-12-24 2011-04-22 2011-12-26
2012-01-02 2012-12-25 2013-01-01 2013-03-29 2013-12-25
2014-01-01 2014-04-18 2015-12-25 2016-03-25 2017-04-14
2018-03-30 2019-01-01 2019-04-19 2019-12-25 2020-01-01
2020-04-10 2020-12-25 2021-01-01 2021-04-02 2021-12-24
2022-01-01 2022-04-15 2022-12-26 2023-01-01 2023-01-02
2023-04-07 2023-12-25 2024-01-01 2024-03-29

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US Wall St 30 contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.22 USB02YUSD

Introduction

This page shows the trading hours, holidays, and time zone of the US 2Y T-Note contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US 2Y T-Note contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US 2Y T-Note contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US 2Y T-Note contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.23 USB05YUSD

Introduction

This page shows the trading hours, holidays, and time zone of the US 5Y T-Note contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US 5Y T-Note contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US 5Y T-Note contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US 5Y T-Note contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.24 USB10YUSD

Introduction

This page shows the trading hours, holidays, and time zone of the US 10Y T-Note contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US 10Y T-Note contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US 10Y T-Note contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US 10Y T-Note contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.25 USB30YUSD

Introduction

This page shows the trading hours, holidays, and time zone of the US T-Bond contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the US T-Bond contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 17:00:00 to 24:00:00
Monday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Tuesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Wednesday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Thursday 00:00:00 to 16:00:00, 17:00:00 to 24:00:00
Friday 00:00:00 to 16:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the US T-Bond contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The US T-Bond contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.26 WHEATUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Wheat contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Wheat contract in the CFD market:

Weekday Time (America/Chicago)
Sunday 19:00:00 to 24:00:00
Monday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Tuesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Wednesday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Thursday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00, 19:00:00 to 24:00:00
Friday 00:00:00 to 07:45:00, 08:30:00 to 13:20:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Wheat contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-25 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-07-03 2020-09-07 2020-11-26
2020-12-25 2021-01-01 2021-01-18 2021-02-15 2021-04-02
2021-05-31 2021-07-05 2021-09-06 2021-11-25 2021-12-24
2021-12-31 2022-01-17 2022-02-21 2022-04-15 2022-05-13
2022-07-04 2022-09-05 2022-11-24 2022-12-25 2022-12-26
2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Wheat contract in the CFD market trades in the America/Chicago time zone.

 

3.7.11.3.27 WTICOUSD

Introduction

This page shows the trading hours, holidays, and time zone of the West Texas Oil contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the West Texas Oil contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the West Texas Oil contract in the CFD market:

Date ( yyyy-mm-dd )
2017-01-02 2017-01-16 2017-02-20 2017-04-14 2017-05-29
2017-07-04 2017-09-04 2017-11-23 2017-12-25 2018-01-01
2018-01-15 2018-02-19 2018-03-30 2018-05-28 2018-07-04
2018-09-03 2018-11-22 2018-12-29 2019-01-01 2019-01-21
2019-02-18 2019-04-19 2019-05-27 2019-07-04 2019-09-02
2019-11-28 2019-12-25 2020-01-01 2020-01-20 2020-02-17
2020-04-10 2020-05-25 2020-09-07 2020-11-26 2020-12-25
2021-01-01 2021-01-18 2021-02-15 2021-04-02 2021-05-31
2021-09-06 2021-11-25 2021-12-24 2022-01-17 2022-02-21
2022-04-15 2022-05-30 2022-07-04 2022-09-05 2022-11-24
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The West Texas Oil contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.28 XAGAUD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/AUD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/AUD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/AUD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/AUD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.29 XAGCAD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/CAD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/CAD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/CAD contract in the CFD market:

Date ( yyyy-mm-dd )
2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/CAD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.30 XAGCHF

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/CHF contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/CHF contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/CHF contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/CHF contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.31 XAGEUR

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/EUR contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/EUR contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/EUR contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/EUR contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.32 XAGGBP

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/GBP contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/GBP contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/GBP contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/GBP contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.33 XAGHKD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/HKD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/HKD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/HKD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/HKD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.34 XAGJPY

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/JPY contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/JPY contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/JPY contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/JPY contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.35 XAGNZD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/NZD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/NZD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/NZD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/NZD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.36 XAGSGD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver/SGD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver/SGD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver/SGD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver/SGD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.37 XAGUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Silver contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Silver contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:03:00 to 24:00:00
Monday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Tuesday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Wednesday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Thursday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Friday 00:00:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Silver contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Silver contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.38 XAUAUD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/AUD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/AUD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/AUD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/AUD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.39 XAUCAD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/CAD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/CAD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/CAD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/CAD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.40 XAUCHF

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/CHF contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/CHF contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/CHF contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/CHF contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.41 XAUEUR

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/EUR contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/EUR contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/EUR contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/EUR contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.42 XAUGBP

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/GBP contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/GBP contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/GBP contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/GBP contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.43 XAUHKD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/HKD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/HKD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/HKD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/HKD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.44 XAUJPY

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/JPY contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/JPY contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/JPY contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/JPY contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.45 XAUNZD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/NZD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/NZD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 17:58:00, 18:03:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/NZD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/NZD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.46 XAUSGD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/SGD contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/SGD contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/SGD contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/SGD contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.47 XAUUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Gold contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:03:00 to 24:00:00
Monday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Tuesday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Wednesday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Thursday 00:00:00 to 16:58:00, 18:03:00 to 24:00:00
Friday 00:00:00 to 16:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.48 XAUXAG

Introduction

This page shows the trading hours, holidays, and time zone of the Gold/Silver contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Gold/Silver contract in the CFD market:

Weekday Time (UTC)
Sunday 23:10:00 to 24:00:00
Monday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Tuesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Wednesday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Thursday 00:00:00 to 21:58:00, 23:10:00 to 24:00:00
Friday 00:00:00 to 21:58:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Gold/Silver contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Gold/Silver contract in the CFD market trades in the UTC time zone.

 

3.7.11.3.49 XCUUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Copper contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Copper contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Copper contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Copper contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.50 XPDUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Palladium contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Palladium contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Palladium contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Palladium contract in the CFD market trades in the America/New York time zone.

 

3.7.11.3.51 XPTUSD

Introduction

This page shows the trading hours, holidays, and time zone of the Platinum contract in the CFD market.

Pre-market Hours

Pre-market trading is not available.

Regular Trading Hours

The following table shows the regular trading hours for the Platinum contract in the CFD market:

Weekday Time (America/New York)
Sunday 18:00:00 to 24:00:00
Monday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Tuesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Wednesday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Thursday 00:00:00 to 17:00:00, 18:00:00 to 24:00:00
Friday 00:00:00 to 17:00:00

Post-market Hours

Post-market trading is not available.

Holidays

The following table shows the dates of holidays for the Platinum contract in the CFD market:

Date ( yyyy-mm-dd )
2017-04-14 2022-12-25 2022-12-26 2023-01-01 2023-01-02

Early Closes

There are no days with early closes.

Late Opens

There are no days with late opens.

Time Zone

The Platinum contract in the CFD market trades in the America/New York time zone.

 

4 Portfolio

4.1 Key Concepts

Introduction

The Portfolio object provides information about the whole portfolio state.

Properties

The Portfolio object has the following properties:

var invested = Portfolio.Invested;
var value = Portfolio.TotalPortfolioValue;
invested = self.Portfolio.Invested
value = self.Portfolio.TotalPortfolioValue

Cost Averaging Accounting

LEAN uses the cost averaging accounting method, which determines the cost of your holdings by taking a weighted average of all your purchase prices. For example, say you place the following buy orders:

  1. Buy 10 ABC @ $10
  2. Buy 5 ABC @ $11
  3. Buy 20 ABC @ $14
  4. Buy 3 ABC @ $9

In the preceding example, the average cost of your ABC position is (10*10 + 5*11 + 20*14 + 3*9) / (10 + 5 + 20 + 3) = 12.1579/share. In contrast, if you use the first-in, first-out (FIFO) accounting method, the cost of the first 10 shares is 10/share, not 12.1579/share.

To get the cost of your security holdings, use the HoldingsCost property of the SecurityHolding object . If you fill buy and sell orders, the holdings cost is the product of the holding quantity and the average price. For example, the following table shows how the average price and holdings cost changes with each buy and sell order order in a long position:

Order Quantity Fill Price ($) Holding Quantity Average Price ($) Holdings Cost ($)
2 10 2 (2 * 10) / 2 = 10 2 * 10 = 20
-1 11 1 (1 * 10) / 1 = 10 1 * 10 = 10
1 12 2 (1 * 10 + 1 * 12) / 2 = 11
2 * 11 = 22
-2 13 0 0
0 * 0 = 0

The following table shows how the average price and holdings cost changes with each buy and sell order order in a short position:

Order Quantity Fill Price ($) Holding Quantity Average Price ($) Holdings Cost ($)
-2 10 -2 (-2 * 10) / -2 = 10 -2 * 10 = -20
1 11 -1 (-1 * 10) / -1 = 10 -1 * 10 = -10
-1 12 -2 (-1 * 10 + (-1) * 12) / -2 = 11
-2 * 11 = -22
2 13 0 0 0 * 0 = 0

Note that when you decrease the position size without closing the trade, the average price doesn't change because the denominator and the coefficients in the numerator of its formula are scaled by the quotient of the current holding quantity and the previous holding quantity. For instance, if the last row in the preceding table had an order quantity 1, the holding quantity would be -1 and the average price would be

$$ \frac{(-1 * q) * 10 + (-1 * q) * 12}{-2 * q} $$ $$ =\frac{(-1 * \frac{-1}{-2}) * 10 + (-1 * \frac{-1}{-2}) * 12}{-2 * \frac{-1}{-2}} $$ $$ =\frac{\frac{-1}{2} * 10 + \frac{-1}{2} * 12}{-1 } $$ $$ =\frac{-5 - 6}{-1} = 11 $$

Long and Short Holdings

You can identify a position as long- or short-biased based on the sign of the holding quantity. Long positions have a positive quantity and short positions have a negative quantity.

Buying Power

To get the maximum order size you can place for a given Symbol and order direction, call the GetBuyingPower method.

var quantity = Portfolio.GetBuyingPower(_symbol, OrderDirection.Buy);
quantity = self.Portfolio.GetBuyingPower(self.symbol, OrderDirection.Buy)

For more information about buying power, see Buying Power .

 

4.2 Holdings

Introduction

The Portfolio is a dictionary where the key is a Symbol and the value is a SecurityHolding .

var securityHolding = Portfolio["SPY"];
security_holding = self.Portfolio["SPY"]

Properties

SecurityHolding objects have the following properties:

var securityHolding = Portfolio["SPY"];
var quantity = securityHolding.Quantity;
var invested = securityHolding.Invested;
security_holding = self.Portfolio["SPY"]
quantity = security_holding.Quantity
invested = security_holding.Invested

Get Total Close Profit

To get the profit of a position holding if you closed the position, call the TotalCloseProfit method. The value this method returns is denominated in your account currency and accounts for order fees.

var profit = Portfolio["SPY"].TotalCloseProfit();
profit = self.Portfolio["SPY"].TotalCloseProfit()

The TotalCloseProfit method accepts the following optional arguments:

Argument Data Type Description Default Value
includeFees bool Whether to reduce the profit based on the estimated fee from the fee model . true True
exitPrice decimal? float/NoneType A hypothetical exit price to use for the profit calculation. If you don't provide a value, it uses the bid price for sell orders or the ask price for buy orders. null None
entryPrice decimal? float/NoneType A hypothetical exit price to use for the profit calculation. If you don't provide a value, it uses the average price of the SecurityHolding . null None
quantity decimal? float/NoneType The quantity to liquidate. If you don't provide a value, it uses the quantity of the SecurityHolding . null None

LEAN uses this method to define the UnrealizedProfit property.

Get Quantity Value

To get the value of a security at any quantity, call the GetQuantityValue method. The value this method returns is denominated in your account currency.

// Get the quantity value at the current price
var valueAtCurrentPrice = Portfolio["SPY"].GetQuantityValue(100);

// Get the quantity value at a specific price
var valueAtSpecificPrice = Portfolio["SPY"].GetQuantityValue(100, price: 30);
# Get the quantity value at the current price
value_at_current_price = self.Portfolio["SPY"].GetQuantityValue(100)

# Get the quantity value at a specific price
value_at_specific_price = self.Portfolio["SPY"].GetQuantityValue(100, price=30)

 

4.3 Cashbook

Introduction

The CashBook is a dictionary where the keys are currency tickers and the values are Cash objects. The Cash objects track the amount of each currency in the portfolio. As you buy and sell securities, LEAN credits and debits the Cash objects to reflect your cash holdings.

Account Currency

The default account currency is USD, but you can change it. All of the properties of the Portfolio object that return a currency value denominate the currency value in your account currency. Depending on your account currency and security subscriptions, LEAN may add internal security subscriptions to calculate the ValueInAccountCurrency . For example, if you only add BTCETH to your algorithm and set the account currency to USDT, LEAN adds BTCUSDT and ETHUSDT as internal feeds.

To get your account currency, use the AccountCurrency property.

var accountCurrency = AccountCurrency;
account_currency = self.AccountCurrency

To set your account currency, in the Initialize method, call the SetAccountCurrency method. You can only set the account currency once. LEAN ignores each additional call to SetAccountCurrency .

SetAccountCurrency("EUR");
self.SetAccountCurrency("EUR")

Settled vs Unsettled Cash

The Portfolio has two independent cashbooks. The CashBook tracks settled cash and the UnsettledCashBook tracks unsettled cash, which you can't spend. If you trade with a margin account, trades settle immediately so LEAN credits and debits the CashBook at the time of the trade. In some cases, transactions can take time to settle. For example, Equity trades in a cash account settle in T+3. Therefore, if you sell shares of stock on Monday, the transaction settles on Thursday. In contrast, Option trades settle in T+1.

var settledCashBook = Portfolio.CashBook;
var unsettledCashBook = Portfolio.UnsettledCashBook;
settled_cash_book = self.Portfolio.CashBook
unsettled_cash_book = self.Portfolio.UnsettledCashBook

Track Cash Balances

To get the balance of a currency in the cash book, use the Amount property.

var usd = Portfolio.CashBook["USD"].Amount;
var btc = Portfolio.CashBook["BTC"].Amount;
usd = self.Portfolio.CashBook["USD"].Amount
btc = self.Portfolio.CashBook["BTC"].Amount

To get the value of a currency in the cash book, denominated in your account currency, use the ValueInAccountCurrency property.

var ethValue = Portfolio.CashBook["ETH"].ValueInAccountCurrency;
eth_value = self.Portfolio.CashBook["ETH"].ValueInAccountCurrency

Deposits and Withdraws

In backtests, you can add and remove cash from the cash book. To add or remove cash, call the AddAmount method.

var newUSDBalance = Portfolio.CashBook["USD"].AddAmount(100);
var newBTCBalance = Portfolio.CashBook["BTC"].AddAmount(-1.5m);
new_usd_balance = self.Portfolio.CashBook["USD"].AddAmount(100)
new_btc_balance = self.Portfolio.CashBook["BTC"].AddAmount(-1.5)

In live trading, add and withdraw cash through your brokerage account. If you adjust the cash balances in your algorithm with the AddAmount method, the cash balance in your algorithm will be out of sync with the cash balance in your brokerage account.

Currency Symbols

A currency symbol is a graphic that represents the currency name. For example, $ is for dollars, € for euros, and ฿ for Bitcoin. To get the symbol of a currency in the cash book, use CurrencySymbol property.

var usdSymbol = Portfolio.CashBook["USD"].CurrencySymbol;
usd_symbol = self.Portfolio.CashBook["USD"].CurrencySymbol

Conversion Rates

To get the conversion rate for a currency in the cashbook to your account currency, use the ConversionRate property.

var eurConversionRate = Portfolio.CashBook["EUR"].ConversionRate;
eur_conversion_rate = self.Portfolio.CashBook["EUR"].ConversionRate

 

5 Universes

5.1 Key Concepts

Introduction

Universe selection is the process of selecting a basket of assets you may trade. Dynamic universe selection increase diversification and decrease selection bias in your algorithm.

How Universe Selection Works

When you add a universe to your algorithm, LEAN sends a large dataset into a filter function you define. Your filter function needs to return a list of Symbol objects. LEAN automatically subscribes to these new symbols and adds them to your algorithm. Your algorithm can do almost anything inside your filter functions, but the goal should be to narrow down the set of securities to the securities that are most applicable for your algorithm.

Security Changed Events

When your universe adds and removes assets, LEAN notifies your algorithm through the OnSecuritiesChanged event handler. The event handler receives a SecurityChanges object, which contains references to the added and removed securities. To access the added securities, check the changes.AddedSecurities property. To access the removed securities, check the changes.RemovedSecurities property.

public override void OnSecuritiesChanged(SecurityChanges changes)
{
    foreach (var security in changes.AddedSecurities)
    {
        Debug($"{Time}: Added {security.Symbol}");
    }
    foreach (var security in changes.RemovedSecurities)
    {
        Debug($"{Time}: Removed {security.Symbol}");
        
        if (security.Invested)
        {
            Liquidate(security.Symbol, "Removed from Universe");
        }
    }
}
def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.AddedSecurities:
        self.Debug(f"{self.Time}: Added {security.Symbol}")

    for security in changes.RemovedSecurities:
        self.Debug(f"{self.Time}: Removed {security.Symbol}")
        
        if security.Invested:
            self.Liquidate(security.Symbol, "Removed from Universe")

The preceding example liquidates securities that leave the universe. In this case, LEAN creates a market on open order and frees up buying power when the market opens.

A convenient way to track the securities that are currently in the universe is to use the NotifiedSecurityChanges class.

A convenient way to track the securities that are currently in the universe is to maintain a self.securities list.

private readonly HashSet<Security> _securities = new();
public override void OnSecuritiesChanged(SecurityChanges changes)
{
    NotifiedSecurityChanges.UpdateCollection(_securities, changes);
}
# In Initialize
self.securities = []

def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.RemovedSecurities:
        if security in self.securities:
            self.securities.remove(security)
            
    self.securities.extend(changes.AddedSecurities)

If you need to save data or create objects for each security in the universe, maintain a dictionary of custom SymbolData objects. This technique is useful if you want to track stop loss levels or add indicators for each asset in the universe.

// In Initialize
Dictionary<Symbol, SymbolData> _symbolDataBySymbol = new();

public override void OnSecuritiesChanged(SecurityChanges changes)
{
    foreach (var security in changes.AddedSecurities)
    {
        _symbolDataBySymbol.Add(security.Symbol, new SymbolData());  // You need to define this class
    }

    foreach (var security in changes.RemovedSecurities)
    {
        _symbolDataBySymbol.Remove(security.Symbol);
    }
}
# In Initialize
self.symbol_data_by_symbol = {}

def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
    for security in changes.AddedSecurities:
        self.symbol_data_by_symbol[security.Symbol] = SymbolData() # You need to define this class

    for security in changes.RemovedSecurities:
        self.symbol_data_by_symbol.pop(security.Symbol, None)

Select Current Constituents

If you don't want to make any changes to the current universe, return Universe.Unchanged from your filter functions.

public class MyUniverseAlgorithm : QCAlgorithm 
{
    public override void Initialize()
    {
        AddUniverse(MyCoarseFilterFunction);
    }

    IEnumerable<Symbol> MyCoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) 
    {
         return Universe.Unchanged;
    }
}
class MyUniverseAlgorithm(QCAlgorithm):
     def Initialize(self) -> None:
         self.AddUniverse(self.MyCoarseFilterFunction)

    def MyCoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
         return Universe.Unchanged

Universe Manager

The universe manager tracks all the universes in your algorithm. If you add multiple universe, you can access the constituents of each individual universe. To access the constituents of a universe in a multi-universe algorithm, save references to each universe when you add them.

private Universe _universe;

// In Initialize
_universe = AddUniverse(MyCoarseFilterFunction);

// In OnData
var universeMembers = UniverseManager[_universe.Configuration.Symbol].Members;
foreach (var kvp in universeMembers)
{
    var symbol = kvp.Key;
    var security = kvp.Value;
}
# In Initialize
self.universe = self.AddUniverse(self.MyCoarseFilterFunction)

# In OnData
universe_members = self.UniverseManager[self.universe.Configuration.Symbol].Members
for kvp in universe_members:
    symbol = kvp.Key
    security = kvp.Value

Active Securities

The ActiveSecurities property of the algorithm class contains all of the assets currently in your universe. It is a dictionary where the key is a Symbol and the value is a Security . When you remove an asset from a universe, LEAN usually removes the security from the ActiveSecurities collection and removes the security subscription. However, it won't remove the security in any of the following situations:

When LEAN removes the security, the Security object remains in the Securities collection for record-keeping purposes, like tracking fees and trading volume.

Derivative Universes

In a regular universe, you select a basket of assets from the entire universe of securities. In a derivative universe, you select a basket of contracts for an underlying asset. The following derivative universes are available:

 

5.2 Settings

Introduction

Universe settings and security initializers enable you to configure some properties of the securities in a universe.

Properties

The universe settings of your algorithm configure some properties of the universe constituents. The following table describes the properties of the UniverseSettings object:

Property: ExtendedMarketHours

Should assets also feed extended market hours? You only receive extended market hours data if you create the subscription with an intraday resolution. If you create the subscription with daily resolution, the daily bars only reflect the regular trading hours.

Data Type: bool | Default Value: false False

Property: FillForward

Should asset data fill forward?

Data Type: bool | Default Value: true True

Property: MinimumTimeInUniverse

What's the minimum time assets should be in the universe?

Data Type: TimeSpan timedelta | Default Value: TimeSpan.FromDays(1) timedelta(1)

Property: Resolution

What resolution should assets use?

Data Type: Resolution | Default Value: Resolution.Minute

Property: ContractDepthOffset

What offset from the current front month should be used for continuous Future contracts ? 0 uses the front month and 1 uses the back month contract. This setting is only available for Future assets.

Data Type: int | Default Value: 0

Property: DataMappingMode

How should continuous Future contracts be mapped? This setting is only available for Future assets.

Data Type: DataMappingMode | Default Value: DataMappingMode.OpenInterest

Property: DataNormalizationMode

How should historical prices be adjusted? This setting is only available for Equity and Futures assets.

Data Type: DataNormalizationMode | Default Value: DataNormalizationMode.Adjusted

Property: Leverage

What leverage should assets use in the universe? This setting is not available for derivative assets.

Data Type: decimal float | Default Value: Security.NullLeverage

To set the UniverseSettings , update the preceding properties in the Initialize method before you add the "universe" These settings are globals, so they apply to all universes you create.

// Request second resolution data. This will be slow!
UniverseSettings.Resolution = Resolution.Second;
AddUniverse(MyCoarseFilterFunction);
# Request second resolution data. This will be slow!
self.UniverseSettings.Resolution = Resolution.Second
self.AddUniverse(self.MyCoarseFilterFunction)

Configure Universe Securities

Instead of configuring global universe settings, you can individually configure the settings of each security in the universe with a security initializer. Security initializers let you apply any security-level reality model or special data requests on a per-security basis. To set the security initializer, in the Initialize method, call the SetSecurityInitializer method and then define the security initializer.

//In Initialize
SetSecurityInitializer(CustomSecurityInitializer);

private void CustomSecurityInitializer(Security security)
{
    // Disable trading fees
    security.SetFeeModel(new ConstantFeeModel(0, "USD"));
}
#In Initialize
self.SetSecurityInitializer(self.CustomSecurityInitializer)

def CustomSecurityInitializer(self, security: Security) -> None:
    # Disable trading fees
    security.SetFeeModel(ConstantFeeModel(0, "USD"))

For simple requests, you can use the functional implementation of the security initializer. This style lets you configure the security object with one line of code.

SetSecurityInitializer(security => security.SetFeeModel(new ConstantFeeModel(0, "USD")));
self.SetSecurityInitializer(lambda security: security.SetFeeModel(ConstantFeeModel(0, "USD")))

In some cases, you may want to trade a security in the same time loop that you create the security subscription. To avoid errors, use a security initializer to set the market price of each security to the last known price. The GetLastKnownPrices method seeds the security price by gathering the security data over the last 3 days. If there is no data during this period, the security price remains at 0.

var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(security => seeder.SeedSecurity(security));
seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
self.SetSecurityInitializer(lambda security: seeder.SeedSecurity(security))

If you call the SetSecurityInitializer method, it overwrites the default security initializer. The default security initializer uses the security-level reality models of the brokerage model to set the following reality models of each security:

The default security initializer also sets the leverage of each security and intializes each security with a seeder function. To extend upon the default security initializer instead of overwriting it, create a custom BrokerageModelSecurityInitializer .

// In Initialize
SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));

// Outside of the algorithm class
class MySecurityInitializer : BrokerageModelSecurityInitializer
{
    public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
        : base(brokerageModel, securitySeeder) {}    
    
    public override void Initialize(Security security)
    {
        // First, call the superclass definition
        // This method sets the reality models of each security using the default reality models of the brokerage model
        base.Initialize(security);

        // Next, overwrite some of the reality models        
        security.SetFeeModel(new ConstantFeeModel(0, "USD"));    
    }
}
# In Initialize
self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

# Outside of the algorithm class
class MySecurityInitializer(BrokerageModelSecurityInitializer):

    def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
        super().__init__(brokerage_model, security_seeder)

    def Initialize(self, security: Security) -> None:
        # First, call the superclass definition
        # This method sets the reality models of each security using the default reality models of the brokerage model
        super().Initialize(security)

        # Next, overwrite some of the reality models        
        security.SetFeeModel(ConstantFeeModel(0, "USD"))

To set a seeder function without overwriting the reality models of the brokerage, use the standard BrokerageModelSecurityInitializer .

SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

Selection Frequency

Most universes run on a daily basis, but some can select assets at different frequencies.

 

5.3 Equity

Introduction

There are several ways to create an Equities universe. You can select a universe based on CoarseFundamental data or the constituents of an ETF, and then you can further filter your universe down with corporate fundamentals. The following sections explain each of these techniques in detail.

Coarse Universe Selection

A coarse universe enables you pick a set of stocks based on their trading volume, price, or whether they have fundamental data. To add a coarse universe, in the Initialize method, pass a filter function to the AddUniverse method. The coarse filter function receives a list of CoarseFundamental objects and must return a list of Symbol objects. The Symbol objects you return from the function are the constituents of the universe and LEAN automatically creates subscriptions for them. Don't call AddEquity in the filter function.

public class MyCoarseUniverseAlgorithm : QCAlgorithm
{
    public override void Initialize()
    {
        AddUniverse(CoarseFilterFunction);
    }

    private IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse)
    {
        return (from c in coarse
            orderby c.DollarVolume descending
            select c.Symbol).Take(100);
    }
}
class MyCoarseUniverseAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.AddUniverse(self.CoarseFilterFunction)

    def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) 
        return [c.Symbol for c in sorted_by_dollar_volume[:100]]

CoarseFundamental objects have the following attributes:

The total number of stocks in the US Equity Security Master dataset is 30,000 but your coarse filter function won't receive all of these at one time because the US Equity Security Master dataset is free of survivorship bias and some of the securities have delisted over time. The number of securities that are passed into your coarse filter function depends on the date of your algorithm. Currently, there are about 10,000 securities that LEAN passes into your coarse filter function.

Dollar Volume Selection

A dollar volume universe enables you pick the most liquid stocks in the market with just one line of code. To add a dollar volume universe, call the Universe.DollarVolume.Top helper method and pass the result to the AddUniverse method.

// Add the 50 stocks with the highest dollar volume
AddUniverse(Universe.DollarVolume.Top(50));
// Add the 50 stocks with the highest dollar volume
self.AddUniverse(self.Universe.DollarVolume.Top(50))

ETF Constituents Selection

An ETF constituents universe lets you select a universe of securities in an ETF. The US ETF Constituents dataset includes 2,650 US ETFs you can use to create your universe. To add an ETF Constituents universe, call the Universe.ETF method.

public class ETFConstituentsAlgorithm : QCAlgorithm
{
    public override void Initialize() 
    {
        AddUniverse(Universe.ETF("SPY", Market.USA, UniverseSettings));
    }
}
class ETFConstituentsAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:        
        self.AddUniverse(self.Universe.ETF("SPY", Market.USA, self.UniverseSettings))

The following table describes the ETF method arguments:

Argument: etfTicker

The ETF ticker. To view the supported ETFs in the US ETF Constituents dataset, see Supported ETFs .

Data Type: string str | Default Value: None

Argument: market

The market of the ETF. If you don't provide an argument, it uses the default Equity market of the brokerage model .

Data Type: string str | Default Value: None

Argument: universeSettings

The universe settings . If you don't provide an argument, it uses the algorithm UniverseSettings .

Data Type: UniverseSettings | Default Value: None

Argument: universeFilterFunc

A function to select some of the ETF constituents for the universe. If you don't provide an argument, it selects all of the constituents.

Data Type: Func<IEnumerable<ETFConstituentData>, IEnumerable<Symbol>> Callable[[List[ETFConstituentData]], List[Symbol]] | Default Value: null None

To select a subset of the ETF constituents, provide a universeFilterFunc argument. The filter function receives ETFConstituentData objects, which represent one of the ETF constituents. ETFConstituentsData objects have the following attributes:

public class ETFConstituentsAlgorithm : QCAlgorithm 
{
    public override void Initialize() 
    {
        var universe = Universe.ETF("SPY", Market.USA, UniverseSettings, ETFConstituentsFilter);
        AddUniverse(universe);
    }

    private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
    {
        // Get the 10 securities with the largest weight in the index
        return constituents.OrderByDescending(c => c.Weight).Take(10).Select(c => c.Symbol);
    }
}
class ETFConstituentsAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        universe = self.Universe.ETF("SPY", Market.USA, self.UniverseSettings, self.ETFConstituentsFilter)
        self.AddUniverse(universe)

    def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
        # Get the 10 securities with the largest weight in the index
        selected = sorted([c for c in constituents if c.Weight],
            key=lambda c: c.Weight, reverse=True)[:10]
        return [c.Symbol for c in selected]

Fundamentals Selection

A fundamental universe lets you select stocks based on corporate fundamental data. This data is powered by Morningstar® and includes approximately 5,000 tickers with 900 properties each. Due to the sheer volume of information, fundamental selection is performed on the output of another universe filter. Think of this process as a 2-stage filter. An initial filter function selects a set of stocks and then a fine fundamental filter function selects a subset of those stocks.

Fundamental selection process
QuantConnect Coarse and Fine Universe Selection

To add a fundamental universe, in the Initialize method, pass two filter functions to the AddUniverse method. The first filter function can be a coarse universe filter , dollar volume filter , or an ETF constituents filter . The second filter function receives a list of FineFundamental objects and must return a list of Symbol objects. The list of FineFundamental objects contains a subset of the Symbol objects that the first filter function returned. The Symbol objects you return from the second function are the constituents of the fundamental universe and LEAN automatically creates subscriptions for them. Don't call AddEquity in the filter function.

Tip:

Only 5,000 assets have fundamental data. If your first filter function receives CoarseFundamental data, you should only select assets that have a true value for their HasFundamentalData property.

public class MyUniverseAlgorithm : QCAlgorithm {
    public override void Initialize() 
    {
        AddUniverse(CoarseFilterFunction, FineFundamentalFilterFunction);
    }
    // filter based on CoarseFundamental
    IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) 
    {
         // In addition to further coarse universe selection, ensure the security has fundamental data
         return (from c in coarse
             where c.HasFundamentalData
             select c.Symbol);
    }
    // filter based on FineFundamental
    public IEnumerable<Symbol> FineFundamentalFilterFunction(IEnumerable<FineFundamental> fine)
    {
        // Return a list of Symbols
    }
}
class MyUniverseAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.AddUniverse(self.CoarseFilterFunction, self.FineFundamentalFunction)

    def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        # In addition to further coarse universe selection, ensure the security has fundamental data
        return [c.Symbol for c in coarse if c.HasFundamentalData]

    def FineFundamentalFunction(self, fine: List[FineFundamental]) -> List[Symbol]:
        # Return a list of Symbols

FineFundamental objects have the following attributes:

Example

The simplest example of accessing the fundamental object would be harnessing the iconic PE ratio for a stock. This is a ratio of the price it commands to the earnings of a stock. The lower the PE ratio for a stock, the more affordable it appears.

// Take the top 50 by dollar volume using coarse
// Then the top 10 by PERatio using fine
AddUniverse(
    coarse => {
        return (from c in coarse
            where c.Price > 10 && c.HasFundamentalData
            orderby c.DollarVolume descending
            select c.Symbol).Take(50);
    },
    fine => {
        return (from f in fine
            orderby f.ValuationRatios.PERatio ascending
            select f.Symbol).Take(10);
    });
# In Initialize:
self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)

def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
    filtered = [x.Symbol for x in sortedByDollarVolume if x.HasFundamentalData]
    return filtered[:50]

def FineSelectionFunction(self, fine: List[FineFundamental]) -> List[Symbol]:
    sortedByPeRatio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=False)
    return [x.Symbol for x in sortedByPeRatio[:10]]

Asset Categories

In addition to valuation ratios, the US Fundamental Data from Morningstar has many other data point attributes, including over 200 different categorization fields for each US stock. Morningstar groups these fields into sectors, industry groups, and industries.

Sectors are large super categories of data. To get the sector of a stock, use the MorningstarSectorCode property.

var tech = fine.Where(x => x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology);
tech = [x for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology]

Industry groups are clusters of related industries that tie together. To get the industry group of a stock, use the MorningstarIndustryGroupCode property.

var ag = fine.Where(x => x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.Agriculture);
ag = [x for x in fine if x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.Agriculture]

Industries are the finest level of classification available. They are the individual industries according to the Morningstar classification system. To get the industry of a stock, use the MorningstarIndustryCode .

var coal = fine.Where(x => x.AssetClassification.MorningstarIndustryCode == MorningstarSectorCode.Coal);
coal = [x for x in fine if x.AssetClassification.MorningstarIndustryCode == MorningstarSectorCode.Coal]

Practical Limitations

Like coarse universes, fine universes allow you to select an unlimited universe of assets to analyze. Each asset in the universe consumes approximately 5MB of RAM, so you may quickly run out of memory if your universe filter selects many assets. If you backtest your algorithms in the Algorithm Lab, familiarize yourself with the RAM capacity of your backtesting and live trading nodes . To keep your algorithm fast and efficient, only subscribe to the assets you need.

Selection Frequency

Equity universes run on a daily basis.

Live Trading Considerations

The live data for coarse and fine universe selection arrives at 7 AM Eastern Time (ET), so coarse and fine universe selection runs for live algorithms between 7 and 8 AM ET. This timing allows you to place trades before the market opens. Don't schedule anything for midnight because the universe selection data isn't ready yet.

Examples

The following examples are typical filter functions you may want.

Example 1: Take 500 stocks that are worth more than $10 and have more than $10M daily trading volume

The most common use case is to select a lot of liquid stocks. With a coarse universe filter, this is simple and fast. The following example selects the top most liquid 500 stocks over $10 per share.

IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) 
{
    // Linq makes this a piece of cake;
    return (from c in coarse
        where c.DollarVolume > 10000000 &&
            c.Price > 10
        orderby c.DollarVolume descending
        select c.Symbol).Take(500);
}
def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
    filtered = [ x.Symbol for x in sortedByDollarVolume 
                if x.Price > 10 and x.DollarVolume > 10000000 ]
    return filtered[:500]

Example 2: Take 10 stocks above their 200-Day EMA and have more than $1B daily trading volume

Another common request is to filter the universe by a technical indicator, such as only picking stocks above their 200-day EMA. The CoarseFundamental object has adjusted price and volume information, so you can do any price-related analysis.

ConcurrentDictionary<Symbol, SelectionData>
    _stateData = new ConcurrentDictionary<Symbol, SelectionData>();

// Coarse filter function
IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) {
    // Linq makes this a piece of cake;
    return (from c in coarse
        let avg = _stateData.GetOrAdd(c.Symbol, sym => new SelectionData(200))
        where avg.Update(c.EndTime, c.AdjustedPrice)
        where c.DollarVolume > 1000000000 &&
                c.Price > avg.Ema
        orderby c.DollarVolume descending
        select c.Symbol).Take(10);
}
# setup state storage in initialize method
self.stateData = { }

def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    # We are going to use a dictionary to refer the object that will keep the moving averages
    for c in coarse:
        if c.Symbol not in self.stateData:
            self.stateData[c.Symbol] = SelectionData(c.Symbol, 200)

        # Updates the SymbolData object with current EOD price
        avg = self.stateData[c.Symbol]
        avg.update(c.EndTime, c.AdjustedPrice, c.DollarVolume)

    # Filter the values of the dict to those above EMA and more than $1B vol.
    values = [x for x in self.stateData.values() if x.is_above_ema and x.volume > 1000000000]
    
    # sort by the largest in volume.
    values.sort(key=lambda x: x.volume, reverse=True)

    # we need to return only the symbol objects
    return [ x.symbol for x in values[:10] ]

In this example, the SelectionData class group variables for the universe selection and updates the indicator of each asset. We highly recommend you follow this pattern to keep your algorithm tidy and bug free. The following snippet shows an example implementation of the SelectionData class, but you can make this whatever you need to store your custom universe filters.

class SelectionData(object):
    def __init__(self, symbol, period):
        self.symbol = symbol
        self.ema = ExponentialMovingAverage(period)
        self.is_above_ema = False
        self.volume = 0

    def update(self, time, price, volume):
        self.volume = volume
        if self.ema.Update(time, price):
            self.is_above_ema = price > ema
// example selection data class
private class SelectionData
{
    // variables you need for selection
    public readonly ExponentialMovingAverage Ema;

    // initialize your variables and indicators.
    public SelectionData(int period)
    {
        Ema = new ExponentialMovingAverage(period);
    }

    // update your variables and indicators with the latest data.
    // you may also want to use the History API here.
    public bool Update(DateTime time, decimal value)
    {
        return Ema.Update(time, value);
    }
}

Note that the preceding SelectionData class uses a manual EMA indicator instead of the automatic version . For more information about universes that select assets based on indicators, see Indicator Universes .

Example 3: Take 10 stocks that are the furthest above their 10-day SMA of volume

The process to get the 10-day SMA stock volume is the same process as in Example 2. First, you should define a SelectionData class that performs the averaging. For this example, the following class will serve this purpose:

class SelectionData(object):
    def __init__(self, symbol, period):
        self.symbol = symbol
        self.volume = 0
        self.volume_ratio = 0
        self.sma = SimpleMovingAverage(period)

    def update(self, time, price, volume):
        self.volume = volume
        if self.sma.Update(time, volume):
            # get ratio of this volume bar vs previous 10 before it.
            self.volume_ratio = volume / self.sma.Current.Value
private class SelectionData
{
    public readonly Symbol Symbol;
    public readonly SimpleMovingAverage VolumeSma;
    public decimal VolumeRatio;
    public SelectionData(Symbol symbol, int period)
    {
        Symbol = symbol;
        VolumeSma = new SimpleMovingAverage(period);
    }
    public bool Update(DateTime time, decimal value)
    {
        var ready = VolumeSma.Update(time, value);
        VolumeRatio = value / VolumeSma;
        return ready;
    }
}

This class tracks the ratio of today's volume relative to historical volumes. You can use this ratio to select assets that are above their 10-day simple moving average and sort the results by the ones that have had the biggest jump since yesterday.

def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    for c in coarse:
        if c.Symbol not in self.stateData:
            self.stateData[c.Symbol] = SelectionData(c.Symbol, 10)
        avg = self.stateData[c.Symbol]
        avg.update(c.EndTime, c.AdjustedPrice, c.DollarVolume)

    # filter the values of selectionData(sd) above SMA
    values = [sd for sd in self.stateData.values() if sd.volume > sd.sma.Current.Value and sd.volume_ratio > 0]
        
    # sort sd by the largest % jump in volume.
    values.sort(key=lambda sd: sd.volume_ratio, reverse=True)

    # return the top 10 symbol objects
    return [ sd.symbol for sd in values[:10] ]
 
IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) 
{ return (from c in coarse let avg = _stateData.GetOrAdd(c.Symbol, sym => new SelectionData(10)) where avg.Update(c.EndTime, c.Volume) where c.Volume > avg.VolumeSma orderby avg.VolumeRatio descending select c.Symbol).Take(10); }

Example 4: Take the top 10 "fastest moving" stocks with a 50-Day EMA > 200 Day EMA

You can construct complex universe filters with the SelectionData helper class pattern. To view a full example of this algorithm, see the EmaCrossUniverseSelectionAlgorithm EmaCrossUniverseSelectionAlgorithm in the LEAN GitHub repository or take the related Boot Camp lesson .

Demonstration Algorithms
CoarseUniverseTop3DollarVolumeAlgorithm.py Python EmaCrossUniverseSelectionAlgorithm.py Python DropboxUniverseSelectionAlgorithm.py Python WeeklyUniverseSelectionRegressionAlgorithm.py Python CoarseFineFundamentalComboAlgorithm.py Python CoarseUniverseTop3DollarVolumeAlgorithm.cs C# EmaCrossUniverseSelectionAlgorithm.cs C# DropboxUniverseSelectionAlgorithm.cs C# WeeklyUniverseSelectionRegressionAlgorithm.cs C# CoarseFineFundamentalComboAlgorithm.cs C#

 

5.4 Equity Options

Introduction

An Equity Options universe lets you select a basket of contracts for a single Option. LEAN models Option subscriptions as a universe of Option contracts.

Create Universes

To add a universe of Equity Option contracts, in the Initialize method, call the AddOption method. This method returns an Option object, which contains the canonical Symbol . You can't trade with the canonical Option Symbol , but save a reference to it so you can easily access the Option contracts in the OptionChain that LEAN passes to the OnData method.

var option = AddOption("SPY");
_symbol = option.Symbol;
option = self.AddOption("SPY")
self.symbol = option.Symbol

The following table describes the AddOption method arguments:

Argument Data Type Description Default Value
ticker string str The underlying Equity ticker. To view the supported underlying Equity tickers, see Supported Assets .
resolution Resolution? Resolution/NoneType The resolution of the market data. To view the supported resolutions, see Resolutions . The Equity resolution must be less than or equal to the Equity Option resolution. For example, if you set the Equity resolution to minute, then you must set the Equity Option resolution to minute, hour, or daily. None null
market string str The underlying Equity market. None null
fillForward bool If true, the current slice contains the last available data even if there is no data at the current time. True true
leverage decimal float The leverage for this Equity. Security.NullLeverage
extendedMarketHours bool A flag that signals if LEAN should send data during pre- and post-market trading hours. False false

If you add an Option universe for an underlying Equity that you don't have a subscription for, LEAN automatically subscribes to the underlying Equity with a data normalization mode of Raw . If you already have a subscription to the underlying Equity but it's not Raw , it automatically changes to Raw .

To override the default pricing model of the Option, set a pricing model .

option.PriceModel = OptionPriceModels.CrankNicolsonFD();
option.PriceModel = OptionPriceModels.CrankNicolsonFD()

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Filter Contracts

By default, LEAN subscribes to the Option contracts that have the following characteristics:

LEAN adds all of the Option contracts that meet the filter requirements to the Slice it passes to the OnData method. To adjust the universe of Option contracts, in the Initialize method, call the SetFilter method of the Option object. The following table describes the available filter techniques:

Method
Description
SetFilter(int minStrike, int maxStrike) SetFilter(minStrike: int, maxStrike: int) Selects the contracts that have a strike price within a minimum and maximum strike level relative to the underlying price. For example, say the underlying price is $302 and there are strikes at every $5. If you set minStrike to -1 and maxStrike to 1, LEAN selects the contracts that have a strike of $300 or $305.
SetFilter(TimeSpan minExpiry, TimeSpan maxExpiry) SetFilter(minExpiry: timedelta, maxExpiry: timedelta) Selects the contracts that expire within the range you set.
SetFilter(int minStrike, int maxStrike, TimeSpan minExpiry, TimeSpan maxExpiry) SetFilter(minStrike: int, maxStrike: int, minExpiry: timedelta, maxExpiry: timedelta) Selects the contracts that expire and have a strike within the range you set.
SetFilter(Func<OptionFilterUniverse, OptionFilterUniverse> universeFunc) SetFilter(universeFunc: Callable[[OptionFilterUniverse], OptionFilterUniverse]) Selects the contracts that a function selects.
// Select contracts that have a strike price within 1 strike level above and below the underlying price
option.SetFilter(minStrike: -1, maxStrike: 1);

// Select contracts that expire within 30 days
option.SetFilter(minExpiry: TimeSpan.FromDays(0), maxExpiry: TimeSpan.FromDays(30));

// Select contracts that have a strike price within 1 strike level and expire within 30 days
option.SetFilter(minStrike: -1, maxStrike: 1, minExpiry: TimeSpan.FromDays(0), maxExpiry: TimeSpan.FromDays(30));

// Select call contracts
option.SetFilter(optionFilterUniverse => optionFilterUniverse.CallsOnly());
# Select contracts that have a strike price within 1 strike level above and below the underlying price
option.SetFilter(minStrike=-1, maxStrike=1)

# Select contracts that expire within 30 days
option.SetFilter(minExpiry=timedelta(days=0), maxExpiry=timedelta(days=30))

# Select contracts that have a strike price within 1 strike level and expire within 30 days
option.SetFilter(minStrike=-1, maxStrike=1, minExpiry=timedelta(days=0), maxExpiry=timedelta(days=30))

# Select call contracts
option.SetFilter(lambda option_filter_universe: option_filter_universe.CallsOnly())

The following table describes the filter methods of the OptionFilterUniverse class:

Method Description
Strikes(int minStrike, int maxStrike) Strikes(minStrike: int, maxStrike: int) Selects contracts that are within minStrike strikes below the underlying price and maxStrike strikes above the underlying price
CallsOnly() Selects call contracts
PutsOnly() Selects put contracts
StandardsOnly() Selects standard contracts
IncludeWeeklys() Selects non-standard weeklys contracts
WeeklysOnly() Selects weekly contracts
FrontMonth() Selects the front month contract
BackMonths() Selects the non-front month contracts
BackMonth() Selects the back month contracts
Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

The preceding methods return an OptionFilterUniverse , so you can chain the methods together.

// Example 1: Select the front month call contracts
option.SetFilter(optionFilterUniverse => optionFilterUniverse.CallsOnly().FrontMonth());

// Example 2: Select the contracts (including weeklys) that expire in the next 90 days
option.SetFilter(optionFilterUniverse => optionFilterUniverse.IncludeWeeklys().Strikes(-20, 20).Expiration(0, 90));
# Example 1: Select the front month call contracts
option.SetFilter(lambda option_filter_universe: option_filter_universe.CallsOnly().FrontMonth())

# Example 2: Select the contracts (including weeklys) that expire in the next 90 days
option.SetFilter(lambda option_filter_universe: option_filter_universe.IncludeWeeklys().Strikes(-20, 20).Expiration(0, 90))

To perform thorough filtering on the OptionFilterUniverse , define an isolated filter method.

// In Initialize
option.SetFilter(Selector);
    
private OptionFilterUniverse Selector(OptionFilterUniverse optionFilterUniverse)
{
    var symbols = optionFilterUniverse.PutsOnly();
    var strike = symbols.Select(symbol => symbol.ID.StrikePrice).Min();
    symbols = symbols.Where(symbol => symbol.ID.StrikePrice == strike);
    return optionFilterUniverse.Contracts(symbols);
}
# In Initialize
option.SetFilter(self.contract_selector)
    
def contract_selector(self, option_filter_universe: OptionFilterUniverse) -> OptionFilterUniverse:
    symbols = option_filter_universe.PutsOnly()
    strike = min([symbol.ID.StrikePrice for symbol in symbols])
    symbols = [symbol for symbol in symbols if symbol.ID.StrikePrice == strike]
    return option_filter_universe.Contracts(symbols)

Some of the preceding filter methods only set an internal enumeration in the OptionFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the OptionFilterUniverse .

By default, LEAN adds contracts to the OptionChain that pass the filter criteria at every time step in your algorithm. If a contract has been in the universe for a duration that matches the MinimumTimeInUniverse setting and it no longer passes the filter criteria, LEAN removes it from the chain.

Navigate Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , index the OptionChains property of the Slice with the canonical Symbol . After you get the OptionChain , you can sort and filter the Option contracts in the chain.

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_symbol, out var chain))
    {
        // Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        var contracts = chain
            .Where(x => x.Right == OptionRight.Put)
            .OrderByDescending(x => x.Expiry)
            .ThenBy(x => Math.Abs(chain.Underlying.Price - x.Strike))
            .Take(5);

        // Select the contract with the delta closest to -0.5
        var contract = contracts.OrderBy(x => Math.Abs(-0.5m - x.Greeks.Delta)).FirstOrDefault();
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_symbol, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.symbol)
    if chain:
        # Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        contracts = [x for x in chain if x.Right == OptionRight.Put]
        contracts = sorted(sorted(contracts, \
            key = lambda x: abs(chain.Underlying.Price - x.Strike)), \
            key = lambda x: x.Expiry, reverse=True)[:5]

        # Select the contract with the delta closest to -0.5
        contract = sorted(contracts, key=lambda x: abs(-0.5 - x.Greeks.Delta))[0]

You can also loop through the OptionChains property to get each OptionChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canoncialSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var canoncialSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        contracts = chain.Contracts

Selection Frequency

By default, Equity Option universes run at every time step to select their contracts. If you add the OnlyApplyFilterAtMarketOpen method to your contract filter, the universe selects contracts once a day at the first time step.

 

5.5 Crypto

Introduction

A Crypto universe lets you select a basket of Cryptocurrencies based on CryptoCoarseFundamental data.

Crypto Universes

To add a universe of Cryptocurrencies, in the Initialize method, pass a CryptoCoarseFundamentalUniverse to the AddUniverse method.

def Initialize(self) -> None:
    self.UniverseSettings.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

    # Add universe selection of cryptos based on coarse fundamentals
    filter_function = lambda crypto_coarse: [c.Symbol for c in crypto_coarse]
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.GDAX, self.UniverseSettings, filter_function))
public override void Initialize()
{
    UniverseSettings.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

    // Add universe selection of cryptos based on coarse fundamentals
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.GDAX, UniverseSettings, cryptoCoarse => from x in cryptoCoarse select x.Symbol));
}

The following table describes the CryptoCoarseFundamentalUniverse constructor arguments:

Argument Data Type Description Default Value
market string str The market of the Cryptocurrencies. To view the available Crypto markets, see the CoinAPI datasets .
universeSettings UniverseSettings The universe settings .
universeFilterFunc Func<IEnumerable<CryptoCoarseFundamental>, IEnumerable<Symbol>> Callable[[List[CryptoCoarseFundamental]], List[Symbol]] A function to select some of the Cryptocurrencies for the universe.

The filter function receives CryptoCoarseFundamental objects, which represent one of the Cryptocurrencies in the market. The Symbol objects that the filter function returns represent the universe constituents. CryptoCoarseFundamental objects have the following attributes:

To perform thorough filtering on the CryptoCoarseFundamental objects, define an isolated filter method.

def Initialize(self) -> None:
    self.UniverseSettings.Resolution = Resolution.Daily
    self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

    # Add universe selection of cryptos based on coarse fundamentals
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.GDAX, self.UniverseSettings, self.universe_filter))

def universe_filter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    # Define the universe selection function
    return [cf.Symbol for cf in crypto_coarse if cf.Volume >= 100 and cf.VolumeInUsd > 10000]
public override void Initialize()
{
    UniverseSettings.Resolution = Resolution.Daily;
    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

    // Add universe selection of cryptos based on coarse fundamentals
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.GDAX, UniverseSettings, UniverseFilter));
}

private IEnumerable<Symbol> UniverseFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return cryptoCoarse.Where(cf => cf.Volume >= 100m && cf.VolumeInUsd > 10000m).Select(x => x.Symbol);
}

Selection Frequency

Crypto universes run on a daily basis.

Live Trading Considerations

In live mode, the pipeline has a 16-hour delay. Your algorithm receives the CryptoCoarseFundamental objects at around 16:00-16:30 Coordinated Universal Time (UTC) each day, depending on the data processing task.

 

5.6 Futures

Introduction

A Futures universe lets you select a basket of contracts for a single Future. LEAN models Future subscriptions as a universe of Future contracts. A Future universe is similar to an Option universe , except Future contracts don't have a strike price, so the universe filter primarily focuses on the contract expiration date.

Create Universes

To add a universe of Future contracts, in the Initialize method, call the AddFuture method. This method returns an Future object, which contains the continuous contract Symbol . The continuous contract Symbol is the key to access the contracts in the FutureChain that LEAN passes to the OnData method. When you create the Future subscription, save a reference to the continuous contract Symbol so you can use it later in your algorithm.

_future = AddFuture(Futures.Currencies.BTC);
_symbol = _future.Symbol;
self.future = self.AddFuture(Futures.Currencies.BTC)
self.symbol = self.future.Symbol

The following table describes the AddFuture method arguments:

Argument: ticker

The Future ticker. To view the supported assets in the US Futures dataset, see Supported Assets .

Data Type: string str | Default Value: None

Argument: resolution

The resolution of the market data. To view the supported resolutions, see Resolutions . If you don't provide a value, it uses Resolution.Minute by default.

Data Type: Resolution? Resolution/NoneType | Default Value: None null

Argument: market

The Futures market. To view the supported markets in the US Futures dataset, see Supported Markets . If you don't provide a value, it uses the default Future market of your brokerage model .

Data Type: string str | Default Value: None null

Argument: fillForward

If true, the current slice contains the last available data even if there is no data at the current time.

Data Type: bool | Default Value: True true

Argument: leverage

The leverage for this Future.

Data Type: decimal float | Default Value: Security.NullLeverage

Argument: extendedMarketHours

If true, use data from the pre and post market sessions

Data Type: bool | Default Value: False false

Argument: dataMappingMode

The contract mapping mode to use for the continuous future contract

Data Type: DataMappingMode? DataMappingMode/NoneType | Default Value: None null

Argument: dataNormalizationMode

The price scaling mode to use for the continuous future contract

Data Type: DataNormalizationMode? DataNormalizationMode/NoneType | Default Value: None null

Argument: contractDepthOffset

The continuous future contract desired offset from the current front month. For example, 0 is the front month, 1 is the back month contract.

Data Type: int | Default Value: 0

Continous Contracts

By default, LEAN only subscribes to the continuous Future contract. A continuous Future contract represents a series of separate contracts stitched together to form a continuous price. If you need a lot of historical data to warm up an indicator, apply the indicator to the continuous contract price series. The Future object has a Symbol property and a Mapped property. The price of the Symbol property is the adjusted price of the continuous contract. The price of the Mapped property is the raw price of the currently selected contract in the continuous contract series.

// Get the adjusted price of the continuous contract
var adjustedPrice = Securities[_future.Symbol].Price; 

// Get the raw price of the currently selected contract in the continuous contract series
var rawPrice = Securities[_future.Mapped].Price;
# Get the adjusted price of the continuous contract
adjusted_price = self.Securities[self.future.Symbol].Price 

# Get the raw price of the currently selected contract in the continuous contract series
raw_price = self.Securities[self.future.Mapped].Price

To configure how LEAN identifies the current Future contract in the continuous series and how it forms the adjusted price between each contract, provide dataMappingMode , dataNormalizationMode , and contractDepthOffset arguments to the AddFuture method. The Future object that the AddFuture method returns contains a Mapped property that references the current contract in the continuous contract series. As the contracts roll over, the Mapped property references the next contract in the series and you receive a SymbolChangedEvent object in the OnData method. The SymbolChangedEvent references the old contract Symbol and the new contract Symbol .

public override void OnData(Slice slice)
{
    foreach (var changedEvent in slice.SymbolChangedEvents.Values)
    {
        Log($"Symbol changed: {changedEvent.OldSymbol} -> {changedEvent.NewSymbol}");
    }
}
def OnData(self, slice: Slice) -> None:
    for changed_event in slice.SymbolChangedEvents.Values:
        self.Log(f"Contract rollover from {changed_event.OldSymbol} to {changed_event.NewSymbol}")

Data Normalization Modes

The dataNormalizationMode argument defines how the price series of two contracts are stitched together when the contract rollovers occur. The following DataNormalizatoinMode enumeration members are available for continuous contracts:

We use the entire Futures history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

Data Mapping Modes

The dataMappingMode argument defines when contract rollovers occur. The DataMappingMode enumeration has the following members:

Contract Depth Offsets

The contractDepthOffset argument defines which contract to use. 0 is the front month contract, 1 is the following back month contract, and 3 is the second back month contract.

Filter Contracts

By default, LEAN doesn't add any contracts to the FuturesChain it passes to the OnData method. To add a universe of Future contracts, in the Initialize method, call the SetFilter method of the Future object. The following table describes the available filter techniques:

Method
Description
SetFilter(int minExpiryDays, int maxExpiryDays) SetFilter(minExpiryDays: int, maxExpiryDays: int) Selects the contracts that expire within the range you set.
SetFilter(Func<FutureFilterUniverse, FutureFilterUniverse> universeFunc) SetFilter(universeFunc: Callable[[FutureFilterUniverse], FutureFilterUniverse]) Selects the contracts that a function selects.
# Select the contracts which expire within 182 days
self.future.SetFilter(0, 182)

# Select the front month contract
self.future.SetFilter(lambda future_filter_universe: future_filter_universe.FrontMonth())
// Select the contracts which expire within 182 days
_future.SetFilter(0, 182);

// Select the front month contract
_future.SetFilter(futureFilterUniverse => futureFilterUniverse.FrontMonth());

The following table describes the filter methods of the FutureFilterUniverse class:

Method Description
StandardsOnly() Selects standard contracts
IncludeWeeklys() Selects non-standard weekly contracts
WeeklysOnly() Selects weekly contracts
FrontMonth() Selects the front month contract
BackMonths() Selects the non-front month contracts
BackMonth() Selects the back month contracts
Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

The preceding methods return an FutureFilterUniverse , so you can chain the methods together.

// Select the front month call contracts
_future.SetFilter(futureFilterUniverse => futureFilterUniverse.StandardsOnly().FrontMonth());
# Select the front month call contracts
self.future.SetFilter(lambda future_filter_universe: future_filter_universe.StandardsOnly().FrontMonth())

You can also define an isolated filter method.

// In Initialize
_future.SetFilter(Selector);
    
private FutureFilterUniverse Selector(FutureFilterUniverse futureFilterUniverse)
{
    return futureFilterUniverse.StandardsOnly().FrontMonth();
}
# In Initialize
self.future.SetFilter(self.contract_selector)
    
def contract_selector(self, 
    future_filter_universe: Callable[[FutureFilterUniverse], FutureFilterUniverse]) -> FutureFilterUniverse:
    return future_filter_universe.StandardsOnly().FrontMonth()

Some of the preceding filter methods only set an internal enumeration in the FutureFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the FutureFilterUniverse .

By default, LEAN adds contracts to the FutureChain that pass the filter criteria at every time step in your algorithm. If a contract has been in the universe for a duration that matches the MinimumTimeInUniverse setting and it no longer passes the filter criteria, LEAN removes it from the chain

Navigate Futures Chains

FuturesChain objects represent an entire chain of contracts for a single underlying Future. They have the following properties:

To get the FuturesChain , index the FuturesChains property of the Slice with the continuous contract Symbol .

public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_symbol, out var chain))
    {
        // Example: Select the contract with the greatest open interest
        var contract = chain.OrderBy(x => x.OpenInterest).Last();
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.symbol)
    if chain:
        # Example: Select the contract with the greatest open interest
        contract = sorted(chain, key=lambda contract: contract.OpenInterest, reverse=True)[0]

You can also loop through the FuturesChains property to get each FuturesChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
    }
}

public void OnData(FuturesChains futuresChains)
{
    foreach (var kvp in futuresChains)
    {
        var continuousContractSymbol = kvp.Key;
        var chain = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for continuous_contract_symbol, chain in slice.FuturesChains.items():
        pass

Selection Frequency

By default, Futures universes run at every time step to select their contracts. If you add the OnlyApplyFilterAtMarketOpen method to your contract filter, the universe selects contracts once a day at the first time step.

 

5.7 Future Options

Introduction

A Future Option universe lets you select a basket of Option contracts on the contracts in a Futures universe .

Create Universes

To add a universe of Future Option contracts, in the Initialize method, define a Future universe and then pass the canonical Symbol to the AddFutureOption method.

var future = AddFuture(Futures.Metals.Gold);
future.SetFilter(0, 90);
AddFutureOption(future.Symbol);
future = self.AddFuture(Futures.Metals.Gold)
future.SetFilter(0, 90)
self.AddFutureOption(future.Symbol)

The following table describes the AddFutureOption method arguments:

Argument Data Type Description Default Value
symbol Symbol The continuous Future contract Symbol. To view the supported assets in the US Future Options dataset, see Supported Assets .
optionFilter Func<OptionFilterUniverse, OptionFilterUniverse> Callable[[OptionFilterUniverse], OptionFilterUniverse] A function that selects Future Option contracts null None

To override the default pricing model of the Option, set a pricing model in a security initializer.

// In Initialize
var seeder = SecuritySeeder.Null;
SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, seeder, this));

// Outside of the algorithm class
class MySecurityInitializer : BrokerageModelSecurityInitializer
{
    private QCAlgorithm _algorithm;

    public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder, QCAlgorithm algorithm)
        : base(brokerageModel, securitySeeder) 
    {
        _algorithm = algorithm;
    }
    
    public override void Initialize(Security security)
    {
        // First, call the superclass definition
        // This method sets the reality models of each security using the default reality models of the brokerage model
        base.Initialize(security);

        // Next, set the price model
        if (security.Type == SecurityType.FutureOption) // Option type
        {
            security.PriceModel = OptionPriceModels.CrankNicolsonFD();
        }
    }
}
# In Initialize
seeder = SecuritySeeder.Null
self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, seeder, self))

# Outside of the algorithm class
class MySecurityInitializer(BrokerageModelSecurityInitializer):

    def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder, algorithm: QCAlgorithm) -> None:
        super().__init__(brokerage_model, security_seeder)
        self.algorithm = algorithm

    def Initialize(self, security: Security) -> None:
        # First, call the superclass definition
        # This method sets the reality models of each security using the default reality models of the brokerage model
        super().Initialize(security)

        # Next, set the price model
        if security.Type == SecurityType.FutureOption: # Option type
            security.PriceModel = OptionPriceModels.CrankNicolsonFD()

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Filter Contracts

By default, LEAN subscribes to the Option contracts that have the following characteristics:

LEAN adds all of the Option contracts that meet the filter requirements to the Slice it passes to the OnData method. To adjust the universe of contracts, pass a filter function to the AddFutureOption method.

AddFutureOption(future.Symbol, optionFilterUniverse => optionFilterUniverse.Strikes(-1, 1));
self.AddFutureOption(future.Symbol, lambda option_filter_universe: option_filter_universe.Strikes(-1, 1))

The following table describes the filter methods of the OptionFilterUniverse class:

Method Description
Strikes(int minStrike, int maxStrike) Strikes(minStrike: int, maxStrike: int) Selects contracts that are within minStrike strikes below the underlying price and maxStrike strikes above the underlying price
CallsOnly() Selects call contracts
PutsOnly() Selects put contracts
StandardsOnly() Selects standard contracts
IncludeWeeklys() Selects non-standard weeklys contracts
WeeklysOnly() Selects weekly contracts
FrontMonth() Selects the front month contract
BackMonths() Selects the non-front month contracts
BackMonth() Selects the back month contracts
Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

The preceding methods return an OptionFilterUniverse , so you can chain the methods together.

AddFutureOption(future.Symbol, optionFilterUniverse => optionFilterUniverse.Strikes(-1, 1).CallsOnly());
self.AddFutureOption(future.Symbol, lambda option_filter_universe: option_filter_universe.Strikes(-1, 1).CallsOnly())

To perform thorough filtering on the OptionFilterUniverse , define an isolated filter method.

# In Initialize
AddFutureOption(future.Symbol, Selector);
        
private OptionFilterUniverse Selector(OptionFilterUniverse optionFilterUniverse)
{
    var symbols = optionFilterUniverse.PutsOnly();
    var strike = symbols.Select(symbol => symbol.ID.StrikePrice).Min();
    symbols = symbols.Where(symbol => symbol.ID.StrikePrice == strike);
    return optionFilterUniverse.Contracts(symbols);
}
# In Initialize
self.AddFutureOption(future.Symbol, self.contract_selector)

def contract_selector(self, option_filter_universe: OptionFilterUniverse) -> OptionFilterUniverse:
    symbols = option_filter_universe.PutsOnly()
    strike = min([symbol.ID.StrikePrice for symbol in symbols])
    symbols = [symbol for symbol in symbols if symbol.ID.StrikePrice == strike]
    return option_filter_universe.Contracts(symbols)

Some of the preceding filter methods only set an internal enumeration in the OptionFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the OptionFilterUniverse .

By default, LEAN adds contracts to the OptionChain that pass the filter criteria at every time step in your algorithm. If a contract has been in the universe for a duration that matches the MinimumTimeInUniverse setting and it no longer passes the filter criteria, LEAN removes it from the chain.

Navigate Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , loop through the OptionChains property. After you get the OptionChain , you can sort and filter the Option contracts in the chain.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var optionChain = kvp.Value;
        // Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        var contracts = optionChain
            .Where(x => x.Right == OptionRight.Put)
            .OrderByDescending(x => x.Expiry)
            .ThenBy(x => Math.Abs(chain.Underlying.Price - x.Strike))
            .Take(5);

        // Select the contract with the delta closest to -0.5
        var contract = contracts.OrderBy(x => Math.Abs(-0.5m - x.Greeks.Delta)).FirstOrDefault();
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var optionChain = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for _, option_chain in slice.OptionChains.items():
        # Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        contracts = [x for x in option_chain if x.Right == OptionRight.Put]
        contracts = sorted(sorted(contracts, \
            key = lambda x: abs(option_chain.Underlying.Price - x.Strike)), \
            key = lambda x: x.Expiry, reverse=True)[:5]

        # Select the contract with the delta closest to -0.5
        contract = sorted(contracts, key=lambda x: abs(-0.5 - x.Greeks.Delta))[0]

You can also iterate through the FuturesChains first.

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var futuresChain = kvp.Value;
        
        // Select a Future Contract and create its canonical FOP Symbol
        var futuresContract = futuresChain.First();
        var canonicalFOPSymbol = QuantConnect.Symbol.CreateCanonicalOption(futuresContract.Symbol);
        if (slice.OptionChains.TryGetValue(canonicalFOPSymbol, out var fopChain))
        {
            foreach (var contract in fopChain)
            {
                // 
            }
        }
    }
}
public void OnData(FuturesChains futuresChains)
{
    foreach (var kvp in futuresChains)
    {
        var continuousContractSymbol = kvp.Key;
        var futuresChain = kvp.Value;
    }
}
def OnData(self, slice: Slice) -> None:
    for continuous_future_symbol, futures_chain in slice.FuturesChains.items():
        # Select a Future Contract and create its canonical FOP Symbol
        futures_contract = [contract for contract in futures_chain][0]
        canonical_fop_symbol = Symbol.CreateCanonicalOption(futures_contract.Symbol)
        fop_chain = slice.OptionChains.get(canonical_fop_symbol)
        if fop_chain:
            for contract in fop_chain:
                pass

Selection Frequency

By default, Future Option universes run at every time step to select their contracts. If you add the OnlyApplyFilterAtMarketOpen method to your contract filter, the universe selects contracts once a day at the first time step.

 

5.8 Index Options

Introduction

An Index Option universe lets you select a basket of Option contracts on an Index.

Create Universes

To add a universe of Index Option contracts, in the Initialize method, call the AddIndexOption method. This method returns an Option object, which contains the canonical Symbol . You can't trade with the canonical Option Symbol , but save a reference to it so you can easily access the Option contracts in the OptionChain that LEAN passes to the OnData method. The method to create the universe depends on if the Index Options you want require a target ticker.

Create Standard Universes

To create a universe of Index Options based on an index like VIX, SPX, or NDX, pass the index ticker to the AddIndexOption method.

var option = AddIndexOption("VIX");
_symbol = option.Symbol;
option = self.AddIndexOption("VIX")
self.symbol = option.Symbol

The following table describes the AddIndexOption method arguments for standard universes:

Argument Data Type Description Default Value
ticker string str The underlying Index ticker. To view the supported indices, see Supported Assets .
resolution Resolution? Resolution/NoneType The resolution of the market data. To view the supported resolutions, see Resolutions . None null
market string str The Index Option market. Market.USA
fillForward bool If true, the current slice contains the last available data even if there is no data at the current time. True true

If you add an Option universe for an underlying Index that you don't have a subscription for, LEAN automatically subscribes to the underlying Index.

Create Non-Standard Universes

To create a universe of non-standard Index Options like weekly VIX contracts, pass the index Symbol and target Option ticker to the AddIndexOption method.

var indexSymbol = AddIndex("VIX").Symbol;
var option = AddIndexOption(indexSymbol, "VIXW");
_symbol = option.Symbol;
index_symbol = self.AddIndex("VIX").Symbol
option = self.AddIndexOption(index_symbol, "VIXW")
self.symbol = option.Symbol

The following table describes the AddIndexOption method arguments for non-standard universes:

Argument Data Type Description Default Value
underlying Symbol The underlying Index Symbol . To view the supported indices, see Supported Assets .
targetOption string str The target Option ticker. To view the supported target Options, see Supported Assets .
resolution Resolution? Resolution/NoneType The resolution of the market data. To view the supported resolutions, see Resolutions . The Index resolution must be less than or equal to the Index Option resolution. For example, if you set the Index resolution to minute, then you must set the Index Option resolution to minute, hour, or daily. None null
market string str The Index Option market. Market.USA
fillForward bool If true, the current slice contains the last available data even if there is no data at the current time. True true

If you add an Option universe for an underlying Index that you don't have a subscription for, LEAN automatically subscribes to the underlying Index.

Configure Reality Models

To override the default pricing model of the Option, set a pricing model .

option.PriceModel = OptionPriceModels.CrankNicolsonFD();
option.PriceModel = OptionPriceModels.CrankNicolsonFD()

To override the initial guess of implied volatility , set and warm up the underlying volatility model .

Filter Contracts

By default, LEAN subscribes to the Option contracts that have the following characteristics:

LEAN adds all of the Option contracts that meet the filter requirements to the Slice it passes to the OnData method. To adjust the universe of Option contracts, in the Initialize method, call the SetFilter method of the Option object. The following table describes the available filter techniques:

Method
Description
SetFilter(int minStrike, int maxStrike) SetFilter(minStrike: int, maxStrike: int) Selects the contracts that have a strike price within a minimum and maximum strike level relative to the underlying price. For example, say the underlying price is $302 and there are strikes at every $5. If you set minStrike to -1 and maxStrike to 1, LEAN selects the contracts that have a strike of $300 or $305.
SetFilter(TimeSpan minExpiry, TimeSpan maxExpiry) SetFilter(minExpiry: timedelta, maxExpiry: timedelta) Selects the contracts that expire within the range you set.
SetFilter(int minStrike, int maxStrike, TimeSpan minExpiry, TimeSpan maxExpiry) SetFilter(minStrike: int, maxStrike: int, minExpiry: timedelta, maxExpiry: timedelta) Selects the contracts that expire and have a strike within the range you set.
SetFilter(Func<OptionFilterUniverse, OptionFilterUniverse> universeFunc) SetFilter(universeFunc: Callable[[OptionFilterUniverse], OptionFilterUniverse]) Selects the contracts that a function selects.
// Select contracts that have a strike price within 1 strike level above and below the underlying price
option.SetFilter(minStrike: -1, maxStrike: 1);

// Select contracts that expire within 30 days
option.SetFilter(minExpiry: TimeSpan.FromDays(0), maxExpiry: TimeSpan.FromDays(30));

// Select contracts that have a strike price within 1 strike level and expire within 30 days
option.SetFilter(minStrike: -1, maxStrike: 1, minExpiry: TimeSpan.FromDays(0), maxExpiry: TimeSpan.FromDays(30));

// Select call contracts
option.SetFilter(optionFilterUniverse => optionFilterUniverse.CallsOnly());
# Select contracts that have a strike price within 1 strike level above and below the underlying price
option.SetFilter(minStrike=-1, maxStrike=1)

# Select contracts that expire within 30 days
option.SetFilter(minExpiry=timedelta(days=0), maxExpiry=timedelta(days=30))

# Select contracts that have a strike price within 1 strike level and expire within 30 days
option.SetFilter(minStrike=-1, maxStrike=1, minExpiry=timedelta(days=0), maxExpiry=timedelta(days=30))

# Select call contracts
option.SetFilter(lambda option_filter_universe: option_filter_universe.CallsOnly())

The following table describes the filter methods of the OptionFilterUniverse class:

Method Description
Strikes(int minStrike, int maxStrike) Strikes(minStrike: int, maxStrike: int) Selects contracts that are within minStrike strikes below the underlying price and maxStrike strikes above the underlying price
CallsOnly() Selects call contracts
PutsOnly() Selects put contracts
StandardsOnly() Selects standard contracts
IncludeWeeklys() Selects non-standard weeklys contracts
WeeklysOnly() Selects weekly contracts
FrontMonth() Selects the front month contract
BackMonths() Selects the non-front month contracts
BackMonth() Selects the back month contracts
Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

The preceding methods return an OptionFilterUniverse , so you can chain the methods together.

// Example 1: Select the front month call contracts
option.SetFilter(optionFilterUniverse => optionFilterUniverse.CallsOnly().FrontMonth());

// Example 2: Select the contracts (including weeklys) that expire in the next 90 days
option.SetFilter(optionFilterUniverse => optionFilterUniverse.IncludeWeeklys().Strikes(-20, 20).Expiration(0, 90));
# Example 1: Select the front month call contracts
option.SetFilter(lambda option_filter_universe: option_filter_universe.CallsOnly().FrontMonth())

# Example 2: Select the contracts (including weeklys) that expire in the next 90 days
option.SetFilter(lambda option_filter_universe: option_filter_universe.IncludeWeeklys().Strikes(-20, 20).Expiration(0, 90))

To perform thorough filtering on the OptionFilterUniverse , define an isolated filter method.

// In Initialize
option.SetFilter(Selector);
    
private OptionFilterUniverse Selector(OptionFilterUniverse optionFilterUniverse)
{
    var symbols = optionFilterUniverse.PutsOnly();
    var strike = symbols.Select(symbol => symbol.ID.StrikePrice).Min();
    symbols = symbols.Where(symbol => symbol.ID.StrikePrice == strike);
    return optionFilterUniverse.Contracts(symbols);
}
# In Initialize
option.SetFilter(self.contract_selector)
    
def contract_selector(self, option_filter_universe: OptionFilterUniverse) -> OptionFilterUniverse:
    symbols = option_filter_universe.PutsOnly()
    strike = min([symbol.ID.StrikePrice for symbol in symbols])
    symbols = [symbol for symbol in symbols if symbol.ID.StrikePrice == strike]
    return option_filter_universe.Contracts(symbols)

Some of the preceding filter methods only set an internal enumeration in the OptionFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the OptionFilterUniverse .

By default, LEAN adds contracts to the OptionChain that pass the filter criteria at every time step in your algorithm. If a contract has been in the universe for a duration that matches the MinimumTimeInUniverse setting and it no longer passes the filter criteria, LEAN removes it from the chain

Navigate Option Chains

OptionChain objects represent an entire chain of Option contracts for a single underlying security. They have the following properties:

To get the OptionChain , index the OptionChains property of the Slice with the canonical Symbol . After you get the OptionChain , you can sort and filter the Option contracts in the chain.

public override void OnData(Slice slice)
{
    if (slice.OptionChains.TryGetValue(_symbol, out var chain))
    {
        // Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        var contracts = chain
            .Where(x => x.Right == OptionRight.Put)
            .OrderByDescending(x => x.Expiry)
            .ThenBy(x => Math.Abs(chain.Underlying.Price - x.Strike))
            .Take(5);

        // Select the contract with the delta closest to -0.5
        var contract = contracts.OrderBy(x => Math.Abs(-0.5m - x.Greeks.Delta)).FirstOrDefault();
    }
}

public void OnData(OptionChains optionChains)
{
    if (optionChains.TryGetValue(_symbol, out var chain))
    {
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.symbol)
    if chain:
        # Example: Find 5 put contracts that are closest to at-the-money (ATM) and have the farthest expiration
        contracts = [x for x in chain if x.Right == OptionRight.Put]
        contracts = sorted(sorted(contracts, \
            key = lambda x: abs(chain.Underlying.Price - x.Strike)), \
            key = lambda x: x.Expiry, reverse=True)[:5]

        # Select the contract with the delta closest to -0.5
        contract = sorted(contracts, key=lambda x: abs(-0.5 - x.Greeks.Delta))[0]

You can also loop through the OptionChains property to get each OptionChain .

public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canoncialSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}

public void OnData(OptionChains optionChains)
{
    foreach (var kvp in optionChains)
    {
        var canoncialSymbol = kvp.Key;
        var chain = kvp.Value;
        var contracts = chain.Contracts;
    }
}
def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        contracts = chain.Contracts

Selection Frequency

By default, Index Option universes run at every time step to select their contracts. If you add the OnlyApplyFilterAtMarketOpen method to your contract filter, the universe selects contracts once a day at the first time step.

 

5.9 Custom Universes

Introduction

A custom universe lets you select a basket of assets from a custom dataset.

Data Sources

You can gather your custom data from any of the following sources:

The data source should serve data in chronological order and each data point should have a unique timestamp. Each request has a 1 second overhead, so bundle samples together for fast execution.

Define Custom Universe Types

Custom universes should extend the BaseData PythonData class. Extensions of the BaseData PythonData class must implement a GetSource and Reader method.

The GetSource method in your custom data class instructs LEAN where to find the data. This method must return a SubscriptionDataSource object, which contains the data location and format ( SubscriptionTransportMedium ). You can even change source locations for backtesting and live modes. We support many different data sources.

The Reader method of your custom data class takes one line of data from the source location and parses it into one of your custom objects. You can add as many properties to your custom data objects as you need, but must set Symbol and EndTime properties. When there is no useable data in a line, the method should return null None . LEAN repeatedly calls the Reader method until the date/time advances or it reaches the end of the file.

//Example custom universe data; it is virtually identical to other custom data types.
public class MyCustomUniverseDataClass : BaseData 
{
    public int CustomAttribute1;
    public decimal CustomAttribute2;
    public override DateTime EndTime 
    {
        // define end time as exactly 1 day after Time
        get { return Time + QuantConnect.Time.OneDay; }
        set { Time = value - QuantConnect.Time.OneDay; }
    }

    public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
    {
        return new SubscriptionDataSource(@"your-remote-universe-data", SubscriptionTransportMedium.RemoteFile);
    }

    public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) 
    {
        var items = line.Split(",");

        // Generate required data, then return an instance of your class.
        return new MyCustomUniverseDataClass 
        {
            EndTime = Parse.DateTimeExact(items[0], "yyyy-MM-dd"),
            Symbol = Symbol.Create(items[1], SecurityType.Equity, Market.USA),
            CustomAttribute1 = int.Parse(items[2]),
            CustomAttribute2 = decimal.Parse(items[3], NumberStyles.Any, CultureInfo.Invariant)
        };
    }
}
# Example custom universe data; it is virtually identical to other custom data types.
class MyCustomUniverseDataClass(PythonData):

    def GetSource(self, config: SubscriptionDataConfig, date: datetime, isLiveMode: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource(@"your-remote-universe-data", SubscriptionTransportMedium.RemoteFile)

    def Reader(self, config: SubscriptionDataConfig, line: str, date: datetime, isLiveMode: bool) -> BaseData:
        items = line.split(",")
    
        # Generate required data, then return an instance of your class.
        data = MyCustomUniverseDataClass()
        data.EndTime = datetime.strptime(items[0], "%Y-%m-%d")
        # define Time as exactly 1 day earlier Time
        data.Time = data.EndTime - timedelta(1)
        data.Symbol = Symbol.Create(items[1], SecurityType.Crypto, Market.Bitfinex)
        data["CustomAttribute1"] = int(items[2])
        data["CustomAttribute2"] = float(items[3])
        return data

Your Reader method should return objects in chronological order. If an object has a timestamp that is the same or earlier than the timestamp of the previous object, LEAN ignores it.

If you need to create multiple objects in your Reader method from a single line , follow these steps:

  1. In the GetSource method, pass FileFormat.UnfoldingCollection as the third argument to the SubscriptionDataSource constructor.
  2. In the Reader method, order the objects by their timestamp and then return a BaseDataCollection(endTime, config.Symbol, objects) where objects is a list of your custom data objects.
public class MyCustomUniverseDataClass : BaseData 
{
    [JsonProperty(PropertyName = "Attr1")]
    public int CustomAttribute1 { get; set; }

    [JsonProperty(PropertyName = "Ticker")]
    public string Ticker { get; set; }
    
    [JsonProperty(PropertyName = "date")]
    public DateTime Date { get; set; }

    public override DateTime EndTime 
    {
        // define end time as exactly 1 day after Time
        get { return Time + QuantConnect.Time.OneDay; }
        set { Time = value - QuantConnect.Time.OneDay; }
    }

    public MyCustomUniverseDataClass()
    {
        Symbol = Symbol.Empty;
        DataType = MarketDataType.Base;
    }
    
    public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
    {
        return new SubscriptionDataSource(@"your-data-source-url", 
            SubscriptionTransportMedium.RemoteFile,
            FileFormat.UnfoldingCollection);
    }

    public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) 
    {
        var items = JsonConvert.DeserializeObject<List<MyCustomUniverseDataClass>>(line);
        var endTime = items.Last().Date;

        foreach (var item in items)
        {
            item.Symbol = Symbol.Create(item.Ticker, SecurityType.Equity, Market.USA);
            item.Time = item.Date;
            item.Value = (decimal) item.CustomAttribute1;
        }

        return new BaseDataCollection(endTime, config.Symbol, items);
    }
}
class MyCustomUniverseDataClass(PythonData):
    
    def GetSource(self, config, date, isLive):
        return SubscriptionDataSource("your-data-source-url", SubscriptionTransportMedium.RemoteFile, FileFormat.UnfoldingCollection)

    def Reader(self, config, line, date, isLive):
        json_response = json.loads(line)
        
        endTime = datetime.strptime(json_response[-1]["date"], '%Y-%m-%d') + timedelta(1)

        data = list()

        for json_datum in json_response:
            datum = MyCustomUniverseDataClass()
            datum.Symbol = Symbol.Create(json_datum["Ticker"], SecurityType.Equity, Market.USA)
            datum.Time = datetime.strptime(json_datum["date"], '%Y-%m-%d') 
            datum.EndTime = datum.Time + timedelta(1)
            datum['CustomAttribute1'] = int(json_datum['Attr1'])
            datum.Value = float(json_datum['Attr1'])
            data.append(datum)

        return BaseDataCollection(endTime, config.Symbol, data)

Initialize Custom Universes

To add a custom universe to your algorithm, in the Initialize method, pass your universe type and a selector function to the AddUniverse method. The selector function receives a list of your custom objects and must return a list of Symbol objects. In the selector function definition, you can use any of the properties of your custom data type. The Symbol objects that you return from the selector function set the constituents of the universe.

// In Initialize
AddUniverse<MyCustomUniverseDataClass>("myCustomUniverse", Resolution.Daily, data => {
    return (from singleStockData in data
           where singleStockData.CustomAttribute1 > 0
           orderby singleStockData.CustomAttribute2 descending
           select singleStockData.Symbol).Take(5);
});
# In Initialize
self.AddUniverse(MyCustomUniverseDataClass, "myCustomUniverse", Resolution.Daily, self.selector_function)

# Define the selector function
def selector_function(self, data: List[MyCustomUniverseDataClass]) -> List[Symbol]:
    sorted_data = sorted([ x for x in data if x["CustomAttribute1"] > 0 ],
                         key=lambda x: x["CustomAttribute2"],
                         reverse=True)
    return [x.Symbol for x in sorted_data[:5]]

Selection Frequency

Custom universes run on a schedule based on the EndTime of your custom data objects.

Examples

Demonstration Algorithms
DropboxUniverseSelectionAlgorithm.py Python DropboxUniverseSelectionAlgorithm.cs C#

 

5.10 Chained Universes

Introduction

You can combine ("chain") universes together to fetch fundamental and alternative data on a specific subset of assets. Universes filter input data and return Symbol objects. The only requirement is that Symbol objects the filter returns are a subset of the input data. The source of the Symbol objects is unrestricted, so you can feed the output of one universe into another.

Filter Pattern

Universes filter a large set of Symbol objects by a coarse filter to quickly reduce the data processing requirement. This is often a first step before applying a second filter or requesting alternative data. For example, a strategy might only be interested in easily tradable liquid assets so quickly eliminates all stocks with less than $1M USD / day in trading volume.

A chain of universe blocks that get smaller as they are filtered over time

The order of your filters can improve the speed of your research. By applying filters that narrow the universe the most, or are the lightest weight first, you can significantly reduce the amount of data your algorithm processes. Unless necessary, you can also not return any selections from earlier filters to further improve research speed, keeping only the universe data for later filters.

Universe Data Weights

To speed up your algorithm, request the lightest weight data first before chaining heavier filters or adding alternative data. The following table shows the size each dataset:

Name Data Size / Weight
US Equities (Coarse) Light (1 GB)
US Equities (Fine/Fundamental) Heavy (5 TB)
US Equity Options Huge (200 TB)
US Index Options Medium (500 GB)
US Futures Medium (500 GB)
US Futures Options Medium (500 GB)
Crypto Light (1 GB)
Alternative / General Light (100 MB - 2 GB)
Alternative / Tiingo News Medium (200 GB)

Universe Schedules

Universes typically run overnight and are available before market open. Universes are not currently "ordered", so universe chaining works best with slower universes. For example, use a slow-changing ETF Constituents Universe to set the Symbol list for alternative data.

Chaining Coarse and Alternative Data

The following example chains the QuiverQuantTwitterFollowersUniverse alternative universe to the coarse universe . It first selects the 100 most liquid US Equities and then filters them down based on their Twitter followers number and weekly change. The output of the alternative universe selection method is the output of the chained universe.

using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.DataSource;
using QuantConnect.Securities;

namespace QuantConnect.Algorithm.CSharp
{
    public class ChainedUniverseAlgorithm : QCAlgorithm
    {
        private List<Symbol> _coarse = new();
        private Universe _universeCoarse;
        private Universe _universeTwitter;

        public override void Initialize()
        {
            SetStartDate(2023, 1, 2);
            SetCash(100000);

            _universeCoarse = AddUniverse(CoarseFilterFunction);
            _universeTwitter = AddUniverse<QuiverQuantTwitterFollowersUniverse>(
                "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, FollowerSelection);
        }

        private IEnumerable<Symbol> CoarseFilterFunction(IEnumerable<CoarseFundamental> coarse)
        {
            _coarse = (from c in coarse
                       orderby c.DollarVolume descending
                       select c.Symbol).Take(100).ToList();
            return Universe.Unchanged;
        }

        private IEnumerable<Symbol> FollowerSelection(IEnumerable<QuiverQuantTwitterFollowersUniverse> altCoarse)
        {
            var followers = from d in altCoarse
                         where d.Followers > 200000m && d.WeekPercentChange > 0m
                         select d.Symbol;
            return _coarse.Intersect(followers);
        }

        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            foreach (var added in changes.AddedSecurities)
            {
                AddData<QuiverQuantTwitterFollowers>(added.Symbol);
            }
        }

        public override void OnData(Slice data)
        {
            foreach (var kvp in data.Get<QuiverQuantTwitterFollowers>())
            {
                var datasetSymbol = kvp.Key;
                var dataPoint = kvp.Value;
                Debug($"{datasetSymbol} followers at {data.Time}: {dataPoint.Followers}");
            }
        }
    }
}
from AlgorithmImports import * 

class ChainedUniverseAlgorithm(QCAlgorithm):

    coarse = []
    universe_coarse = None
    universe_twitter = None

    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2023, 1, 2)
        self.universe_coarse = self.AddUniverse(self.CoarseFilterFunction)
        self.universe_twitter = self.AddUniverse(QuiverQuantTwitterFollowersUniverse, "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.FollowerSelection)

    def CoarseFilterFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) 
        self.coarse = [c.Symbol for c in sorted_by_dollar_volume[:100]]
        return Universe.Unchanged

    def FollowerSelection(self, alt_coarse: List[QuiverQuantTwitterFollowersUniverse]) -> List[Symbol]:
        self.followers = [d.Symbol for d in alt_coarse if d.Followers > 200000 and d.WeekPercentChange > 0]
        return list(set(self.coarse) & set(self.followers))

    def OnSecuritiesChanged(self, changes):
        for added in changes.AddedSecurities:
            self.AddData(QuiverQuantTwitterFollowers, added.Symbol)

    def OnData(self, data):
        # Prices in the slice from the universe selection
        # Alternative data in slice from OnSecuritiesChanged Addition
        # for ticker,bar in data.Bars.items():
        #     pass
        for dataset_symbol, data_point in data.Get(QuiverQuantTwitterFollowers).items():
            self.Debug(f"{dataset_symbol} followers at {data.Time}: {data_point.Followers}")

Chaining ETF Universe and Alt Data

The following example chains a QuiverQuantTwitterFollowersUniverse alternative universe to the SPY ETF universe . It first selects all constituents of SPY and then filters them down with based on their Twitter followers number and weekly change. The output of the alternative universe selection method is the output of the chained universe.

using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.DataSource;
using QuantConnect.Securities;

namespace QuantConnect.Algorithm.CSharp
{
    public class ChainedUniverseAlgorithm : QCAlgorithm
    {
        private List<Symbol> _etf = new();
        private Universe _universeEtf;
        private Universe _universeTwitter;

        public override void Initialize()
        {
            SetStartDate(2023, 1, 2);
            SetCash(100000);

            _universeEtf = AddUniverse(Universe.ETF("SPY", Market.USA, UniverseSettings, ETFConstituentsFilter));
            // or var symbol = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
            // _universeEtf = AddUniverseSelection(new ETFConstituentsUniverseSelectionModel(
            //    symbol, UniverseSettings, ETFConstituentsFilter));
            _universeTwitter = AddUniverse<QuiverQuantTwitterFollowersUniverse>(
                "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, FollowerSelection);
        }

        private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
        {
            _etf = constituents.Select(c => c.Symbol).ToList();
            return Universe.Unchanged;
        }

        private IEnumerable<Symbol> FollowerSelection(IEnumerable<QuiverQuantTwitterFollowersUniverse> altCoarse)
        {
            var followers = from d in altCoarse
                            where d.Followers > 200000m && d.WeekPercentChange > 0m
                            select d.Symbol;
            return _etf.Intersect(followers);
        }

        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            foreach (var added in changes.AddedSecurities)
            {
                AddData<QuiverQuantTwitterFollowers>(added.Symbol);
            }
        }

        public override void OnData(Slice data)
        {
            foreach (var kvp in data.Get<QuiverQuantTwitterFollowers>())
            {
                var datasetSymbol = kvp.Key;
                var dataPoint = kvp.Value;
                Debug($"{datasetSymbol} followers at {data.Time}: {dataPoint.Followers}");
            }
        }
    }
}
from AlgorithmImports import * 

class ChainedUniverseAlgorithm(QCAlgorithm):

    etf = []
    universe_etf = None
    universe_twitter = None

    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2023, 1, 2)
        
        self.universe_etf = self.AddUniverse(self.Universe.ETF("SPY", Market.USA, self.UniverseSettings, self.ETFConstituentsFilter))
        # or symbol = Symbol.Create("SPY", SecurityType.Equity, Market.USA)
        # self.universe_etf = self.AddUniverseSelection(ETFConstituentsUniverseSelectionModel(
        #   symbol, self.UniverseSettings, self.ETFConstituentsFilter))
        self.universe_twitter = self.AddUniverse(QuiverQuantTwitterFollowersUniverse, 
            "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.FollowerSelection)

    def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
        self.etf = [c.Symbol for c in constituents]
        return Universe.Unchanged

    def FollowerSelection(self, alt_coarse: List[QuiverQuantTwitterFollowersUniverse]) -> List[Symbol]:
        self.followers = [d.Symbol for d in alt_coarse if d.Followers > 200000 and d.WeekPercentChange > 0]
        return list(set(self.etf) & set(self.followers))

    def OnSecuritiesChanged(self, changes):
        for added in changes.AddedSecurities:
            self.AddData(QuiverQuantTwitterFollowers, added.Symbol)

    def OnData(self, data):
        # Prices in the slice from the universe selection
        # Alternative data in slice from OnSecuritiesChanged Addition
        # for ticker,bar in data.Bars.items():
        #     pass
        for dataset_symbol, data_point in data.Get(QuiverQuantTwitterFollowers).items():
            self.Debug(f"{dataset_symbol} followers at {data.Time}: {data_point.Followers}")

Chaining to US Equity Options

The following example chains an OptionFilterUniverse to the QQQ ETF universe . It first selects the 30 largest-weighted constituents of QQQ and then selects their call Option contracts that expire within 60 days.

using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.UniverseSelection;

namespace QuantConnect.Algorithm.CSharp
{
    public class ChainedUniverseAlgorithm : QCAlgorithm
    {
        private Universe _universeEtf;
        private List<Symbol> _optionContracts = new();

        public override void Initialize()
        {
            SetStartDate(2023, 2, 2);
            SetCash(100000);

            UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw;
            _universeEtf = AddUniverse(Universe.ETF("QQQ", Market.USA, UniverseSettings, ETFConstituentsFilter));
        }

        private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
        {
            return (from c in constituents
                    orderby c.Weight descending
                    select c.Symbol).Take(10);
        }

        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            foreach (var added in changes.AddedSecurities)
            {
                if (added.Type != SecurityType.Equity) continue;

                var contracts = OptionChainProvider.GetOptionContractList(added.Symbol, Time);
                var filteredContracts = (from contract in contracts
                                        where contract.ID.OptionRight == OptionRight.Call
                                        && contract.ID.StrikePrice >= 100
                                        && contract.ID.Date <= Time.AddDays(10)
                                        && contract.ID.OptionStyle == OptionStyle.American
                                        select AddOptionContract(contract).Symbol);
                _optionContracts = _optionContracts.Union(filteredContracts).ToList();
            }
            
            foreach (var removed in changes.RemovedSecurities)
            {
                if (_optionContracts.Contains(removed.Symbol))
                {
                    _optionContracts.Remove(removed.Symbol);
                }
            }
        }

        public override void OnData(Slice data)
        {
            foreach (var chain in data.OptionChains)
            {
                var symbol = chain.Key;
                foreach (var contract in chain.Value)
                {
                    Debug($"Found {contract.Symbol} option contract for {symbol}");
                }
            }
        }
    }
}
from AlgorithmImports import *

class ChainedUniverseAlgorithm(QCAlgorithm):

    universe_etf = None
    option_contracts = []

    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2023, 2, 2)
        
        self.UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw
        self.universe_etf = self.AddUniverse(self.Universe.ETF("QQQ", Market.USA, self.UniverseSettings, self.ETFConstituentsFilter))

    def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
        sorted_by_weight = sorted(constituents, key=lambda x: x.Weight, reverse=True) 
        return [c.Symbol for c in sorted_by_weight[:10]]

    def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
        for added in changes.AddedSecurities:
            if added.Type != SecurityType.Equity: continue

            contracts = self.OptionChainProvider.GetOptionContractList(added.Symbol, self.Time)
            filtered_contracts = [self.AddOptionContract(contract).Symbol for contract in contracts \
                                    if contract.ID.OptionRight == OptionRight.Call \
                                    and contract.ID.StrikePrice >= 100 \
                                    and contract.ID.Date <= self.Time + timedelta(10) \
                                    and contract.ID.OptionStyle == OptionStyle.American]
            self.option_contracts = self.option_contracts + filtered_contracts

        for removed in changes.RemovedSecurities:
            if removed.Symbol in self.option_contracts:
                self.option_contracts.remove(removed.Symbol)

    def OnData(self, data: Slice) -> None:
        for chain in data.OptionChains:
            symbol = chain.Key
            for contract in chain.Value:
                self.Debug(f"Found {contract.Symbol} option contract for {symbol}")

Chaining ETF and Fundamental Universe

The following example chains an ETF constituents universe with a fundamental universe to select ETF constituents with a low PE ratio.

using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Fundamental;
using QuantConnect.Data.UniverseSelection;
using QuantConnect.Securities;

namespace QuantConnect.Algorithm.CSharp
{
    public class ChainedUniverseAlgorithm : QCAlgorithm
    {
        private Universe _universeEtf;
        private Universe _universeFine;

        public override void Initialize()
        {
            SetStartDate(2023, 1, 2);
            SetCash(100000);

            _universeEtf = Universe.ETF("QQQ", Market.USA, UniverseSettings, ETFConstituentsFilter);
            _universeFine = AddUniverse(_universeEtf, FineSelection);
        }

        private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
        {
            return constituents.Select(c => c.Symbol);
        }

        private IEnumerable<Symbol> FineSelection(IEnumerable<FineFundamental> fine)
        {
            return (from f in fine
                    orderby f.ValuationRatios.PERatio
                    select f.Symbol).Take(20);
        }

        public override void OnData(Slice data)
        {
            foreach (var symbol in data.Keys)
            {
                Debug($"{symbol} PE Ratio: {Securities[symbol].Fundamentals.ValuationRatios.PERatio}");
            }
        }
    }
}
from AlgorithmImports import * 

class ChainedUniverseAlgorithm(QCAlgorithm):

    universe_etf = None
    universe_fine = None

    def Initialize(self):
        self.SetCash(100000)
        self.SetStartDate(2023, 2, 2)
        
        self.universe_etf = self.Universe.ETF("QQQ", Market.USA, self.UniverseSettings, self.ETFConstituentsFilter)
        self.universe_fine = self.AddUniverse(self.universe_etf, self.FineSelection)

    def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
        return [c.Symbol for c in constituents]

    def FineSelection(self, fine: List[FineFundamental]) -> List[Symbol]:
        sorted_by_pe_ratio = sorted(fine, key=lambda f: f.ValuationRatios.PERatio)
        return [f.Symbol for f in sorted_by_pe_ratio[:20]]

    def OnData(self, data):
        for symbol in data.Keys:
            self.Debug(f"{symbol} PE Ratio: {self.Securities[symbol].Fundamentals.ValuationRatios.PERatio}")

 

5.11 Alternative Data Universes

Introduction

An alternative data universe lets you select a basket of assets based on an alternative dataset that's linked to securities. If you use an alternative data universe, you limit your universe to only the securities in the dataset, which avoids unnecessary subscriptions.

Supported Datasets

The following alternative datasets support universe selection:

 

6 Datasets

6.1 Overview

Introduction

It's common to use price and fundamental data points to inform trading decisions. Alternative datasets are datasets that aren't classified as market or fundamental data. Alternative data research began gaining popularity in 2007 after the financial crisis and its usage has continued to grow over the years. As usage has grown, so has the number of unique alternative datasets that are available for investors. The benefit of alternative datasets is that it’s easier to find alpha in these datasets because they receive less attention from investment researchers and these datasets contain information not found in market and fundamental datasets. Most traders research with market and fundamental datasets, so it's difficult to find alpha in them.

Methodology

The journey of raw data from its source to its integration with a trading platform can be complex. Alternative data is generally created through individuals, business processes, and sensors. Individuals create content on social media platforms, write reviews on e-commerce sites, and visit corporate Wikipedia pages. Businesses process transactions, file SEC reports, and issue company announcements. Sensors collect location data, gather satellite images, and monitor customer behavior.

Data providers can capture these forms of data for traders to inform trading decisions in ways that supplement traditional market and fundamental datasets. With over a million terabytes of data on the internet, there is virtually a limitless amount of information that can be informative for investors when analyzing a security’s performance in the marketplace.

Examples

A common example of alternative data in a trading system is using sentiment analysis on news sources to predict the future price movements of Equities. A second example is using announcements regarding corporate share buyback programs to trading Equities. A third example is using global supply and demand information for US Crude Products to inform Futures trades. To view all of the datasets we have available, see the left navigation menu.

Challenges

A challenge of working with datasets is that it can be difficult to find a reliable, high-quality, and inexpensive data feed to use in live algorithms. If a data feed has survivorship bias, insufficient history, or hasn’t been cleaned and processed properly, the data feed can cause poor trading performance. We thoroughly vet the datasets we add to the Dataset Market to ensure they are free of survivorship bias and have a reliable live feed. All of the available datasets have already been cleaned and processed, so you can just focus on the strategy research and development.

Future Outlook

The Dataset Market is still in the early phases of development. Over time, we will add more markets and alternative datasets. Alternative datasets are an ever-expanding data source, so it’s expected to continue to grow into the future. In today’s digital world, more data is created each year than in the previous year. To take advantage of the trend, we have implemented a new onboarding process to integrate many new alternative data sources into the QuantConnect platform. With the Dataset Market, you can import a new alternative dataset into your trading algorithm with just a single line of code. The Dataset Market gives everyone the ability to access high-quality alternative datasets that were previously only accessible to major hedge funds.

Live Trading Considerations

We receive most daily alternative data at 7 AM Eastern Time (ET) and start processing it. In live trading, your algorithm receives this data within 30 minutes of 7 AM ET. In backtesting, this data has a timestamp of midnight, so your algorithm receives it about seven hours earlier than it does in live mode.

In backtests, your algorithm receives data at perfect timing. If you request minute resolution data, your algorithm receives the bars at the top of each minute. In live trading, bars have a slight delay, so you may receive them milliseconds after the top of each minute.

Note that there will be delay for data available to be backtested. Live feed data is available for backtesting after 24-48 hours normally. Consider using Paper live trading if closely monitoring is needed.

 

6.2 QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

 

6.2.1 Binance Crypto Future Margin Rate Data

Introduction

The Binance Crypto Future Margin Rate Data by QuantConnect is for crypto-currency futures margin interest data points. The data covers 236 Cryptocurrency pairs, starts in August 2020, and is delivered on a daily update frequency. This dataset is created by downloading data using Binance API.

This dataset is an important companion to the Binance Crypto Future Price Data dataset because it contains information on margin interest data to model margin costs.

For more information about the Binance Crypto Future Margin Rate Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Getting Started

The following snippet demonstrates how to request data from the Binance Crypto Future Margin Rate dataset:

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
    self.SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin)

    self.crypto_future_symbol = self.AddCryptoFuture("BTCBUSD", Resolution.Minute).Symbol
private Symbol _cryptoFutureSymbol;

public override void Initialize
{
    SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin);
    SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin);

    // perpetual futures does not have a filter function
    _cryptoFutureSymbol = AddCryptoFuture("BTCBUSD", Resolution.Minute).Symbol;
}

The Binance Crypto Future Margin Rate data is added to your algorithm along with the market data when you add a crypto future subscription.

Data Summary

The following table describes the dataset properties:

Property Value
Start Date August 2020
Asset Coverage 236 Crypto Futures Pairs
Data Density Regular
Resolution Daily
Timezone UTC

Supported Assets

The following table shows the available Crypto Future pairs:

Data Point Attributes

The Binance Crypto Future Margin Rate dataset provides MarginInterestRate objects with the following attributes:

Requesting Data

To add Binance Crypto Future Margin Rate data to your algorithm, call the AddCryptoFuture method. Save a reference to the Crypto Future Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)

        # Set Account Currency to Binance Stable Coin for USD
        self.SetAccountCurrency("BUSD")
        self.SetCash(100000)

        self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
        self.SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin)
        
        crypto_future = self.AddCryptoFuture("BTCBUSD", Resolution.Minute)
        # perpetual futures does not have a filter function
        self.symbol = crypto_future.Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol ;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);

            // Set Account Currency to Binance Stable Coin for USD
            SetAccountCurrency("BUSD");
            SetCash(100000);

            SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin);
            SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin);
            
            var cryptoFuture = AddCryptoFuture("BTCBUSD", Resolution.Minute);
            // perpetual futures does not have a filter function
            _symbol = cryptoFuture.Symbol;
        }
    }
}

For more information about creating Crypto Future subscriptions, see Requesting Data .

Accessing Data

To get the current Binance Crypto Margin Rate data, index the MarginInterestRates property of the current Slice with the Crypto Future Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.MarginInterestRates:
        interest_rate = slice.MarginInterestRates[self.symbol].InterestRate
        self.Log(f"{self.symbol} close at {slice.Time}: {interest_rate}")
public override void OnData(Slice slice)
{
    if (slice.MarginInterestRates.ContainsKey(_symbol))
    {
        var interestRate = slice.MarginInterestRates[_symbol].InterestRate;
        Log($"{_symbol} price at {slice.Time}: {interestRate}");
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, margin_interest_rate in slice.MarginInterestRates.items():
        interest_rate = margin_interest_rate.InterestRate
        self.Log(f"{symbol} close at {slice.Time}: {interest_rate}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.MarginInterestRates)
    {
        var symbol = kvp.Key;
        var marginInterestRate = kvp.Value;
        var interestRate = marginInterestRate.InterestRate;
        Log($"{symbol} price at {slice.Time}: {interestRate}");
    }
}

For more information about accessing Crypto Future data, see Handling Data .

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Binance Crypto Future Margin Rate dataset enables correct margin cost so you can accurately design strategies for Cryptocurrencies with term structure. Examples include the following strategies:

Python:

C#:

 

6.2.2 US ETF Constituents

Introduction

The US ETF Constituents dataset by QuantConnect tracks the constituents and weighting of US Equities in 2,650 ETF listings. The data starts in January 2009 and is delivered on a daily basis. This dataset is created by tracking the host ETF websites and can be delayed by up to 1 week.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US ETF Constituents dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 160,000 quants are served every month.

Getting Started

The following snippet demonstrates how to request data from the US ETF Constituents dataset:

from QuantConnect.DataSource import *

# Use the following method for a Classic Algorithm
self.AddUniverse(self.Universe.ETF("SPY", Market.USA, self.UniverseSettings, self.ETFConstituentsFilter))

symbol = Symbol.Create("SPY", SecurityType.Equity, Market.USA)
# Use the following method for a Framework Algorithm
self.AddUniverseSelection(ETFConstituentsUniverseSelectionModel(symbol, self.UniverseSettings, self.ETFConstituentsFilter))
using QuantConnect.DataSource;

// Use the following method for a Classic Algorithm
AddUniverse(Universe.ETF("SPY", Market.USA, UniverseSettings, ETFConstituentsFilter));

var symbol = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
// Use the following method for a Framework Algorithm
AddUniverseSelection(new ETFConstituentsUniverseSelectionModel(symbol, UniverseSettings, ETFConstituentsFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2009
Asset Coverage 2,650 US ETF Listings
Data Density Dense
Resolution Daily
Timezone New York

Supported ETFs

The following table shows the available ETFs:

Data Point Attributes

The ETF Constituents dataset provides ETFConstituentData objects, which have the following attributes:

Requesting Data

To add US ETF Constituents data to your algorithm, call the AddUniverse and Universe.ETF methods.. To select which constituents occupy the universe, provide the ETF Symbol and a selection function.

class ETFConstituentsDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2018, 1, 1)
        self.SetEndDate(2020, 8, 25)
        self.SetCash(100000)

        self.AddUniverse(self.Universe.ETF("SPY", self.UniverseSettings, self.ETFConstituentsFilter))
namespace QuantConnect
{
   public class ETFConstituentsDataAlgorithm : QCAlgorithm
   {
       public override void Initialize()
       {
           SetStartDate(2018, 1, 1);
           SetEndDate(2020, 8, 25);
           SetCash(100000);

           AddUniverse(Universe.ETF("SPY", UniverseSettings, ETFConstituentsFilter));
       }
    }
}

Accessing Data

To access the US ETF Constituent data, use the ETFConstituentData objects in your selection function. The data is available in daily resolution. The Symbol objects you return from your selection function defines the universe constituents.

def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
    for c in constituents:
        self.Debug(f'{c.EndTime} :: {c.LastUpdate} :: {c.Weight} :: {c.SharesHeld} :: {c.MarketValue}')
    return [x.Symbol for x in constituents]
public IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
{
    foreach (var c in constituents)
    {
        Debug($"{c.EndTime} :: {c.LastUpdate} :: {c.Weight} :: {c.SharesHeld} :: {c.MarketValue}");
    }

    return constituents.Select(c => c.Symbol);
}

Historical Data

You can't request historical ETFConstituentData objects, but you can you can use the Symbol member of each object to request historical market data of the securities that the ETFConstituentData objects reference. If there is no data in the period you request, the history result is empty.

def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
    # Get the 20 largest weighting constituents
    selected = sorted([c for c in constituents if c.Weight],
        key=lambda c: c.Weight, reverse=True)[:20]
    selectedSymbols = [c.Symbol for c in selected]

    history = History(selectedSymbols, 10, Resolution.Daily)
                
    return selectedSymbols 
private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
{
    // Get the 20 largest weighting constituents
    var selectedSymbols = constituents
        .OrderByDescending(c => c.Weight)
        .Take(10)
        .Select(c => c.Symbol)

    var history = History(selectedSymbols, 10, Resolution.Daily);

    return selectedSymbols;
}

Example Applications

The ETF Constituents dataset provides an excellent source of tradable universes for strategies without selection bias. When you use an ETF universe, the original ETF can serve as an excellent benchmark for your strategy performance. Other use cases include the following:

 

6.2.3 US Equity Coarse Universe

Introduction

The US Equity Coarse Universe dataset by QuantConnect is a daily universe of all trading stocks in the US for a given day with the end of day price and volume. The data covers 30,000 US Equities in total, with approximately 8,000 Equities per day. The data starts in January 1998 and is delivered each trading day. This dataset is created by taking the closing auction price tick from the daily L1 trade and quote exchange dumps.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Equity Coarse Universe dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Getting Started

The following snippet demonstrates how to request data from the US Equity Coarse Universe dataset:

from QuantConnect.DataSource import *

self.AddUniverse(self.CoarseSelectionFunction)
using QuantConnect.DataSource;

AddUniverse(CoarseSelectionFunction);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1998
Asset Coverage 30,000 US Equities
Data Density Dense
Resolution Daily
Timezone New York

Data Point Attributes

The US Equity Coarse Universe dataset provides CoarseFundamental objects, which have the following attributes:

Requesting Data

To add US Equity Coarse Universe data to your algorithm, call the AddUniverse method with a selection function.

class USEquityCoarseUniverseConstituentsDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 7, 1)
        self.SetCash(100000)
        
        self.AddUniverse(self.CoarseSelectionFunction)
namespace QuantConnect
{
    public class USEquityCoarseUniverseConstituentsDataAlgorithm : QCAlgorithm
    {    	
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 7, 1);
            SetCash(100000);
            
            AddUniverse(CoarseSelectionFunction);
        }
    }
}

Accessing Data

To access US Equity Coarse Universe data, use the CoarseFundamental objects in your selection function. The data is available in daily resolution.

def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:

    sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)[:3]
    for cf in sorted_by_dollar_volume:
        self.Debug(f"{cf.EndTime} :: {cf.Symbol} : {cf.AdjustedPrice} :: {cf.DollarVolume}")

    return [ x.Symbol for x in sortedByDollarVolume]
public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
    var sortedByDollarVolume = coarse
        .OrderByDescending(x => x.DollarVolume)
        .Take(3).ToList();

    foreach (var cf in sortedByDollarVolume)
    {
        Debug($"{cf.EndTime} :: {cf.Symbol} : {cf.AdjustedPrice} :: {cf.DollarVolume}");
    }

    return sortedByDollarVolume.Select(x => x.Symbol);
}

Historical Data

You can't request historical CoarseFundamental objects, but you can you can use the Symbol member of each object to request historical market data of the securities that the CoarseFundamental objects reference. If there is no data in the period you request, the history result is empty.

def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:

    selected_symbols = [x.Symbol 
        for x in sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)[:3]]

    history = self.History(selected_symbols, 10, Resolution.Daily)

    return selected_symbols
public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
    var selectedSymbols = coarse
        .OrderByDescending(x => x.DollarVolume)
        .Take(3)
        .Select(x => x.Symbol)
        .ToList();

    var history = History(selectedSymbols, 10, Resolution.Daily);

    return selectedSymbols;
}

Example Applications

The US Security Master dataset enables you to accurately design a universe of US Equities. Examples include the following strategies:

 

6.2.4 US Equity Security Master

Introduction

The US Equity Security Master dataset by QuantConnect tracks US Equity corporate actions, including splits, dividends, delistings, mergers, and ticker changes through history. The data covers approximately 27,500 US Equities, starts in January 1998, and is delivered on a daily update frequency. You can easily download and install the dataset with the LEAN CLI so it's ready to use by LEAN. LEAN automatically handles all corporate actions and passes them into your algorithm as events .

For more information about the US Equity Security Master dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Data Summary

Data is delivered as a daily updated zip archive of map and factor files. The data is designed to be used in the LEAN Engine and cannot be consumed another way. The following table shows the dataset properties:

Property Value
Start Date January 1998
Data Points Splits, Dividends, Mergers, IPO, & Delistings
Asset Coverage 27,500 US Equities
Resolution Daily
Timezone New York

Getting Started

You don't need any special code to utilize the US Equity Security Master. It automatically loads when you request US Equities data .

Supported Assets

To view the supported assets in the US Equity Security Master dataset, see the Data Explorer .

Data Point Attributes

The US Equity Security Master dataset provides Split , Dividend , Delisting , and SymbolChangedEvent objects.

Split Attributes

When a split or merger occurs, we pass the previous Symbol data into your algorithm. Split objects have the following attributes:

Dividend Attributes

Dividend events are triggered on the payment date. Dividend objects have the following attributes:

Delisting Attributes

When a security is delisted, we notify your algorithm. Delisting objects have the following attributes:

SymbolChangedEvent Attributes

When a security changes their ticker, we notify your algorithm. SymbolChangedEvent objects have the following attributes:

Accessing Splits

To get the current split data, index the Splits property of the current Slice with the Equity Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.Splits.ContainsKey(self.symbol):
        split = slice.Splits[self.symbol]
        split_type = {0: "Warning", 1: "SplitOccurred"}.get(split.Type)
        self.Log(f"Split: {split.Symbol}\t{split.SplitFactor}\t{split.ReferencePrice}\t{split_type}")
public override void OnData(Slice slice)
{
    if (slice.Splits.ContainsKey(_symbol))
    {
        var split = slice.Splits[_symbol];
        Log($"Split: {split.Symbol}\t{split.SplitFactor}\t{split.ReferencePrice}\t{split.Type}");
    }
}

For more information about accessing splits, see Splits .

Accessing Dividends

To get the current dividend data, index the Dividends property of the current Slice with the Equity Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.Dividends.ContainsKey(self.symbol):
        dividend = slice.Dividends[self.symbol]
        self.Log(f'Dividend: {dividend.Symbol}\t{dividend.Distribution}\t{dividend.ReferencePrice}')
public override void OnData(Slice slice)
{
    if (slice.Dividends.ContainsKey(_symbol))
    {
        var dividend = slice.Dividends[_symbol];
        Log($"Dividend: {dividend.Symbol}\t{dividend.Distribution}\t{dividend.ReferencePrice}");
    }
}

For more information about accessing dividends, see Dividends .

Accessing Delistings

To get the current Delistings data, index the Delistings property of the current Slice with the Equity Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.Delistings.ContainsKey(self.symbol):
        delisting = slice.Delistings[self.symbol]
        delisting_type = {0: "Warning", 1: "Delisted"}.get(delisting.Type)
        self.Log(f'Delistings: {delisting_type}')
public override void OnData(Slice slice)
{
    if (slice.Delistings.ContainsKey(_symbol))
    {
        var delisting = slice.Delistings[_symbol];
        Log($"Delistings: {delisting.Type}");
    }
}

For more information about accessing delistings, see Delistings .

Accessing Symbol Change Events

To get the current Symbol change events, index the SymbolChangedEvents property of the current Slice with the Equity Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.SymbolChangedEvents.ContainsKey(self.symbol):
        symbol_changed_event = slice.SymbolChangedEvents[self.symbol]
        self.Log(f"Symbol changed: {symbol_changed_event.OldSymbol} -> {symbol_changed_event.NewSymbol}")
public override void OnData(Slice slice){
    if (slice.SymbolChangedEvents.ContainsKey(_symbol))
    {
        var symbolChangedEvent = slice.SymbolChangedEvents[_symbol];
        Log($"Symbol changed: {symbolChangedEvent.OldSymbol} -> {symbolChangedEvent.NewSymbol}");
    }
}

For more information about accessing Symbol change events, see Symbol Changes .

Example Applications

The US Security Master enables you to accurately design strategies harnessing any core corporate actions. Examples include the following strategies:

 

6.2.5 US Futures Security Master

Introduction

The US Futures Security Master dataset by QuantConnect provides mapping reference data for the most liquid contracts of the CME Group exchanges, calculated with popular rolling techniques. The data covers 75 root Future contracts, starts in 2012, and is delivered on a daily frequency with a zip file with all the contract mappings. This dataset is created by daily processing of the US historical Future chains.

This dataset, paired the US Futures dataset, supports the following rolling techniques: ForwardPanamaCanal, BackwardsPanamaCanal, and Backwards Ratio. You can set the specific date of rolling to occur on the LastTradingDay, FirstDayMonth, or on the day where the contract with the greatest OpenInterest changes.

For more information about the US Futures Security Master dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Getting Started

You don't need any special code to utilize the US Futures Security Master. It automatically loads when you request US Futures data .

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2012
Asset Coverage 75 Liquid Futures
Data Density Regular
Resolution Daily

Data Point Attributes

The US Futures Security Master dataset provides SymbolChangedEvent objects, which have the following attributes:

Key Concept

The US Futures Security Master lets you to construct continuous Futures, allowing the access of normalized historical data of the underlying assets, as well as trading the “lead” Future contracts for those assets.

Continuous Futures refer to sets of rolling lead Future contracts during their actively trading periods. Since Future contracts expire at their maturities, to analyze the historical price of a Future and to apply technical indicators, you need the continuous Future price series.

To access the continuous Future, use the Future's Symbol property.

future = self.AddFuture(Futures.Energies.CrudeOilWTI,
    dataNormalizationMode = DataNormalizationMode.BackwardsRatio,
    dataMappingMode = DataMappingMode.OpenInterest,
    contractDepthOffset = 0)
self.continuous_contract_symbol = future.Symbol
var future = AddFuture(Futures.Energies.CrudeOilWTI,
    dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
    dataMappingMode: DataMappingMode.OpenInterest,
    contractDepthOffset: 0
);
_continuousFutureSymbol = future.Symbol;

The dataNormalizationMode and dataMappingMode arguments makes the transition of the underlying contracts seemless. However, the Future Symbol doesn't map to an underlying Future contract. It works fine to trade within backtests, but could be subjected to friction costs during live trading since the order price could be a normalized price. For more information about this topic, see the Live Trading Considerations section.

Data Normalization Modes

The data normalization mode defines how the price series of two contracts are stitched together when the contract rollovers occur. The DataNormalizatoinMode enumeration has the following members available for continuous contracts:

If you use a data normalization mode that's not in the preceding list, LEAN automatically converts it to DataNormalizationMode.BackwardsRatio .

Data Mapping Modes

The data mapping mode defines when contract rollovers occur. The DataMappingMode enumeration has the following members:

Tracking Contract Changes

As the contracts roll over, the Mapped property of the Future object references the next contract in the series and you receive a SymbolChangedEvent . To get the current Symbol change events, index the SymbolChangedEvents property of the current Slice with the continuous Futures Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your Future at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice)0 -> None:
    if slice.SymbolChangedEvents.ContainsKey(self.continuous_future_symbol):
        symbol_changed_event = slice.SymbolChangedEvents[self.continuous_future_symbol]
        self.Log(f"Symbol changed: {symbolChangedEvent.OldSymbol} -> {symbolChangedEvent.NewSymbol}")
public override void OnData(Slice slice)
{
    if (slice.SymbolChangedEvents.ContainsKey(_continuousFutureSymbol))
    {
        var symbolChangedEvent = slice.SymbolChangedEvents[_continuousFutureSymbol];
        Log($"Symbol changed: {symbolChangedEvent.OldSymbol} -> {symbolChangedEvent.NewSymbol}");
    }
}

SymbolChangedEvent objects have the following attributes:

Live Trading Considerations

You can trade continuous Futures, but the continuous Future Symbol doesn't map to a single underlying Future contract. Instead, it represents a set of rolling contracts. Thus, the prices could be frictional during a contract rollover, which could be catastrophic in live trading! For live trading, you should place your orders directly on the underlying contracts. To get the current underlying contract in the continuous Future series, use the Mapped property.

current_contract = self.continuous_contract.Mapped
self.Buy(current_contract, 1)
var currentContract = _continuousContract.Mapped;
Buy(currentContract, 1);

Data Format

If you download the files in the US Futures Security Master, you get a factor file and a map file for each of the exchanges with supported continuous Futures. To view the files, see the \data\future\<exchange_name> directory under your LEAN CLI base directory.

For the factor file, it is a .zip collection of REST API styled .csv files for each Future Symbol , including the date, scaling factors for each type of data normalization and the data mapping mode that indicates the Symbol changing event is on that day for that mapping mode. The following line is an example line in the .csv file:

{"Date":"2009-10-31T00:00:00","BackwardsRatioScale":[0.9914163090128755364806866953,1.0,1.0],"BackwardsPanamaCanalScale":[-2.0,0.0,0.0],"ForwardPanamaCanalScale":[0.0,0.0,0.0],"DataMappingMode":1}

For the map file, it is a .zip collection of .csv files for each Future Symbol , including the date, new underlying contract Symbol, the exchange code, and the data mapping mode that indicates the Symbol changing event is on that day for that mapping mode. The following line is an example line in the .csv file:

20091130,aw uii3j0m6zbj9,CBOT,1

Example Applications

The US Futures Security Master enables you to design strategies harnessing continuous Futures contracts. Examples include the following strategies:

 

6.3 AlgoSeek

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com .

 

6.3.1 US Equities

Introduction

The US Equities dataset by AlgoSeek is survivorship bias-free daily coverage of every stock traded in the US Securities Information Processors (SIP) CTA/UTP feed since 1998. The dataset covers approximately 27,500 securities, starts in January 1998, and is delivered in any resolution from tick to daily. The Data is collected from the full SIP feed via our Equinix co-located servers, including all trades and quotes published to every exchange as well as FINRA. Over-the-Counter (OTC) trades are not included.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Equities dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com .

Getting Started

AlgoSeek is the default US Equities dataset on QuantConnect. The following snippet demonstrates how to request data from the US Equities dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol 
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1998
Asset Coverage 27,500 US Equities
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone New York

Supported Assets

To view the supported assets in the US Equities dataset, see the Data Explorer .

Data Point Attributes

The US Equities dataset provides TradeBar , QuoteBar , and Tick objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Requesting Data

To add US Equities data to your algorithm, call the AddEquity method. Save a reference to the Equity Symbol so you can access the data later in your algorithm.

class USEquityDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2018, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000) 
        self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
namespace QuantConnect
{
    public class USEquityDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol; 
    	
        public override void Initialize()
        {
            SetStartDate(2018, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
        }
    }
}

For more information about creating US Equity subscriptions, see Requesting Data or US Equity Universes .

Accessing Data

To get the current US Equities data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Equity Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing US Equities data, see Handling Data .

Historical Data

To get historical US Equity data, call the History method with the Equity Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Daily)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a universe of US Equities, see Equity Universes .

Remove Subscriptions

To unsubscribe from a US Equity that you added with the AddEquity method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings.

Example Applications

The US Equities dataset enables you to accurately design Equity trading strategies. Examples include the following strategies:

 

6.3.2 US Equity Options

Introduction

The US Equity Options data by AlgoSeek provides Option data, including prices, strikes, expires, implied volatility, and Greeks. The data covers 4,000 Symbols, starts in January 2012, and is delivered on a minute frequency. This dataset is created by monitoring Options Price Reporting Authority (OPRA) data feed, which consolidates last sale and quotation information originating from the national securities exchanges that have been approved by the Securities and Exchange Commission.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes of the underlying security.

For more information about the US Equity Options dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

AlgoSeek was in 2014 with the goal of providing the highest quality, most accurate, ready-to-use data in the financial data industry. AlgoSeek provides access to Equities, ETFs, ETNs, Equity Indices, Equity Options, Futures, and Future Options for quantitative firms and traders.

Getting Started

The following snippet demonstrates how to request data from the US Equity Options dataset:

from QuantConnect.DataSource import *

option = self.AddOption("GOOG")
self.option_symbol = option.Symbol
option.SetFilter(-2, +2, 0, 180)
using QuantConnect.DataSource;

var option = AddOption("GOOG");
_optionSymbol = option.Symbol;
option.SetFilter(-2, +2, 0, 180);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2012*
Asset Coverage 4,000 Symbols
Data Density Dense
Resolution Minute, Hourly, & Daily
Timezone New York

* Some data is available before this date. In 2012, AlgoSeek started to fetch data from 48 OPRA channels instead of 24, increasing the quality of the data.

Supported Assets

To view the supported assets in the US Equity Options dataset, see the Data Explorer .

Data Point Attributes

The US Equity Options dataset provides TradeBar , QuoteBar , and OpenInterest objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

OpenInterest Attributes

OpenInterest objects have the following attributes:

Requesting Data

To add US Equity Options data to your algorithm, call the AddOption method. Save a reference to the Equity Option Symbol so you can access the data later in your algorithm.

class USEquityOptionsDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        option = self.AddOption("GOOG")
        self.option_symbol = option.Symbol
        # Set our strike/expiry filter for this option chain
        option.SetFilter(-2, +2, 0, 180)
namespace QuantConnect
{
    public class USEquityOptionsDataAlgorithm : QCAlgorithm
    {
        private Symbol _optionSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            // Requesting data
            var option = AddOption("GOOG");
            _optionSymbol = option.Symbol;
            // Set our strike/expiry filter for this option chain
            option.SetFilter(-2, +2, 0, 180);
        }
    }
}

The Equity resolution must be less than or equal to the Equity Option resolution. For example, if you set the Equity resolution to minute, then you must set the Equity Option resolution to minute, hour, or daily.

For more information about creating US Equity Option subscriptions, see Requesting Data or Equity Options Universes .

Accessing Data

To get the current US Equity Options data, index the OptionChains property of the current Slice with the canonical Equity Option Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your Index Option at every time step. To avoid issues, call the get method.

def OnData(self, slice: Slice) -> None:
    chain = slice.OptionChains.get(self.option_symbol)
    if chain:
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    if (slice.OptionChains.ContainsKey(_optionSymbol))
    {
        var chain = slice.OptionChains[_optionSymbol];
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

You can also iterate through all of the OptionChain objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

For more information about accessing US Equity Options data, see Handling Data .

Historical Data

You can get historical US Equity Options data in an algorithm and the Research Environment.

Historical Data In Algorithms

To get historical US Equity Options data in an algorithm, call the History method with the Equity Option contract Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(contract.Symbol, 100, Resolution.Minute)

# TradeBar objects
history_trade_bars = self.History[TradeBar](contract.Symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](contract.Symbol, 100, Resolution.Minute)
// TradeBar objects 
var historyTradeBars = History(contract.Symbol, 100, Resolution.Minute);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(contract.Symbol, 100, Resolution.Minute);

For more information about historical data in algorithms, see History Requests .

Historical Data In Research

To get historical US Equity Options data in the Research Environment for an entire Option chain, call the GetOptionHistory method with the canonical Option Symbol .

qb = QuantBook()
option = qb.AddOption("GOOG") 
option.SetFilter(-2, 2, 0, 90)
history = qb.GetOptionHistory(option.Symbol, datetime(2020, 6, 1), datetime(2020, 6, 5))

all_history = history.GetAllData()
expiries = history.GetExpiryDates() 
strikes = history.GetStrikes()
// The GetOptionHistory method isn't currently available for C#
// To track the feature progress, subscribe to https://github.com/QuantConnect/Lean/issues/6489

To get historical data for a single US Equity Option contract, call the History method like you would in an algorithm but on the QuantBook object. For more information about historical data in the Research Environment, see Equity Options .

Example Applications

The US Equity Options dataset enables you to accurately design Option strategies. Examples include the following strategies:

 

6.3.3 US Future Options

Introduction

The US Future Options dataset by AlgoSeek provides Option data on US Future contracts, including prices, strikes, expires, implied volatility, and Greeks. The data covers 15 Monthly Future contracts, starts in January 2012, and is delivered on a minute frequency. This dataset is created by monitoring the trading activity on the CME, CBOT, NYMEX, and COMEX markets.

For more information about the US Future Options dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering equities, futures, options, cash forex, and cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com .

Getting Started

The following snippet demonstrates how to request data from the US Future Options dataset:

from QuantConnect.DataSource import *

future = self.AddFuture(Futures.Metals.Gold, Resolution.Minute)
future.SetFilter(0, 90)
self.AddFutureOption(future.Symbol, lambda universe: universe.Strikes(-5, +5))
using QuantConnect.DataSource;

var future = AddFuture(Futures.Metals.Gold, Resolution.Minute);
future.SetFilter(0, 90);
AddFutureOption(future.Symbol, universe => universe.Strikes(-5, +5));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2012
Asset Coverage 15 Monthly Future Contracts
Data Density Dense
Resolution Minute, Hourly, & Daily
Timezone New York

Supported Assets

The following table shows the available Future Options:

Name
Symbol Underlying Market Accessor Code
Class III Milk Futures
DC DC CME Futures.Dairy.ClassIIIMilk
Crude Oil Futures
LO CL NYMEX Futures.Energies.CrudeOilWTI
NY Harbor ULSD Futures
OH HO NYMEX Futures.Energies.HeatingOil
Henry Hub Natural Gas Futures
ON NG NYMEX Futures.Energies.NaturalGas
RBOB Gasoline Futures
OB RB NYMEX Futures.Energies.Gasoline
U.S. Treasury Bond Futures
OZB ZB CBOT Futures.Financials.Y30TreasuryBond
2-Year T-Note Futures
OZT ZT CBOT Futures.Financials.Y2TreasuryNote
Corn Futures
OZC ZC CBOT Futures.Grains.Corn
Soybean Futures
OZS ZS CBOT Futures.Grains.Soybeans
Chicago SRW Wheat Futures
OZW ZW CBOT Futures.Grains.SRWWheat
E-mini S&P 500 Futures
ES ES CME Futures.Indices.SP500EMini
E-mini Nasdaq-100 Futures
NQ NQ CME Futures.Indices.NASDAQ100EMini
Gold Futures
OG GC COMEX Futures.Metals.Gold
Copper Futures
HXE HG COMEX Futures.Metals.Copper
Silver Futures
SO SI COMEX Futures.Metals.Silver

Data Point Attributes

The US Future Options dataset provides TradeBar , QuoteBar , and OpenInterest objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

OpenInterest Attributes

OpenInterest objects have the following attributes:

Requesting Data

To add US Future Options data to your algorithm, call the AddFutureOption method.

class FutureOptionDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 1, 28)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        future = self.AddFuture(Futures.Metals.Gold, Resolution.Minute)
        future.SetFilter(0, 90)
        self.AddFutureOption(future.Symbol, lambda universe: universe.Strikes(-5, +5))
namespace QuantConnect
{
    public class FutureOptionDataAlgorithm : QCAlgorithm
    {
        public override void Initialize()
        {
            SetStartDate(2020, 1, 28);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            
            var future = AddFuture(Futures.Metals.Gold, Resolution.Minute);
            future.SetFilter(0, 90);
            AddFutureOption(future.Symbol, universe => universe.Strikes(-5, +5));
        }
    }
}

The Future resolution must be less than or equal to the Future Option resolution. For example, if you set the Future resolution to minute, then the Future Option resolution must be minute, hour, or daily.

For more information about creating Future Options subscriptions, see Requesting Data or Future Options Universes .

Accessing Data

To get the current Future Options data, iterate through the OptionChains of the current Slice . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your Future Options at every time step.

def OnData(self, slice: Slice) -> None:
    for canonical_fop_symbol, chain in slice.OptionChains.items():
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalFOPSymbol = kvp.Key;
        var chain = kvp.Value;
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

You can also iterate through the FuturesChains in the current Slice first.

def OnData(self, slice: Slice) -> None:
    for continuous_future_symbol, futures_chain in slice.FuturesChains.items():
        # Select a Future Contract and create its canonical FOP Symbol
        futures_contract = [contract for contract in futures_chain][0]
        canonical_fop_symbol = Symbol.CreateCanonicalOption(futures_contract.Symbol)
        option_chain = slice.OptionChains.get(canonical_fop_symbol)
        if option_chain:
            for fop_contract in option_chain:
                self.Log(f"{fop_contract.Symbol} price at {slice.Time}: {fop_contract.LastPrice}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var continuousContractSymbol = kvp.Key;
        var futuresChain = kvp.Value;
        
        // Select a Future Contract and create its canonical FOP Symbol
        var futuresContract = futuresChain.First();
        var canonicalFOPSymbol = QuantConnect.Symbol.CreateCanonicalOption(futuresContract.Symbol);
        if (slice.OptionChains.TryGetValue(canonicalFOPSymbol, out var optionChain))
        {
            foreach (var fopContract in optionChain)
            {
                Log($"{fopContract.Symbol} price at {slice.Time}: {fopContract.LastPrice}");
            }
        }
    }
}

For more information about accessing Future Options data, see Handling Data .

Historical Data

You can get historical US Future Options data in an algorithm and the Research Environment.

Historical Data In Algorithms

To get historical US Future Options data in an algorithm, call the History method with the Future Option contract Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(contract.Symbol, 100, Resolution.Minute)

# TradeBar objects
history_trade_bars = self.History[TradeBar](contract.Symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](contract.Symbol, 100, Resolution.Minute)
// TradeBar objects 
var historyTradeBars = History(contract.Symbol, 100, Resolution.Minute);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(contract.Symbol, 100, Resolution.Minute);

For more information about historical data in algorithms, see History Requests .

Historical Data In Research

To get historical US Future Options data in the Research Environment for the entire Option chain of a Futures contract, call the GetOptionHistory method with the Futures contract Symbol .

qb = QuantBook()
future = qb.AddFuture(Futures.Indices.SP500EMini, Resolution.Minute)
future_symbols = qb.FutureChainProvider.GetFutureContractList(future.Symbol, datetime(2021, 12, 20))
future_contract_symbol = sorted(future_symbols, key=lambda s: s.ID.Date)[0]

start_time = datetime(2021, 12, 1)
end_time = datetime(2021, 12, 10)
option_history = qb.GetOptionHistory(future_contract_symbol, start_time, end_time, Resolution.Minute)

all_history = option_history.GetAllData()
expiries = option_history.GetExpiryDates() 
strikes = option_history.GetStrikes()
// The GetOptionHistory method isn't currently available for C#
// To track the feature progress, subscribe to https://github.com/QuantConnect/Lean/issues/6489

To get historical data for a single US Future Option contract, call the History method like you would in an algorithm but on the QuantBook object. For more information about historical data in the Research Environment, see Futures Options .

Example Applications

The US Future Options dataset enables you to accurately design Future Option strategies. Examples include the following strategies:

 

6.3.4 US Futures

Introduction

The US Futures dataset by AlgoSeek provides Futures data, including price, volume, open interest, and expiry. The data covers the 75 most liquid contracts, starts in May 2009, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on the CFE, CBOT, NYMEX, ICE*, SGX, India, and COMEX markets.

This dataset does not include ICE Futures, except for Sugar until July 2021.

For more information about the US Futures dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering equities, futures, options, cash forex, and cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com .

Getting Started

The following snippet demonstrates how to request data from the US Futures dataset:

from QuantConnect.DataSource import *

future = self.AddFuture(Futures.Metals.Gold)
future.SetFilter(0, 90)
using QuantConnect.DataSource;

var future = AddFuture(Futures.Metals.Gold);
future.SetFilter(0, 90);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date May 2009
Asset Coverage 75 Futures
Data Density Dense
Resolution Tick, Second, Minute, Hour, & Daily
Timezone
  • Chicago (CME or CBOT)
  • New York (NYMEX or COMEX)
  • Singapore time (SGX)
  • Indian Standard Time (India)

This dataset includes Sugar ICE Futures until July 2021.

Supported Assets

The following table shows the available Futures:

Name
Symbol Market Accessor Code
Australian Dollar Futures
6A CME Futures.Currencies.AUD
British Pound Futures
6B CME Futures.Currencies.GBP
Canadian Dollar Futures
6C CME Futures.Currencies.CAD
Euro FX Futures
6E CME Futures.Currencies.EUR
Japanese Yen Futures
6J CME Futures.Currencies.JPY
Brazilian Real Futures
6L CME Futures.Currencies.BRL
Mexican Peso Futures
6M CME Futures.Currencies.MXN
New Zealand Dollar Futures
6N CME Futures.Currencies.NZD
Russian Ruble Futures
6R CME Futures.Currencies.RUB
Swiss Franc Futures
6S CME Futures.Currencies.CHF
South African Rand Futures
6Z CME Futures.Currencies.ZAR
Australian Dollar/Canadian Dollar Futures
ACD CME Futures.Currencies.AUDCAD
Australian Dollar/Japanese Yen Futures
AJY CME Futures.Currencies.AUDJPY
Australian Dollar/New Zealand Dollar Futures
ANE CME Futures.Currencies.AUDNZD
Bitcoin Futures
BTC CME Futures.Currencies.BTC
Canadian Dollar/Japanese Yen Futures
CJY CME Futures.Currencies.CADJPY
Standard-Size USD/Offshore RMB (CNH) Futures
CNH CME Futures.Currencies.StandardSizeUSDOffshoreRMBCNH
US Dollar Index Futures
DX ICE Futures.Currencies.USD
E-mini Euro FX Futures
E7 CME Futures.Currencies.EuroFXEmini
Euro/Australian Dollar Futures
EAD CME Futures.Currencies.EURAUD
Euro/Canadian Dollar Futures
ECD CME Futures.Currencies.EURCAD
Euro/Swedish Krona Futures
ESK CME Futures.Currencies.EURSEK
Ether Futures
ETH CME Futures.Currencies.ETH
E-mini Japanese Yen Futures
J7 CME Futures.Currencies.JapaneseYenEmini
Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures
M6A CME Futures.Currencies.MicroAUD
Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures
M6B CME Futures.Currencies.MicroGBP
Micro USD/CAD Futures
M6C CME Futures.Currencies.MicroCAD
Micro Euro/U.S. Dollar (EUR/USD) Futures
M6E CME Futures.Currencies.MicroEUR
Micro USD/JPY Futures
M6J CME Futures.Currencies.MicroUSDJPY
Micro USD/CHF Futures
M6S CME Futures.Currencies.MicroUSDCHF
Micro Bitcoin Futures
MBT CME Futures.Currencies.MicroBTC
Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures
MCD CME Futures.Currencies.MicroCADUSD
Micro Ether Futures
MET CME Futures.Currencies.MicroEther
Micro INR/USD Futures
MIR CME Futures.Currencies.MicroINRUSD
Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures
MJY CME Futures.Currencies.MicroJPY
Micro USD/CNH Futures
MNH CME Futures.Currencies.MicroUSDCNH
Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures
MSF CME Futures.Currencies.MicroCHF
Cash-settled Butter Futures
CB CME Futures.Dairy.CashSettledButter
Cash-Settled Cheese Futures
CSC CME Futures.Dairy.CashSettledCheese
Class III Milk Futures
DC CME Futures.Dairy.ClassIIIMilk
Dry Whey Futures
DY CME Futures.Dairy.DryWhey
Class IV Milk Futures
GDK CME Futures.Dairy.ClassIVMilk
Nonfat Dry Milk Futures
GNF CME Futures.Dairy.NonfatDryMilk
Propane Non-LDH Mont Belvieu (OPIS) BALMO Futures
1S NYMEX Futures.Energies.PropaneNonLDHMontBelvieu
Argus Propane Far East Index BALMO Futures
22 NYMEX Futures.Energies.ArgusPropaneFarEastIndexBALMO
Mini European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
A0D NYMEX Futures.Energies.MiniEuropeanThreePointPercentFiveFuelOilBargesPlatts
Mini Singapore Fuel Oil 180 cst (Platts) Futures
A0F NYMEX Futures.Energies.MiniSingaporeFuelOil180CstPlatts
Gulf Coast ULSD (Platts) Up-Down BALMO Futures
A1L NYMEX Futures.Energies.GulfCoastULSDPlattsUpDownBALMO
Gulf Coast Jet (Platts) Up-Down BALMO Futures
A1M NYMEX Futures.Energies.GulfCoastJetPlattsUpDownBALMO
Propane Non-LDH Mont Belvieu (OPIS) Futures
A1R NYMEX Futures.Energies.PropaneNonLDHMontBelvieuOPIS
European Propane CIF ARA (Argus) BALMO Futures
A32 NYMEX Futures.Energies.EuropeanPropaneCIFARAArgusBALMO
Premium Unleaded Gasoline 10 ppm FOB MED (Platts) Futures
A3G NYMEX Futures.Energies.PremiumUnleadedGasoline10ppmFOBMEDPlatts
Argus Propane Far East Index Futures
A7E NYMEX Futures.Energies.ArgusPropaneFarEastIndex
Gasoline Euro-bob Oxy NWE Barges (Argus) Crack Spread BALMO Futures
A7I NYMEX Futures.Energies.GasolineEurobobOxyNWEBargesArgusCrackSpreadBALMO
Mont Belvieu Natural Gasoline (OPIS) Futures
A7Q NYMEX Futures.Energies.MontBelvieuNaturalGasolineOPIS
Mont Belvieu Normal Butane (OPIS) BALMO Futures
A8J NYMEX Futures.Energies.MontBelvieuNormalButaneOPISBALMO
Conway Propane (OPIS) Futures
A8K NYMEX Futures.Energies.ConwayPropaneOPIS
Mont Belvieu LDH Propane (OPIS) BALMO Futures
A8O NYMEX Futures.Energies.MontBelvieuLDHPropaneOPISBALMO
Argus Propane Far East Index vs. European Propane CIF ARA (Argus) Futures
A91 NYMEX Futures.Energies.ArgusPropaneFarEastIndexVsEuropeanPropaneCIFARAArgus
Argus Propane (Saudi Aramco) Futures
A9N NYMEX Futures.Energies.ArgusPropaneSaudiAramco
Group Three ULSD (Platts) vs. NY Harbor ULSD Futures
AA6 NYMEX Futures.Energies.GroupThreeULSDPlattsVsNYHarborULSD
Group Three Sub-octane Gasoline (Platts) vs. RBOB Futures
AA8 NYMEX Futures.Energies.GroupThreeSuboctaneGasolinePlattsVsRBOB
Singapore Fuel Oil 180 cst (Platts) BALMO Futures
ABS NYMEX Futures.Energies.SingaporeFuelOil180cstPlattsBALMO
Singapore Fuel Oil 380 cst (Platts) BALMO Futures
ABT NYMEX Futures.Energies.SingaporeFuelOil380cstPlattsBALMO
Mont Belvieu Ethane (OPIS) Futures
AC0 NYMEX Futures.Energies.MontBelvieuEthaneOPIS
Mont Belvieu Normal Butane (OPIS) Futures
AD0 NYMEX Futures.Energies.MontBelvieuNormalButaneOPIS
Brent Crude Oil vs. Dubai Crude Oil (Platts) Futures
ADB NYMEX Futures.Energies.BrentCrudeOilVsDubaiCrudeOilPlatts
Argus LLS vs. WTI (Argus) Trade Month Futures
AE5 NYMEX Futures.Energies.ArgusLLSvsWTIArgusTradeMonth
Singapore Gasoil (Platts) vs. Low Sulphur Gasoil Futures
AGA NYMEX Futures.Energies.SingaporeGasoilPlattsVsLowSulphurGasoilFutures
Los Angeles CARBOB Gasoline (OPIS) vs. RBOB Gasoline Futures
AJL NYMEX Futures.Energies.LosAngelesCARBOBGasolineOPISvsRBOBGasoline
Los Angeles Jet (OPIS) vs. NY Harbor ULSD Futures
AJS NYMEX Futures.Energies.LosAngelesJetOPISvsNYHarborULSD
Los Angeles CARB Diesel (OPIS) vs. NY Harbor ULSD Futures
AKL NYMEX Futures.Energies.LosAngelesCARBDieselOPISvsNYHarborULSD
European Naphtha (Platts) BALMO Futures
AKZ NYMEX Futures.Energies.EuropeanNaphthaPlattsBALMO
European Propane CIF ARA (Argus) Futures
APS NYMEX Futures.Energies.EuropeanPropaneCIFARAArgus
Mont Belvieu Natural Gasoline (OPIS) BALMO Futures
AR0 NYMEX Futures.Energies.MontBelvieuNaturalGasolineOPISBALMO
RBOB Gasoline Crack Spread Futures
ARE NYMEX Futures.Energies.RBOBGasolineCrackSpread
Gulf Coast HSFO (Platts) BALMO Futures
AVZ NYMEX Futures.Energies.GulfCoastHSFOPlattsBALMO
Mars (Argus) vs. WTI Trade Month Futures
AYV NYMEX Futures.Energies.MarsArgusVsWTITradeMonth
Mars (Argus) vs. WTI Financial Futures
AYX NYMEX Futures.Energies.MarsArgusVsWTIFinancial
Ethanol T2 FOB Rdam Including Duty (Platts) Futures
AZ1 NYMEX Futures.Energies.EthanolT2FOBRdamIncludingDutyPlatts
Brent Crude Futures
B ICE Futures.Energies.BrentCrude
Mont Belvieu LDH Propane (OPIS) Futures
B0 NYMEX Futures.Energies.MontBelvieuLDHPropaneOPIS
Gasoline Euro-bob Oxy NWE Barges (Argus) Futures
B7H NYMEX Futures.Energies.GasolineEurobobOxyNWEBargesArgus
WTI-Brent Financial Futures
BK NYMEX Futures.Energies.WTIBrentFinancial
3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread (1000mt) Futures
BOO NYMEX Futures.Energies.ThreePointFivePercentFuelOilBargesFOBRdamPlattsCrackSpread1000mt
Gasoline Euro-bob Oxy NWE Barges (Argus) BALMO Futures
BR7 NYMEX Futures.Energies.GasolineEurobobOxyNWEBargesArgusBALMO
Brent Last Day Financial Futures
BZ NYMEX Futures.Energies.BrentLastDayFinancial
Crude Oil Futures
CL NYMEX Futures.Energies.CrudeOilWTI
Gulf Coast CBOB Gasoline A2 (Platts) vs. RBOB Gasoline Futures
CRB NYMEX Futures.Energies.GulfCoastCBOBGasolineA2PlattsVsRBOBGasoline
Clearbrook Bakken Sweet (NE2) Monthly Index Futures
CSW NYMEX Futures.Energies.ClearbrookBakkenSweetCrudeOilMonthlyIndexNetEnergy
WTI Financial Futures
CSX NYMEX Futures.Energies.WTIFinancial
Chicago Ethanol (Platts) Futures
CU NYMEX Futures.Energies.ChicagoEthanolPlatts
Singapore Mogas 92 Unleaded (Platts) Brent Crack Spread Futures
D1N NYMEX Futures.Energies.SingaporeMogas92UnleadedPlattsBrentCrackSpread
Dubai Crude Oil (Platts) Financial Futures
DCB NYMEX Futures.Energies.DubaiCrudeOilPlattsFinancial
Japan C&F Naphtha (Platts) BALMO Futures
E6 NYMEX Futures.Energies.JapanCnFNaphthaPlattsBALMO
Ethanol Futures
EH CBOT Futures.Energies.Ethanol
European Naphtha (Platts) Crack Spread Futures
EN NYMEX Futures.Energies.EuropeanNaphthaPlattsCrackSpread
European Propane CIF ARA (Argus) vs. Naphtha Cargoes CIF NWE (Platts) Futures
EPN NYMEX Futures.Energies.EuropeanPropaneCIFARAArgusVsNaphthaCargoesCIFNWEPlatts
Singapore Fuel Oil 380 cst (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
EVC NYMEX Futures.Energies.SingaporeFuelOil380cstPlattsVsEuropeanThreePointFivePercentFuelOilBargesFOBRdamPlatts
East-West Gasoline Spread (Platts-Argus) Futures
EWG NYMEX Futures.Energies.EastWestGasolineSpreadPlattsArgus
East-West Naphtha: Japan C&F vs. Cargoes CIF NWE Spread (Platts) Futures
EWN NYMEX Futures.Energies.EastWestNaphthaJapanCFvsCargoesCIFNWESpreadPlatts
RBOB Gasoline vs. Euro-bob Oxy NWE Barges (Argus) (350000 gallons) Futures
EXR NYMEX Futures.Energies.RBOBGasolineVsEurobobOxyNWEBargesArgusThreeHundredFiftyThousandGallons
3.5% Fuel Oil Barges FOB Rdam (Platts) Crack Spread Futures
FO NYMEX Futures.Energies.ThreePointFivePercentFuelOilBargesFOBRdamPlattsCrackSpread
Freight Route TC14 (Baltic) Futures
FRC NYMEX Futures.Energies.FreightRouteTC14Baltic
1% Fuel Oil Cargoes FOB NWE (Platts) vs. 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
FSS NYMEX Futures.Energies.OnePercentFuelOilCargoesFOBNWEPlattsVsThreePointFivePercentFuelOilBargesFOBRdamPlatts
Low Sulfur Gasoil
G ICE Futures.Energies.LowSulfurGasoil
Gulf Coast HSFO (Platts) vs. European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
GCU NYMEX Futures.Energies.GulfCoastHSFOPlattsVsEuropeanThreePointFivePercentFuelOilBargesFOBRdamPlatts
WTI Houston Crude Oil Futures
HCL NYMEX Futures.Energies.WTIHoustonCrudeOil
Natural Gas (Henry Hub) Last-day Financial Futures
HH NYMEX Futures.Energies.NaturalGasHenryHubLastDayFinancial
NY Harbor ULSD Futures
HO NYMEX Futures.Energies.HeatingOil
Natural Gas (Henry Hub) Penultimate Financial Futures
HP NYMEX Futures.Energies.NaturalGasHenryHubPenultimateFinancial
WTI Houston (Argus) vs. WTI Trade Month Futures
HTT NYMEX Futures.Energies.WTIHoustonArgusVsWTITradeMonth
Micro Gasoil 0.1% Barges FOB ARA (Platts) Futures
M1B NYMEX Futures.Energies.MicroGasoilZeroPointOnePercentBargesFOBARAPlatts
Micro European 3.5% Fuel Oil Cargoes FOB Med (Platts) Futures
M35 NYMEX Futures.Energies.MicroEuropeanThreePointFivePercentFuelOilCargoesFOBMedPlatts
Micro Coal (API 5) fob Newcastle (Argus/McCloskey) Futures
M5F NYMEX Futures.Energies.MicroCoalAPIFivefobNewcastleArgusMcCloskey
Micro Singapore Fuel Oil 380CST (Platts) Futures
MAF NYMEX Futures.Energies.MicroSingaporeFuelOil380CSTPlatts
Micro WTI Crude Oil Futures
MCL NYMEX Futures.Energies.MicroCrudeOilWTI
Micro European 3.5% Fuel Oil Barges FOB Rdam (Platts) Futures
MEF NYMEX Futures.Energies.MicroEuropeanThreePointFivePercentOilBargesFOBRdamPlatts
Henry Hub Natural Gas Futures
NG NYMEX Futures.Energies.NaturalGas
Micro European FOB Rdam Marine Fuel 0.5% Barges (Platts) Futures
R5O NYMEX Futures.Energies.MicroEuropeanFOBRdamMarineFuelZeroPointFivePercentBargesPlatts
RBOB Gasoline Futures
RB NYMEX Futures.Energies.Gasoline
Micro Singapore FOB Marine Fuel 0.5% (Platts) Futures
S5O NYMEX Futures.Energies.MicroSingaporeFOBMarineFuelZeroPointFivePercetPlatts
Micro 10-Year Yield Futures
10Y CBOT Futures.Financials.MicroY10TreasuryNote
Micro 2-Year Yield Futures
2YY CBOT Futures.Financials.MicroY2TreasuryBond
Micro 30-Year Yield Futures
30Y CBOT Futures.Financials.MicroY30TreasuryBond
Micro 5-Year Yield Futures
5YY CBOT Futures.Financials.MicroY5TreasuryBond
5-Year USD MAC Swap Futures
F1U CBOT Futures.Financials.FiveYearUSDMACSwap
Eurodollar Futures
GE CME Futures.Financials.EuroDollar
Ultra 10-Year U.S. Treasury Note Futures
TN CBOT Futures.Financials.UltraTenYearUSTreasuryNote
Ultra U.S. Treasury Bond Futures
UB CBOT Futures.Financials.UltraUSTreasuryBond
U.S. Treasury Bond Futures
ZB CBOT Futures.Financials.Y30TreasuryBond
5-Year T-Note Futures
ZF CBOT Futures.Financials.Y5TreasuryNote
10-Year T-Note Futures
ZN CBOT Futures.Financials.Y10TreasuryNote
2-Year T-Note Futures
ZT CBOT Futures.Financials.Y2TreasuryNote
Random Length Lumber Futures
LBS CME Futures.Forestry.RandomLengthLumber
Black Sea Corn Financially Settled (Platts) Futures
BCF CBOT Futures.Grains.BlackSeaCornFinanciallySettledPlatts
Black Sea Wheat Financially Settled (Platts) Futures
BWF CBOT Futures.Grains.BlackSeaWheatFinanciallySettledPlatts
KC HRW Wheat Futures
KE CBOT Futures.Grains.HRWWheat
Corn Futures
ZC CBOT Futures.Grains.Corn
Soybean Oil Futures
ZL CBOT Futures.Grains.SoybeanOil
Soybean Meal Futures
ZM CBOT Futures.Grains.SoybeanMeal
Oats Futures
ZO CBOT Futures.Grains.Oats
Soybean Futures
ZS CBOT Futures.Grains.Soybeans
Chicago SRW Wheat Futures
ZW CBOT Futures.Grains.SRWWheat
Bloomberg Commodity Index Futures
AW CBOT Futures.Indices.BloombergCommodityIndex
BankNifty Index
BANKNIFTY INDIA Futures.Indices.BankNifty
E-mini Nasdaq-100 Biotechnology Index Futures
BIO CME Futures.Indices.NASDAQ100BiotechnologyEMini
E-mini FTSE Emerging Index Futures
EI CME Futures.Indices.FTSEEmergingEmini
E-mini S&P MidCap 400 Futures
EMD CME Futures.Indices.SP400MidCapEmini
E-mini S&P 500 Futures
ES CME Futures.Indices.SP500EMini
S&P-GSCI Commodity Index Futures
GD CME Futures.Indices.SPGSCICommodity
USD-Denominated Ibovespa Index Futures
IBV CME Futures.Indices.USDDenominatedIbovespa
MSCI Europe NTR
M1EU NYSELIFFE Futures.Indices.MSCIEuropeNTR
The MSCI Japan NTR
M1JP NYSELIFFE Futures.Indices.MSCIJapanNTR
MSCI Emerging Markets Asia Net Total Return
M1MSA NYSELIFFE Futures.Indices.MSCIEmergingMarketsAsiaNTR
Micro E-mini Russell 2000 Index Futures
M2K CME Futures.Indices.MicroRussell2000EMini
Micro E-mini Standard and Poor's 500 Stock Price Index Futures
MES CME Futures.Indices.MicroSP500EMini
Micro E-mini Nasdaq-100 Index Futures
MNQ CME Futures.Indices.MicroNASDAQ100EMini
MSCI EAFE Index
MXEA NYSELIFFE Futures.Indices.MSCIEafeIndex
MSCI EMERGING MARKETS INDEX
MXEF NYSELIFFE Futures.Indices.MSCIEmergingMarketsIndex
MSCI USA Index
MXUS NYSELIFFE Futures.Indices.MSCIUsaIndex
Micro E-mini Dow Jones Industrial Average Index Futures
MYM CBOT Futures.Indices.MicroDow30EMini
Nifty50 Index
NIFTY INDIA Futures.Indices.Nifty50
SGX Nikkei 225 Index Futures
NK SGX Futures.Indices.Nikkei225Yen
Nikkei/USD Futures
NKD CME Futures.Indices.Nikkei225Dollar
E-mini Nasdaq-100 Futures
NQ CME Futures.Indices.NASDAQ100EMini
E-mini Russell 2000 Index Futures
RTY CME Futures.Indices.Russell2000EMini
BSE S&P Sensex Index
SENSEX INDIA Futures.Indices.BseSensex
MSCI Taiwan Index Futures
TW SGX Futures.Indices.MSCITaiwanIndex
VIX futures
VX CFE Futures.Indices.VIX
E-mini Dow ($5) Futures
YM CBOT Futures.Indices.Dow30EMini
Feeder Cattle Futures
GF CME Futures.Meats.FeederCattle
Lean Hog Futures
HE CME Futures.Meats.LeanHogs
Live Cattle Futures
LE CME Futures.Meats.LiveCattle
Aluminum MW U.S. Transaction Premium Platts (25MT) Futures
AUP COMEX Futures.Metals.AluminumMWUSTransactionPremiumPlatts25MT
Aluminium European Premium Duty-Paid (Metal Bulletin) Futures
EDP COMEX Futures.Metals.AluminiumEuropeanPremiumDutyPaidMetalBulletin
Gold Futures
GC COMEX Futures.Metals.Gold
Copper Futures
HG COMEX Futures.Metals.Copper
U.S. Midwest Domestic Hot-Rolled Coil Steel (CRU) Index Futures
HRC NYMEX Futures.Metals.USMidwestDomesticHotRolledCoilSteelCRUIndex
Micro Gold Futures
MGC COMEX Futures.Metals.MicroGold
Micro Gold TAS Futures
MGT COMEX Futures.Metals.MicroGoldTAS
Palladium Futures
PA NYMEX Futures.Metals.Palladium
Micro Palladium Futures
PAM NYMEX Futures.Metals.MicroPalladium
Platinum Futures
PL NYMEX Futures.Metals.Platinum
Silver Futures
SI COMEX Futures.Metals.Silver
Micro Silver Futures
SIL COMEX Futures.Metals.MicroSilver
Mini Sized NY Gold Futures
YG NYSELIFFE Futures.Metals.MiniNYGold
Mini Sized NY Silver Future
YI NYSELIFFE Futures.Metals.MiniNYSilver
Gold 100 Troy Oz
ZG NYSELIFFE Futures.Metals.Gold100Oz
CBOT 5000 Oz Silver Futures
ZI NYSELIFFE Futures.Metals.Silver5000Oz
Cocoa Futures
CC ICE Futures.Softs.Cocoa
Cotton No. 2 Futures
CT ICE Futures.Softs.Cotton2
Coffee C Arabica Futures
KC ICE Futures.Softs.Coffee
Frozen Concentrated Orange Juice
OJ ICE Futures.Softs.OrangeJuice
Sugar No. 11 Futures
SB ICE Futures.Softs.Sugar11
No. 11 Sugar Futures
YO NYMEX Futures.Softs.Sugar11CME

Data Point Attributes

The US Futures dataset provides FuturesChain , Future , and OpenInterest objects. To configure the continuous Future settings, use the DataNormalizationMode and DataMappingMode enumerations.

DataNormalizationMode Values

The DataNormalizationMode enumeration has the following values:

DataMappingMode Values

The DataMappingMode enumeration has the following values:

Future Attributes

Future objects have the following attributes:

FuturesChain Attributes

FuturesChain objects have the following attributes:

OpenInterest Attributes

OpenInterest objects have the following attributes:

Requesting Data

To add US Futures data to your algorithm, call the AddFuture method. Save a reference to the Future so you can access the data later in your algorithm.

class USFuturesDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2013, 12, 20) 
        self.SetEndDate(2014, 2, 20) 
        self.SetCash(1000000) 
        
        future = self.AddFuture(Futures.Metals.Gold) 
        future.SetFilter(0, 90)
        self.future_symbol = future.Symbol
namespace QuantConnect
{
    public class USFuturesDataAlgorithm : QCAlgorithm
    {
        private Symbol _futureSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2013, 12, 20);
            SetEndDate(2014, 2, 20);
            SetCash(1000000);
            
            var future = AddFuture(Futures.Metals.Gold);
            future.SetFilter(0, 90);
            _futureSymbol = future.Symbol;
        }
    }
}

For more information about creating Future subscriptions, see Requesting Data or Futures Universes .

Accessing Data

To get the current US Futures data, index the FuturesChains property of the current Slice with the canonical Futures Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your Future at every time step.

def OnData(self, slice: Slice) -> None:
    chain = slice.FuturesChains.get(self.future_symbol)
    if chain:
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    if (slice.FuturesChains.TryGetValue(_futureSymbol, out var chain))
    {
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

You can also iterate through all of the FuturesChain objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.FuturesChains.items():
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.FuturesChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

For more information about accessing Futures data, see Handling Data .

Historical Data

You can get historical US Futures data in an algorithm and the Research Environment.

Historical Data In Algorithms

To get historical US Futures data in an algorithm, call the History method with the canonical Futures Symbol or a Futures contract Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame objects
contract_history_df = self.History(contract.Symbol, 100, Resolution.Minute)
continuous_history_df = self.History(self.future_symbol,
    start=self.Time - timedelta(days=15), 
    end=self.Time, 
    resolution=Resolution.Minute, 
    fillForward=False, 
    extendedMarketHours=False, 
    dataMappingMode=DataMappingMode.OpenInterest, 
    dataNormalizationMode=DataNormalizationMode.Raw, 
    contractDepthOffset=0)

# TradeBar objects
contract_history_trade_bars = self.History[TradeBar](contract.Symbol, 100, Resolution.Minute)
continous_history_trade_bars = self.History[TradeBar](self.future_symbol, 100, Resolution.Minute)

# QuoteBar objects
contract_history_quote_bars = self.History[QuoteBar](contract.Symbol, 100, Resolution.Minute)
continous_history_quote_bars = self.History[QuoteBar](self.future_symbol, 100, Resolution.Minute)

# Tick objects
contract_history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
continous_history_ticks = self.History[Tick](self.future_symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects
var contractHistoryTradeBars = History(contract.Symbol, 100, Resolution.Minute);
var continuousHistoryTradeBars = History(
    symbols: new[] {_futureSymbol}, 
    start: Time - TimeSpan.FromDays(15),
    end: Time,
    resolution: Resolution.Minute,
    fillForward: False,
    extendedMarketHours: False,
    dataMappingMode: DataMappingMode.OpenInterest,
    dataNormalizationMode: DataNormalizationMode.Raw,
    contractDepthOffset: 0);

// QuoteBar objects
var contractHistoryQuoteBars = History<QuoteBar>(contract.Symbol, 100, Resolution.Minute);
var continuousHistoryQuoteBars = History<QuoteBar>(_futureSymbol, 100, Resolution.Minute);

// Tick objects
var contractHistoryTicks = History<Tick>(contract.Symbol, TimeSpan.FromSeconds(10), Resolution.Tick);
var continuousHistoryTicks = History<Tick>(_futureSymbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data in algorithms, see History Requests . For more information about the price adjustments for continuous contracts, see Continous Contracts .

Historical Data In Research

To get historical US Futures data in the Research Environment for an entire Futures chain, call the GetFutureHistory method with the canonical Future Symbol .

qb = QuantBook()
future = qb.AddFuture(Futures.Metals.Gold) 
future.SetFilter(0, 90)
history = qb.GetFutureHistory(future.Symbol, datetime(2020, 6, 1), datetime(2020, 6, 5))

all_history = history.GetAllData()
expiries = history.GetExpiryDates()
// The GetFutureHistory method isn't currently available for C#
// To track the feature progress, subscribe to https://github.com/QuantConnect/Lean/issues/6489

To get historical data for a single US Futures contract or the continuous Futures contract, call the History method like you would in an algorithm but on the QuantBook object. For more information about historical data in the Research Environment, see Futures .

Example Applications

The US Futures dataset enables you to accurately design Futures strategies. Examples include the following strategies:

 

6.3.5 US Index Options

Introduction

The US Index Options dataset by AlgoSeek covers European Option contracts for 3 US Indices: SPX, VIX, and NDX. The dataset starts from June 2010 and is delivered on minute resolution. This dataset is created by monitoring the Options Price Reporting Authority (OPRA) data feed, which consolidates last sale and quotation information originating from the national securities exchanges that have been approved by the Securities and Exchange Commission.

For more information about the US Index Options dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com .

Getting Started

The following snippet demonstrates how to request data from the US Index Options dataset:

from QuantConnect.DataSource import *

self.index_symbol = self.AddIndex('VIX').Symbol
option = self.AddIndexOption(self.index_symbol)
option.SetFilter(-2, 2, 0, 90)
self.option_symbol = option.Symbol
using QuantConnect.DataSource;

_indexSymbol = AddIndex("VIX").Symbol;
var option = AddIndexOption(_indexSymbol);
option.SetFilter(-2, 2, 0, 90);
_optionSymbol = option.Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date June 2010
Asset Coverage 7 Index Options
Data Density Regular
Resolution Minute, Hourly, & Daily
Timezone New York

Supported Assets

The following table shows the available Index Options:

Underlying Index Underlying Ticker Target Ticker Standard Contracts Weekly Contracts Tradable on Expiry Day
S&P500 VIX green check
S&P500 VIX VIXW green check
S&P500 SPX green check
S&P500 SPX SPXW green check green check
NASDAQ-100 NDX green check
NASDAQ-100 NDX NDXP green check green check
NASDAQ-100 NDX NQX green check green check green check

For more information about each underlying Index, see Supported Indices .

Data Point Properties

The US Index Options dataset provides TradeBar and QuoteBar objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Requesting Data

To add US Index Options data to your algorithm, call the AddIndexOption method. Save a reference to the Index Option Symbol so you can access the data later in your algorithm.

class IndexOptionsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1);
        self.SetEndDate(2021, 6, 1);
        self.SetCash(1000000);
        
        self.index_symbol = self.AddIndex('VIX').Symbol
        
        standard_option = self.AddIndexOption(self.index_symbol)
        standard_option.SetFilter(-2, 2, 0, 90)
        self.standard_option_symbol = standard_option.Symbol

        weekly_option = self.AddIndexOption(self.index_symbol, "VIXW")
        weekly_option.SetFilter(-2, 2, 0, 90)
        self.weekly_option_symbol = weekly_option.Symbol
namespace QuantConnect
{
    public class IndexOptionsDataAlgorithm : QCAlgorithm
    {
    	private Symbol _indexSymbol, _standardOptionSymbol, _weeklyOptionSymbol;

        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            _indexSymbol = AddIndex("VIX").Symbol;

            var standardOption = AddIndexOption(_indexSymbol);
            standardOption.SetFilter(-2, 2, 0, 90);
            _standardOptionSymbol = standardOption.Symbol;

            var weeklyOption = AddIndexOption(_indexSymbol, "VIXW");
            weeklyOption.SetFilter(-2, 2, 0, 90);
            _weeklyOptionSymbol = weeklyOption.Symbol;
        }
    }
}

The Index resolution must be less than or equal to the Index Option resolution. For example, if you set the Index resolution to minute, then you must set the Index Option resolution to minute, hour, or daily.

For more information about creating US Index Option subscriptions, see Requesting Data or Index Options Universes .

Accessing Data

To get the current US Index Options data, index the OptionChains property of the current Slice with the canonical Index Option Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your Index Option at every time step.

def OnData(self, slice: Slice) -> None:
    standard_chain = slice.OptionChains.get(self.standard_option_symbol)
    if standard_chain:
        for contract in standard_chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")

    weekly_chain = slice.OptionChains.get(self.weekly_option_symbol)
    if weekly_chain:
        for contract in weekly_chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    if (slice.OptionChains.ContainsKey(_standardOptionSymbol))
    {
        var standardChain = slice.OptionChains[_standardOptionSymbol];
        foreach (var contract in standardChain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }

    if (slice.OptionChains.ContainsKey(_weeklyOptionSymbol))
    {
        var weeklyChain = slice.OptionChains[_weeklyOptionSymbol];
        foreach (var contract in weeklyChain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

You can also iterate through all of the OptionChain objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for canonical_symbol, chain in slice.OptionChains.items():
        for contract in chain:
            self.Log(f"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.OptionChains)
    {
        var canonicalSymbol = kvp.Key;
        var chain = kvp.Value;
        foreach (var contract in chain)
        {
            Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}");
        }
    }
}

For more information about accessing US Index Options data, see Handling Data .

Historical Data

You can get historical US Index Options data in an algorithm and the Research Environment.

Historical Data In Algorithms

To get historical US Index Options data in an algorithm, call the History method with the Index Option contract Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(contract.Symbol, 100, Resolution.Minute)

# TradeBar objects
history_trade_bars = self.History[TradeBar](contract.Symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](contract.Symbol, 100, Resolution.Minute)
// TradeBar objects 
var historyTradeBars = History(contract.Symbol, 100, Resolution.Minute);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(contract.Symbol, 100, Resolution.Minute);

For more information about historical data in algorithms, see History Requests .

Historical Data In Research

To get historical US Index Options data in the Research Environment for an entire Option chain, call the GetOptionHistory method with the canonical Option Symbol .

qb = QuantBook()
index_symbol = qb.AddIndex('VIX').Symbol
option = qb.AddIndexOption(index_symbol) # or qb.AddIndexOption(index_symbol, "VIXW")
option.SetFilter(-2, 2, 0, 90)
history = qb.GetOptionHistory(option.Symbol, datetime(2020, 6, 1), datetime(2020, 6, 5))

all_history = history.GetAllData()
expiries = history.GetExpiryDates() 
strikes = history.GetStrikes()
// The GetOptionHistory method isn't currently available for C#
// To track the feature progress, subscribe to https://github.com/QuantConnect/Lean/issues/6489

To get historical data for a single US Index Option contract, call the History method like you would in an algorithm but on the QuantBook object. For more information about historical data in the Research Environment, see Index Options .

Data Point Attributes

The US Index Options dataset provides TradeBar and QuoteBar objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Example Applications

The US Index Options dataset enables you to accurately design strategies for Index Options. Examples include the following strategies:

 

6.4 Morningstar

Morningstar was founded by Joe Mansueto in 1984 with the goal of empowering investors by connecting people to the investing information and tools they need. Morningstar provides access extensive line of products and services for individual investors, financial advisors, asset managers, and retirement plan providers. Morningstar provides data on approximately 525,000 investment offerings including stocks, mutual funds, and similar vehicles, along with real-time global market data on nearly 18 million equities, indexes, futures, options, commodities, and precious metals, in addition to foreign exchange and Treasury markets. Morningstar also offers investment management services through its investment advisory subsidiaries, with $244 billion in assets under advisement or management as of 2021.

 

6.4.1 US Fundamental Data

Introduction

The US Fundamental Data by Morningstar tracks US Equity fundamentals. The data covers 5,000 US Equities, starts in January 1998, and is delivered on a daily frequency. This dataset is created by using a combination of string matching, Regular Expressions, and Machine Learning to gather the fundamental data published by companies.

For older symbols, the file date is approximated 45 days after the as of date. When a filing date is present on the Morningstar data, it is used. As we are a quant platform, all the data is loaded using "As Original Reported" figures. If there was a mistake reporting the figure, this will not be fixed later. The market typically responds quickly to these initially reported figures. Data is available for multiple periods depending on the property. Periods available include: 1 mo, 2 mo, 3 mo, 6 mo, 9 mo, 12 mo, 1 Yr, 2 Yr, 3 Yr, and 5 Yr. Morningstar symbols cover the NYSE, NASDAQ, AMEX, and BATS exchanges.

In live trading, Morningstar data is delivered to your algorithm at approximately 6 am each day. The majority of the fundamental data update occurs once per month. This includes updates to all of the key information for each security Morningstar supports. On top of this monthly update, there are daily updates of the financial ratios.

As Morningstar data arrives, it updates the master copy and is passed into your algorithm, similar to how TradeBars are fill-forwarded in your data feed. If there have been no updates for a day, you'll receive the same fundamental data.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Fundamental Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Morningstar was founded by Joe Mansueto in 1984 with the goal of empowering investors by connecting people to the investing information and tools they need. Morningstar provides access extensive line of products and services for individual investors, financial advisors, asset managers, and retirement plan providers. Morningstar provides data on approximately 525,000 investment offerings including stocks, mutual funds, and similar vehicles, along with real-time global market data on nearly 18 million equities, indexes, futures, options, commodities, and precious metals, in addition to foreign exchange and Treasury markets. Morningstar also offers investment management services through its investment advisory subsidiaries, with $244 billion in assets under advisement or management as of 2021.

Getting Started

The following snippet demonstrates how to request data from the US Fundamental dataset:

from QuantConnect.DataSource import *

self.AddUniverse(self.SelectCoarse, self.SelectFine)
using QuantConnect.DataSource;

AddUniverse(SelectCoarse, SelectFine);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1998
Asset Coverage 5,000 US Equities
Corporate Indicators / Tracked Fields 900 Fields
Data Density Sparse
Resolution Daily
Timezone New York

Supported Assets

To view the supported assets in the US Fundamental dataset, see the Data Explorer .

Data Point Attributes

The US Fundamentals dataset provides FineFundamental objects. To filter FineFundamental objects, you can use the MorningstarSectorCode , MorningstarIndustryGroupCode , and MorningstarIndustryCode enumeration values.

FineFundamental Attributes

FineFundamental objects have the following attributes:

MorningstarSectorCode Enumeration

Sectors are large super categories of data. To access the sector of an Equity, use the MorningstarSectorCode property.

filteredFine = fine.Where(x => x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarSectorCode == MorningstarSectorCode.Technology]

The MorningstarSectorCode enumeration has the following members:

MorningstarIndustryGroupCode Enumeration

Industry groups are clusters of related industries which tie together. To access the industry group of an Equity, use the MorningstarIndustryGroupCode property.

filteredFine = fine.Where(x => x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.ApplicationSoftware);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarIndustryGroupCode == MorningstarIndustryGroupCode.ApplicationSoftware]

The MorningstarIndustryGroupCode enumeration has the following members:

MorningstarIndustryCode Enumeration

Industries are the finest level of classification available and are the individual industries according to the Morningstar classification system. To access the industry group of an Equity, use the MorningstarIndustryCode property.

filteredFine = fine.Where(x => x.AssetClassification.MorningstarIndustryCode == MorningstarIndustryCode.SoftwareApplication);
filtered_fine = [x for x in fine if x.AssetClassification.MorningstarIndustryCode == MorningstarIndustryCode.SoftwareApplication]

The MorningstarIndustryCode enumeration has the following members:

Exchange ID Values

The exchange ID represents the exchange that lists the Equity. To access the exchange ID of an Equity, use the PrimaryExchangeID property.

filteredFine = fine.Where(x => x.CompanyReference.PrimaryExchangeID == "NAS");
filtered_fine = [x for x in fine if x.CompanyReference.PrimaryExchangeID == "NAS"]

The exchanges are represented by the following string values:

String Representation Exchange
NYS New York Stock Exchange (NYSE)
NAS NASDAQ
ASE American Stock Exchange (AMEX)
TSE Tokyo Stock Exchange
AMS Amsterdam Internet Exchange
SGO Santiago Stock Exchange
XMAD Madrid Stock Exchange
ASX Australian Securities Exchange
BVMF B3 (stock exchange)
LON London Stock Exchange
TKS Istanbul Stock Exchange Settlement and Custody Bank
SHG Shanghai Exchange
LIM Lima Stock Exchange
FRA Frankfurt Stock Exchange
JSE Johannesburg Stock Exchange
MIL Milan Stock Exchange
TAE Tel Aviv Stock Exchange
STO Stockholm Stock Exchange
ETR Deutsche Boerse Xetra Core
PAR Paris Stock Exchange
BUE Buenos Aires Stock Exchange
KRX Korea Exchange
SWX SIX Swiss Exchange
PINX Pink Sheets (OTC)
CSE Canadian Securities Exchange
PHS Philippine Stock Exchange
MEX Mexican Stock Exchange
TAI Taiwan Stock Exchange
IDX Indonesia Stock Exchange
OSL Oslo Stock Exchange
BOG Colombia Stock Exchange
NSE National Stock Exchange of India
HEL Nasdaq Helsinki
MISX Moscow Exchange
HKG Hong Kong Stock Exchange
IST Istanbul Stock Exchange
BOM Bombay Stock Exchange
TSX Toronto Stock Exchange
BRU Brussels Stock Exchange
BATS BATS Global Markets
ARCX NYSE Arca
GREY Grey Market (OTC)
DUS Dusseldorf Stock Exchange
BER Berlin Stock Exchange
ROCO Taipei Exchange
CNQ Canadian Trading and Quotation System Inc.
BSP Bangko Sentral ng Pilipinas
NEOE NEO Exchange

Requesting Data

To add US Fundamental data to your algorithm, pass a fine universe selection method to the AddUniverse or AddUniverseSelection method.

class MorningStarDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 7, 1)
        self.SetCash(100000) 
        
        self.AddUniverse(self.SelectCoarse, self.SelectFine)
namespace QuantConnect
{
    public class MorningStarDataAlgorithm : QCAlgorithm
    {    	
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 7, 1);
            SetCash(100000);
            
            AddUniverse(SelectCoarse, SelectFine);
        }
    }
}

Accessing Data

To access fundamental data, use the FineFundamental objects in your second selection function or use the Fundamental property of the Equity objects in your algorithm. The Symbol objects you return from the coarse selection function are the Symbol objects that comprise the FineFundamental objects in your fine fundamental selection function.

def SelectCoarse(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    selected = [c for c in coarse if c.HasFundamentalData]
    sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
    return [ c.Symbol for c in sorted_by_dollar_volume[:20] ]
    
def SelectFine(self, fine: List[FineFundamental]) -> List[Symbol]:
    sorted_by_pe_ratio = sorted(fine, key=lambda f: f.ValuationRatios.PERatio, reverse=True)
    return [ f.Symbol for f in sorted_by_pe_ratio[:5] ]
public IEnumerable<Symbol> SelectCoarse(IEnumerable<CoarseFundamental> coarse)
{
    return coarse.OrderByDescending(x => x.DollarVolume).Take(20).Select(x => x.Symbol);
}
        
public IEnumerable<Symbol> SelectFine(IEnumerable<FineFundamental> fine)
{
    return fine.OrderByDescending(x => x.ValuationRatios.PERatio).Take(5).Select(x => x.Symbol);
}

Many of the MorningStar values are MultiPeriodField objects. These objects represent a timespan of data, normally either OneMonth , ThreeMonths , SixMonths , or TwelveMonths . To view the objects, see the the auto-generated classes in the LEAN GitHub repository.

To access fundamental data outside of your fine fundamental selection function, use the Fundamental property of the Equity objects in your algorithm.

fundamentals = self.Securities[symbol].Fundamentals
var fundamentals = Securities[symbol].Fundamentals;

Historical Data

It's currently only possible to get historical fundamental data from the Research Environment. To get historical data, call the GetFundamental method with the Equity Symbol , a FineFundamental property, a start date, and an end date. If there is no data in the period you request, the history result is empty.

history = qb.GetFundamental(symbol, "ValuationRatios.PERatio", datetime(2021, 1, 1), datetime(2021, 7, 1))
var history = qb.GetFundamental(symbol, "ValuationRatios.PERatio", new DateTime(2021, 1, 1), new DateTime(2021, 7, 1));

For more information about historical US Equity fundamental data in the Research Environment, see Equity Fundamental Data .

To be notified when historical fundamental data is available in an algorithm, subscribe to GitHub Issue #4890 .

Example Applications

The US Fundamentals dataset enables you to design strategies harnessing fundamental data points. Examples include the following strategies:

 

6.5 TickData

TickData was founded by a futures broker and a programmer in 1984 as the first company in the world to offer historical tick-by-tick prices on the futures and index markets. TickData provides access to comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cash Indices.

 

6.5.1 US Cash Indices

Introduction

The US Cash Indices dataset by TickData covers 3 US Indices: SPX, VIX, and NDX. The data starts on various dates from Janunary 1998 and is delivered on any frequency from tick to daily. This dataset is created by TickData negotiating directly with exchanges for their official archive and by partnering with real-time data providers who have direct exchange connections and multiple redundant ticker plants.

For more information about the US Cash Indices dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

TickData was founded by a futures broker and a programmer in 1984 as the first company in the world to offer historical tick-by-tick prices on the futures and index markets. TickData provides access to comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cash Indices.

Getting Started

The following snippet demonstrates how to request data from the US Cash Indices dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddIndex("VIX", Resolution.Daily).Symbol
using QuantConnect.DataSource;

_symbol = AddIndex("VIX", Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1998*
Coverage 3 US Indices
Data Density Dense
Resolution Tick, Second, Minute, Hour, & Daily
Timezone New York

Supported Indices

The following table shows the available indices:

Ticker Index Expiry Start Date
VIX S&P500 30 Days Jul 2003
SPX S&P500 - Jan 1998
NDX NASDAQ-100 - Jan 1998

VIX - CBOE Volatility Index

The Cboe Volatility Index (VIX) is a real-time index that represents the market's expectations for the relative strength of near-term price changes of the S&P 500 index (SPX). Because it's derived from the prices of SPX index Options with near-term expiration dates, it generates a 30-day forward projection of volatility. Volatility, or how fast prices change, is often seen as a way to gauge market sentiment, and in particular, the degree of fear among market participants.

SPX - S&P 500 Index

The S&P 500 Index, or the Standard & Poor's 500 Index, is a market-capitalization-weighted index of the 500 largest publicly-traded companies in the U.S. It is not an exact list of the top 500 U.S. companies by market capitalization because there are other criteria included in the index. The index is widely regarded as the best gauge of large-cap U.S. Equities.

NDX - Nasdaq 100 Index

The Nasdaq-100 Index is a modified market-capitalization-weighted index composed of securities issued by 100 of the largest non-financial companies listed on the Nasdaq Stock Market (Nasdaq). The index includes companies from various industries except for the financial industry, like commercial and investment banks. These non-financial sectors include retail, biotechnology, industrial, technology, health care, and others.

Data Point Attributes

The US Cash Indices dataset provides TradeBar and Tick objects.

TradeBar Attributes

TradeBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Requesting Data

To add US Cash Indices data to your algorithm, call the AddIndex method. Save a reference to the Index Symbol so you can access the data later in your algorithm.

class USCashIndexAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddIndex("VIX").Symbol
namespace QuantConnect
{
    public class USCashIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            _symbol = AddIndex("VIX").Symbol;
        }
    }
}

For more information about creating Index subscriptions, see Requesting Data .

Accessing Data

To get the current US Cash Indices data, index the Bars or Ticks properties of the current Slice with the Index Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing US Index data, see Handling Data .

Historical Data

To get historical US Cash Indices data, call the History method with the Index Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_bars = self.History[TradeBar](self.symbol, 100, Resolution.Daily)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects
var historyBars = History(_symbol, 100, Resolution.Daily);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a US Index subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

Example Applications

The US Cash Indices enables you to incorporate popular US indicies into your trading algorithms. Examples include the following use cases:

 

6.6 CoinAPI

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

 

6.6.1 Binance Crypto Future Price Data

Introduction

The Binance Crypto Future Price Data by CoinAPI is for Crypto-currency futures price and volume data points. The data covers 236 Cryptocurrency pairs, starts in August 2020, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Binance.

The Binance Crypto Future Margin Rate Data dataset provides margin interest data to model margin costs.

For more information about the Binance Crypto Future Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippet demonstrates how to request data from the Binance Crypto Future Price dataset:

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
    self.SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin)

    self.crypto_future_symbol = self.AddCryptoFuture("BTCBUSD", Resolution.Minute).Symbol
private Symbol _cryptoFutureSymbol;

public override void Initialize
{
    SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin);
    SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin);

    // perpetual futures does not have a filter function
    _cryptoFutureSymbol = AddCryptoFuture("BTCBUSD", Resolution.Minute).Symbol;
}

Data Summary

The following table describes the dataset properties:

Property Value
Start Date August 2020
Asset Coverage 236 Crypto Futures Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following table shows the available Crypto Future pairs:

Data Point Attributes

The Binance Crypto Future Price dataset provides TradeBar , QuoteBar , and Tick objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Requesting Data

To add Binance Crypto Future Price data to your algorithm, call the AddCryptoFuture method. Save a reference to the Crypto Future Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)

        # Set Account Currency to Binance Stable Coin for USD
        self.SetAccountCurrency("BUSD")
        self.SetCash(100000)

        self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
        self.SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin)
        
        crypto_future = self.AddCryptoFuture("BTCBUSD", Resolution.Minute)
        # perpetual futures does not have a filter function
        self.symbol = crypto_future.Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol ;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);

            // Set Account Currency to Binance Stable Coin for USD
            SetAccountCurrency("BUSD");
            SetCash(100000);

            SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin);
            SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin);
            
            var cryptoFuture = AddCryptoFuture("BTCBUSD", Resolution.Minute);
            // perpetual futures does not have a filter function
            _symbol = cryptoFuture.Symbol;
        }
    }
}

For more information about creating Crypto Future subscriptions, see Requesting Data .

Accessing Data

To get the current Binance Crypto Future Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Future Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto Future data, see Handling Data .

Historical Data

To get historical Binance Crypto Future Price data, call the History method with the Crypto Future Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Remove Subscriptions

To unsubscribe from a Crypto Future contract that you added with the AddCryptoFuture method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your Crypto Future holdings.

Example Applications

The Binance Crypto Future Price dataset enables you to accurately design strategies for Cryptocurrencies with term structure. Examples include the following strategies:

Python:

C#:

 

6.6.2 Binance Crypto Price Data

Introduction

The Binance Crypto Price Data by CoinAPI is for Cryptocurrency price and volume data points. The data covers 1,651 Cryptocurrency pairs, starts in July 2017, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Binance.

For more information about the Binance Crypto Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippet demonstrates how to request data from the Binance Crypto Price dataset:

from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *

# Binance accepts both Cash and Margin account types only.
self.SetBrokerageModel(BrokerageName.Binance, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)

self.symbol = self.AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance).Symbol

self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Binance, self.UniverseSettings, self.UniverseSelectionFilter))
using QuantConnect.DataSource;
using QuantConnect.Data.UniverseSelection;

// Binance accepts both Cash and Margin account types only.
SetBrokerageModel(BrokerageName.Binance, AccountType.Cash);
SetBrokerageModel(BrokerageName.Binance, AccountType.Margin);

_symbol = AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance).Symbol;

AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Binance, UniverseSettings, UniverseSelectionFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date July 2017
Asset Coverage 1,651 Currency Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following table shows the available Cryptocurrency pairs:

Data Point Attributes

The Binance Crypto Price dataset provides TradeBar , QuoteBar , Tick , and CryptoCoarseFundamental objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

CryptoCoarseFundamental Attributes

CryptoCoarseFundamental objects have the following attributes:

Requesting Data

To add Binance Crypto Price data to your algorithm, call the AddCrypto method. Save a reference to the Crypto Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)

        # Set Account Currency to Binance Stable Coin for USD
        self.SetAccountCurrency("BUSD")
        self.SetCash(100000)

        # Binance accepts both Cash and Margin account types.
        self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
        
        self.symbol = self.AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance).Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);

            // Set Account Currency to Binance Stable Coin for USD
            SetAccountCurrency("BUSD");
            SetCash(100000);

            // Binance accepts both Cash and Margin account types.
            SetBrokerageModel(BrokerageName.Binance, AccountType.Margin);
            
            _symbol = AddCrypto("BTCBUSD", Resolution.Minute, Market.Binance).Symbol;
        }
    }
}

For more information about creating Crypto subscriptions, see Requesting Data .

Accessing Data

To get the current Binance Crypto Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto data, see Handling Data .

Historical Data

To get historical Binance Crypto Price data, call the History method with the Crypto Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Binance Crypto pairs, call the AddUniverse method with a CryptoCoarseFundamentalUniverse object. A Crypto coarse universe uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

from QuantConnect.Data.UniverseSelection import *

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Binance, self.UniverseSettings, self.UniverseSelectionFilter))

def UniverseSelectionFilter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    return [c.Symbol for c in crypto_coarse if c.Volume >= 100 and c.VolumeInUsd > 10000]
using QuantConnect.Data.UniverseSelection;

public override void Initialize()
{
    SetBrokerageModel(BrokerageName.Binance, AccountType.Margin);
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Binance, UniverseSettings, UniverseSelectionFilter));
}

private IEnumerable<Symbol> UniverseSelectionFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return from c in cryptoCoarse
           where c.Volume >= 100m && c.VolumeInUsd > 10000m
           select c.Symbol;
}

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Binance Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

 

6.6.3 Binance US Crypto Price Data

Introduction

The Binance US Crypto Price Data by CoinAPI is for Cryptocurrency price and volume data points. The data covers 174 Cryptocurrency pairs, starts in October 2019, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Binance US.

For more information about the Binance US Crypto Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippets demonstrates how to set the brokerage model, request data, and perform universe selection with the Binance US dataset:

from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *

# Binance US only accepts cash accounts
self.SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash)

self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.BinanceUS).Symbol

self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.BinanceUS, self.UniverseSettings, self.UniverseSelectionFilter))
using QuantConnect.DataSource;
using QuantConnect.Data.UniverseSelection;

// Binance US only accepts cash accounts
SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash);

_symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.BinanceUS).Symbol;

AddUniverse(new CryptoCoarseFundamentalUniverse(Market.BinanceUS, UniverseSettings, UniverseSelectionFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date October 2019
Asset Coverage 174 Cryptocurrency Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following tables shows the available Cryptocurrency pairs:

Data Point Attributes

The Binance US Crypto Price dataset provides TradeBar , QuoteBar , Tick , and CryptoCoarseFundamental objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

CryptoCoarseFundamental Attributes

CryptoCoarseFundamental objects have the following attributes:

Requesting Data

To add Binance US Crypto Price data to your algorithm, call the AddCrypto method. Save a reference to the Crypto Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        # BinanceUS accepts Cash account type only, AccountType.Margin will result in an exception.
        self.SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash)
        
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.BinanceUS).Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
        
            // BinanceUS accepts Cash account type only, AccountType.Margin will result in an exception.
            SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash);
            
            _symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.BinanceUS).Symbol;
        }
    }
}

For more information about creating Crypto subscriptions, see Requesting Data .

Accessing Data

To get the current Binance US Crypto Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto data, see Handling Data .

Historical Data

To get historical Binance US Crypto Price data, call the History method with the Crypto Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Binance US Crypto pairs, call the AddUniverse method with a CryptoCoarseFundamentalUniverse object. A Crypto coarse universe uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

from QuantConnect.Data.UniverseSelection import *

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash)
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.BinanceUS, self.UniverseSettings, self.UniverseSelectionFilter))

def UniverseSelectionFilter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    return [c.Symbol for c in crypto_coarse if c.Volume >= 100 and c.VolumeInUsd > 10000]
using QuantConnect.Data.UniverseSelection;

public override void Initialize()
{
    SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash);
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.BinanceUS, UniverseSettings, UniverseSelectionFilter));
}

private IEnumerable<Symol> UniverseSelectionFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return from c in cryptoCoarse
           where c.Volume >= 100m && c.VolumeInUsd > 10000m
           select c.Symbol;
}

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Binance US Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

 

6.6.4 Bitfinex Crypto Price Data

Introduction

The Bitfinex Crypto Price Data by CoinAPI is for Cryptocurrency price and volume data points. The data covers 309 Cryptocurrency pairs, starts in January 2013, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Bitfinex.

For more information about the Bitfinex Crypto Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippet demonstrates how to request data from the Bitfinex Crypto Price dataset:

from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *

# Bitfinex accepts both Cash and Margin type account.
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)

self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.Bitfinex).Symbol

self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Bitfinex, self.UniverseSettings, self.UniverseSelectionFilter))
using QuantConnect.DataSource;
using QuantConnect.Data.UniverseSelection;

// Bitfinex accepts both Cash and Margin type account.
SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash);
SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);

_symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.Bitfinex).Symbol;

AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Bitfinex, UniverseSettings, UniverseSelectionFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2013
Asset Coverage 309 Currency Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following table shows the available Cryptocurrency pairs:

Data Point Attributes

The Bitfinex Crypto Price dataset provides TradeBar , QuoteBar , Tick , and CryptoCoarseFundamental objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

CryptoCoarseFundamental Attributes

CryptoCoarseFundamental objects have the following attributes:

Requesting Data

To add Bitfinex Crypto Price data to your algorithm, call the AddCrypto method. Save a reference to the Crypto Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        # Bitfinex accepts both Cash and Margin type account.
        self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)
        
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.Bitfinex).Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);

            // Bitfinex accepts both Cash and Margin type account.
            SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);
            
            _symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.Bitfinex).Symbol;
        }
    }
}

For more information about creating Crypto subscriptions, see Requesting Data .

Accessing Data

To get the current Bitfinex Crypto Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto data, see Handling Data .

Historical Data

To get historical Bitfinex Crypto Price data, call the History method with the Crypto Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Bitfinex Crypto pairs, call the AddUniverse method with a CryptoCoarseFundamentalUniverse object. A Crypto coarse universe uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

from QuantConnect.Data.UniverseSelection import *

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Kraken, self.UniverseSettings, self.UniverseSelectionFilter))

def UniverseSelectionFilter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    return [c.Symbol for c in crypto_coarse if c.Volume >= 100 and c.VolumeInUsd > 10000]
using QuantConnect.Data.UniverseSelection;

public override void Initialize()
{
    SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Kraken, UniverseSettings, UniverseSelectionFilter));
}

private IEnumerable<Symbol> UniverseSelectionFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return from c in cryptoCoarse
           where c.Volume >= 100m && c.VolumeInUsd > 10000m
           select c.Symbol;
}

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Bitfinex Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

 

6.6.5 Coinbase Crypto Price Data

Introduction

The Coinbase Crypto Price Data by CoinAPI provides Cryptocurrency price and volume data points. The data covers 101 Cryptocurrency pairs, starts in January 2015, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on Coinbase.

For more information about the Coinbase Crypto Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippet demonstrates how to request data from the Coinbase Crypto Price dataset:

from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *

# Coinbase only accepts Cash account type
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.GDAX).Symbol

self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.GDAX, self.UniverseSettings, self.UniverseSelectionFilter))
using QuantConnect.DataSource;
using QuantConnect.Data.UniverseSelection;

// Coinbase only accepts Cash account type
SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);

_symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.GDAX).Symbol;

AddUniverse(new CryptoCoarseFundamentalUniverse(Market.GDAX, UniverseSettings, UniverseSelectionFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2015
Asset Coverage 101 Currency Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following table shows the available Cryptocurrency pairs:

Data Point Attributes

The Coinbase Crypto Price dataset provides TradeBar , QuoteBar , Tick , and CryptoCoarseFundamental objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

CryptoCoarseFundamental Attributes

CryptoCoarseFundamental objects have the following attributes:

Requesting Data

To add Coinbase Crypto Price data to your algorithm, call the AddCrypto method. Save a reference to the Crypto Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        # Coinbase accepts Cash account type only, AccountType.Margin will result in an exception.
        self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
        
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.GDAX).Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
        
            // Coinbase accepts Cash account type only, AccountType.Margin will result in an exception.
            SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
            
            _symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.GDAX).Symbol;
        }
    }
}

For more information about creating Crypto subscriptions, see Requesting Data .

Accessing Data

To get the current Coinbase Crypto Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto data, see Handling Data .

Historical Data

To get historical Coinbase Crypto Price data, call the History method with the Crypto Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Coinbase Crypto pairs, call the AddUniverse method with a CryptoCoarseFundamentalUniverse object. A Crypto coarse universe uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

from QuantConnect.Data.UniverseSelection import *

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.GDAX, self.UniverseSettings, self.UniverseSelectionFilter))

def UniverseSelectionFilter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    return [c.Symbol for c in crypto_coarse if c.Volume >= 100 and c.VolumeInUsd > 10000]
using QuantConnect.Data.UniverseSelection;

public override void Initialize()
{
    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.GDAX, UniverseSettings, UniverseSelectionFilter));
}

private IEnumerable<Symbol> UniverseSelectionFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return from c in cryptoCoarse
           where c.Volume >= 100m && c.VolumeInUsd > 10000m
           select c.Symbol;
}

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Coinbase Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

 

6.6.6 Kraken Crypto Price Data

Introduction

The Kraken Crypto Price Data by CoinAPI provides Cryptocurrency price and volume data points. The data covers 384 Cryptocurrency pairs, starts in October 2013, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on the Cryptocurrency markets/exchanges supported by QuantConnect.

For more information about the Kraken Crypto Price Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinAPI was founded by Artur Pietrzyk in 2016 with the goal of providing real-time and historical cryptocurrency market data, collected from hundreds of exchanges. CoinAPI provides access to Cryptocurrencies for traders, market makers, and developers building third-party applications.

Getting Started

The following snippet demonstrates how to request data from the Kraken Crypto Price dataset:

from QuantConnect.DataSource import *
from QuantConnect.Data.UniverseSelection import *

# Kraken accepts both Cash and Margin type account.
self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Cash)
self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin)

self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.Kraken).Symbol

self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Kraken, self.UniverseSettings, self.UniverseSelectionFilter))
using QuantConnect.DataSource;
using QuantConnect.Data.UniverseSelection;

// Kraken accepts both Cash and Margin type account.
SetBrokerageModel(BrokerageName.Kraken, AccountType.Cash);
SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin);

_symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.Kraken).Symbol;

AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Kraken, UniverseSettings, UniverseSelectionFilter));

Data Summary

The following table describes the dataset properties:

Property Value
Start Date October 2013
Asset Coverage 384 Currency Pairs
Data Density Dense
Resolution Tick, Second, Minute, Hourly, & Daily
Timezone UTC

Supported Assets

The following table shows the available Cryptocurrency pairs:

Data Point Attributes

The Kraken Crypto Price dataset provides TradeBar , QuoteBar , Tick , and CryptoCoarseFundamental objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

CryptoCoarseFundamental Attributes

CryptoCoarseFundamental objects have the following attributes:

Requesting Data

To add Kraken Crypto Price data to your algorithm, call the AddCrypto method. Save a reference to the Crypto Symbol so you can access the data later in your algorithm.

class CoinAPIDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2020, 6, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        # Kraken accepts both Cash and Margin type account.
        self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin)
        
        self.symbol = self.AddCrypto("BTCUSD", Resolution.Minute, Market.Kraken).Symbol
namespace QuantConnect
{
    public class CoinAPIDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        
        public override void Initialize()
        {
            SetStartDate(2020, 6, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);

            // Kraken accepts both Cash and Margin type account.
            SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin);
            
            _symbol = AddCrypto("BTCUSD", Resolution.Minute, Market.Kraken).Symbol;
        }
    }
}

For more information about creating Crypto subscriptions, see Requesting Data .

Accessing Data

To get the current Kraken Crypto Price data, index the Bars , QuoteBars , or Ticks properties of the current Slice with the Crypto Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.Bars:
        trade_bar = slice.Bars[self.symbol]
        self.Log(f"{self.symbol} close at {slice.Time}: {trade_bar.Close}")

    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, trade_bar in slice.Bars.items():
        self.Log(f"{symbol} close at {slice.Time}: {trade_bar.Close}")

    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Crypto data, see Handling Data .

Historical Data

To get historical Kraken Crypto Price data, call the History method with the Crypto Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Daily)

# TradeBar objects
history_trade_bars = self.History[TradeBar](self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Kraken Crypto pairs, call the AddUniverse method with a CryptoCoarseFundamentalUniverse object. A Crypto coarse universe uses a selection function to select Crypto pairs based on their OHLCV and dollar volume of the previous day as of midnight Coordinated Universal Time (UTC).

from QuantConnect.Data.UniverseSelection import *

def Initialize(self) -> None:
    self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin)
    self.AddUniverse(CryptoCoarseFundamentalUniverse(Market.Kraken, self.UniverseSettings, self.UniverseSelectionFilter))

def UniverseSelectionFilter(self, crypto_coarse: List[CryptoCoarseFundamental]) -> List[Symbol]:
    return [c.Symbol for c in crypto_coarse if c.Volume >= 100 and c.VolumeInUsd > 10000]
using QuantConnect.Data.UniverseSelection;

public override void Initialize()
{
    SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin);
    AddUniverse(new CryptoCoarseFundamentalUniverse(Market.Kraken, UniverseSettings, UniverseSelectionFilter));
}

private IEnumerable<Symbol> UniverseSelectionFilter(IEnumerable<CryptoCoarseFundamental> cryptoCoarse)
{
    return from c in cryptoCoarse
           where c.Volume >= 100m && c.VolumeInUsd > 10000m
           select c.Symbol;
}

Remove Subscriptions

To unsubscribe from a Crypto pair that you added with the AddCrypto method, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings in the virtual pair .

Example Applications

The Kraken Crypto Price dataset enables you to accurately design strategies for Cryptocurrencies. Examples include the following strategies:

 

6.7 OANDA

OANDA was co-founded by Dr. Stumm, a computer scientist and Dr. Olsen, an economist, in 1997. The company was born out of the belief that the Internet and technology would open up the markets for both currency data and trading. OANDA uses innovative computer and financial technology to provide Internet-based forex trading and currency information services to everyone, from individuals to large corporations, from portfolio managers to financial institutions. OANDA is a market maker and a trusted source for currency data. It has access to one of the world"s largest historical, high-frequency, filtered currency databases.

 

6.7.1 CFD Data

Introduction

The CFD Data by OANDA serves 269 contracts for differences (CFD). The data starts as early as May 2002 and is delivered on any frequency from tick to daily. This dataset is created by QuantConnect processing raw tick data from OANDA.

For more information about the CFD Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

OANDA was co-founded by Dr. Stumm, a computer scientist and Dr. Olsen, an economist, in 1997. The company was born out of the belief that the Internet and technology would open up the markets for both currency data and trading. OANDA uses innovative computer and financial technology to provide Internet-based forex trading and currency information services to everyone, from individuals to large corporations, from portfolio managers to financial institutions. OANDA is a market maker and a trusted source for currency data. It has access to one of the world's largest historical, high-frequency, filtered currency databases.

Getting Started

The following snippet demonstrates how to request data from the CFD dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddCfd("XAUUSD", Resolution.Daily).Symbol
using QuantConnect.DataSource;

_symbol = AddCfd("XAUUSD", Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date Mixed, earliest starts May 2002
Asset Coverage 269 Contracts
Data Density Dense
Resolution Tick, Second, Minute, Hour, & Daily
Timezone Mixed, in which the contract is listed*

* E.g.: DE30EUR tracks DAX30 Index, which is listed in Europe/Berlin timezone.

Supported Assets

The following table shows the available contracts:

Data Point Attributes

The CFD dataset provides QuoteBar and Tick objects.

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Requesting Data

To add CFD data to your algorithm, call the AddCfd method. Save a reference to the CFD Symbol so you can access the data later in your algorithm.

class CfdAlgorithm (QCAlgorithm):
    def Initialize(self) -> None:
        self.SetAccountCurrency('EUR');

        self.SetStartDate(2019, 2, 20)
        self.SetEndDate(2019, 2, 21)
        self.SetCash('EUR', 100000)

        self.symbol = self.AddCfd('DE30EUR').Symbol

        self.SetBenchmark(self.symbol)
namespace QuantConnect.Algorithm.CSharp
{
    public class CfdAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;

        public override void Initialize()
        {
            SetAccountCurrency("EUR");

            SetStartDate(2019, 2, 20);
            SetEndDate(2019, 2, 21);
            SetCash("EUR", 100000);

            _symbol = AddCfd("DE30EUR").Symbol;

            SetBenchmark(_symbol);
        }
    }
}

For more information about creating CFD subscriptions, see Requesting Data .

Accessing Data

To get the current CFD data, index the QuoteBars or Ticks properties of the current Slice with the CFD Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing CFD data, see Handling Data .

Historical Data

To get historical CFD data, call the History method with the CFD Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a CFD subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings.

Example Applications

The CFD price data enables you to trade CFD assets in your algorithm. Examples include the following strategies:

 

6.7.2 FOREX Data

Introduction

The FOREX Data by OANDA serves 185 foreign exchange (FOREX) pairs, starts on various dates from January 2007, and is delivered on any frequency from tick to daily. This dataset is created by QuantConnect processing raw tick data from OANDA.

For more information about the FOREX Data dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

OANDA was co-founded by Dr. Stumm, a computer scientist and Dr. Olsen, an economist, in 1997. The company was born out of the belief that the Internet and technology would open up the markets for both currency data and trading. OANDA uses innovative computer and financial technology to provide Internet-based forex trading and currency information services to everyone, from individuals to large corporations, from portfolio managers to financial institutions. OANDA is a market maker and a trusted source for currency data. It has access to one of the world's largest historical, high-frequency, filtered currency databases.

Getting Started

The following snippet demonstrates how to request data from the FOREX dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddForex("EURUSD", Resolution.Daily, Market.Oanda).Symbol
using QuantConnect.DataSource;

_symbol = AddForex("EURUSD", Resolution.Daily, Market.Oanda).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2007
Asset Coverage 71 Currency pairs
Data Density Dense
Resolution Tick, Second, Minute, Hour, & Daily
Timezone UTC

Supported Assets

The following table shows the available Forex pairs:

Data Point Attributes

The FOREX dataset provides QuoteBar and Tick objects.

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Requesting Data

To add FOREX data to your algorithm, call the AddForex method. Save a reference to the Forex Symbol so you can access the data later in your algorithm.

class ForexAlgorithm (QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 2, 20)
        self.SetEndDate(2019, 2, 21)
        self.SetCash(100000)

        self.symbol = self.AddForex('EURUSD', Resolution.Minute, Market.Oanda).Symbol

        self.SetBenchmark(self.symbol)
namespace QuantConnect.Algorithm.CSharp
{
    public class ForexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;

        public override void Initialize()
        {
            SetStartDate(2019, 2, 20);
            SetEndDate(2019, 2, 21);
            SetCash(100000);

            _symbol = AddForex("EURUSD", Resolution.Minute, Market.Oanda).Symbol;

            SetBenchmark(_symbol);
        }
    }
}

For more information about creating Forex subscriptions, see Requesting Data .

Accessing Data

To get the current Forex data, index the QuoteBars or Ticks properties of the current Slice with the Forex Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice .

def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing Forex data, see Handling Data .

Historical Data

To get historical Forex data, call the History method with the Forex Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a Forex pair subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.symbol)
RemoveSecurity(_symbol);

The RemoveSecurity method cancels your open orders for the security and liquidates your holdings.

Example Applications

The FOREX price data enables you to trade currency pairs in the global mark. Examples include the following strategies:

 

6.8 Benzinga

Benzinga was founded by Jason Raznick in 2010 with goal of connecting the world with news, data, and education that makes the path to financial prosperity easier for everyone, everyday. Benzinga provides access to real-time news for individual investors.

 

6.8.1 Benzinga News Feed

Introduction

The Benzinga News Feed dataset by Benzinga tracks US Equity news releases. The data covers about 1,250 articles per day across 8,000 Equities, starts in January 2016, and is delivered on a second frequency. This dataset is created by structuring the content produced by Benzinga's editorial team.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Benzinga News Feed dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Benzinga was founded by Jason Raznick in 2010 with goal of connecting the world with news, data, and education that makes the path to financial prosperity easier for everyone, everyday. Benzinga provides access to real-time news for individual investors.

Getting Started

The following snippet demonstrates how to request data from the Benzinga News Feed dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(BenzingaNews, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<BenzingaNews>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date September 2017
Asset Coverage 1,250 Articles/Day, 8,000 Equities
Data Density Sparse
Resolution Second
Timezone New York

Data Point Attributes

The Benzinga News Feed dataset provides BenzingaNews objects, which have the following attributes:

Requesting Data

To add Benzinga News Feed data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BenzingaNewsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)
        
        self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
        self.dataset_symbol = self.AddData(BenzingaNews, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class BenzingaNewsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
            _datasetSymbol = AddData<BenzingaNews>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Benzinga News Feed data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        article = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} title at {slice.Time}: {article.Title}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var article = slice[_datasetSymbol];
        Log($"{_datasetSymbol} title at {slice.Time}: {article.Mentions}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, article in slice.Get(BenzingaNews).items():
        self.Log(f"{dataset_symbol} title at {slice.Time}: {article.Title}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BenzingaNews>())
    {
        var datasetSymbol = kvp.Key;
        var article = kvp.Value;
        Log($"{datasetSymbol} title at {slice.Time}: {article.Title}");
    }
}

Historical Data

To get historical Benzinga News Feed data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[BenzingaNews](self.dataset_symbol, 100, Resolution.Daily)
var history = History<BenzingaNews>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Benzinga News Feed data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Benzinga News Feed enables you to accurately design strategies harnessing real-time news releases. Examples include the following strategies:

 

6.9 Blockchain

Blockchain is a website that publishes data related to Bitcoin. It has been online since 2011 and publishes the Bitcoin Metadata history back to 2009.

 

6.9.1 Bitcoin Metadata

Introduction

The Bitcoin Metadata dataset by Blockchain provides 23 fundamental metadata of Bitcoin directly fetched from the Bitcoin blockchain. The data starts in January 2009 and delivered on a daily frequency. This dataset contains mining statistics like hash rate and miner revenue; transaction metadata like transaction per block, transaction fee, and number of addresses; and blockchain metadata like blockchain size and block size.

For more information about the Bitcoin Metadata dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Blockchain is a website that publishes data related to Bitcoin. It has been online since 2011 and publishes the Bitcoin Metadata history back to 2009.

Getting Started

The following snippet demonstrates how to request data from the Bitcoin Metadata dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddCrypto("BTCUSD", Resolution.Daily, Market.Bitfinex).Symbol
self.dataset_symbol = self.AddData(BitcoinMetadata, self.symbol).Symbol 
using QuantConnect.DataSource;

_symbol = AddCrypto("BTCUSD", Resolution.Daily, Market.Bitfinex).Symbol;
_datasetSymbol = AddData<BitcoinMetadata>(_symbol).Symbol; 

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2009
Coverage Bitcoin blockchain
Data Density Regular
Resolution Daily
Timezone UTC

Data Point Attributes

The Bitcoin Metadata dataset provides BitcoinMetadata objects, which have the following attributes:

Requesting Data

To add Bitcoin Metadata data to your algorithm, call the AddData method with the BTCUSD Symbol . Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BlockchainBitcoinMetadataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddCrypto("BTCUSD", Resolution.Daily, Market.Bitfinex).Symbol
        self.dataset_symbol = self.AddData(BitcoinMetadata, self.symbol).Symbol 
namespace QuantConnect
{
    public class BlockchainBitcoinMetadataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddCrypto("BTCUSD", Resolution.Daily, Market.Bitfinex).Symbol;
            _datasetSymbol = AddData<BitcoinMetadata>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Bitcoin Metadata data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} miner revenue at {slice.Time}: {data_point.MinersRevenue}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} miner revenue at {slice.Time}: {dataPoint.MinersRevenue}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(BlockchainBitcoinData).items():
        self.Log(f"{dataset_symbol} miner revenue at {slice.Time}: {data_point.MinersRevenue}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BlockchainBitcoinData>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} miner revenue at {slice.Time}: {dataPoint.MinersRevenue}");
    }
}

Historical Data

To get historical Bitcoin Metadata data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[BlockchainBitcoinData](self.dataset_symbol, 100, Resolution.Daily)
var history = History<BlockchainBitcoinData>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The Bitcoin Metadata dataset enables you to incorporate metadata from the Bitcoin blockchain into your strategies. Examples include the following strategies:

 

6.10 Brain

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

 

6.10.1 Brain Language Metrics on Company Filings

Introduction

The Brain Language Metrics on Company Filings dataset provides the results of an NLP system that monitors several language metrics on 10-K and 10-Q company reports for US Equities. The data covers 5,000 US Equities, starts in January 2010, and is delivered on a daily frequency. The dataset is made of two parts; the first one includes the language metrics of the most recent 10-K or 10-Q report for each firm, namely:

  1. Financial sentiment
  2. Percentage of words belonging to financial domain classified by language types (e.g. “litigious” or “constraining” language)
  3. Readability score
  4. Lexical metrics such as lexical density and richness
  5. Text statistics such as the report length and the average sentence length

The second part includes the differences between the two most recent 10-Ks or 10-Qs reports of the same period for each company, namely:

  1. Difference of the various language metrics (e.g. delta sentiment, delta readability score, delta percentage of a specific language type etc.)
  2. Similarity metrics between documents, also with respect to a specific language type (for example similarity with respect to “litigious” language or “uncertainty” language)

The analysis is available for the whole report and for specific sections of the report (e.g. Risk Factors and MD&A).

For more information, refer to Brain's summary paper .

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Brain Language Metrics on Company Filings dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

Getting Started

The following snippet demonstrates how to request data from the Brain Language Metrics on Company Filings dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_10k_symbol = self.AddData(BrainCompanyFilingLanguageMetrics10K , self.symbol).Symbol
self.dataset_all_symbol = self.AddData(BrainCompanyFilingLanguageMetricsAll, self.symbol).Symbol

self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverse10K, "BrainCompanyFilingLanguageMetricsUniverse10K", Resolution.Daily, self.UniverseSelection)
self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverseAll, "BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, self.UniverseSelection)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_dataset10KSymbol = AddData<BrainCompanyFilingLanguageMetrics10K>(_symbol).Symbol;
_datasetAllSymbol = AddData<BrainCompanyFilingLanguageMetricsAll>(_symbol).Symbol;

AddUniverse<BrainCompanyFilingLanguageMetricsUniverse10K>("BrainCompanyFilingLanguageMetricsUniverse10K", Resolution.Daily, UniverseSelection);
AddUniverse<BrainCompanyFilingLanguageMetricsUniverseAll>("BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, UniverseSelection);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2010
Asset Coverage 5,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Brain Language Metrics on Company Filings dataset provides BrainCompanyFilingLanguageMetrics and BrainCompanyFilingLanguageMetricsUniverse objects.

BrainCompanyFilingLanguageMetrics Attributes

BrainCompanyFilingLanguageMetrics objects have the following attributes:

BrainCompanyFilingLanguageMetricsUniverse Attributes

BrainCompanyFilingLanguageMetricsUniverse objects have the following attributes:

Requesting Data

To add Brain Language Metrics on Company Filings data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BrainCompanyFilingNLPDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2010, 1, 1)
        self.SetEndDate(2021, 7, 8)
        self.SetCash(100000) 
        
        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_10k_symbol = self.AddData(BrainCompanyFilingLanguageMetrics10K, self.symbol).Symbol
        self.dataset_all_symbol = self.AddData(BrainCompanyFilingLanguageMetricsAll, self.symbol).Symbol
namespace QuantConnect
{
    public class BrainCompanyFilingNLPDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _dataset10KSymbol, _datasetAllSymbol;
    	
        public override void Initialize()
        {
            SetStartDate(2010, 1, 1);
            SetEndDate(2021, 7, 8);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _dataset10KSymbol= AddData<BrainCompanyFilingLanguageMetrics10K>(_symbol).Symbol;
            _datasetAllSymbol= AddData<BrainCompanyFilingLanguageMetricsAll>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Brain Language Metrics on Company Filings data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_10k_symbol):
        data_point = slice[self.dataset_10k_symbol]
        self.Log(f"{self.dataset_10k_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")

    if slice.ContainsKey(self.dataset_all_symbol):
        data_point = slice[self.dataset_all_symbol]
        self.Log(f"{self.dataset_all_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_dataset10KSymbol))
    {
        var dataPoint = slice[_dataset10KSymbol];
        Log($"{_dataset10KSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }

    if (slice.ContainsKey(_datasetAllSymbol))
    {
        var dataPoint = slice[_datasetAllSymbol];
        Log($"{_datasetAllSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(BrainCompanyFilingLanguageMetrics10K).items():
        self.Log(f"{dataset_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")

    for dataset_symbol, data_point in slice.Get(BrainCompanyFilingLanguageMetricsAll).items():
        self.Log(f"{dataset_symbol} report sentiment at {slice.Time}: {data_point.ReportSentiment.Sentiment}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BrainCompanyFilingLanguageMetrics10K>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }

    foreach (var kvp in slice.Get<BrainCompanyFilingLanguageMetricsAll>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report sentiment at {slice.Time}: {dataPoint.ReportSentiment.Sentiment}");
    }
}

Historical Data

To get historical Brain Language Metrics on Company Filings data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
ten_k_history_df = self.History(self.dataset_10k_symbol, 100, Resolution.Daily)
all_history_df = self.History(self.dataset_all_symbol, 100, Resolution.Daily)
history_df = self.History([self.dataset_10k_symbol, self.dataset_all_symbol], 100, Resolution.Daily)

# Dataset objects
ten_k_history_bars = self.History[BrainCompanyFilingLanguageMetrics10K](self.dataset_10k_symbol, 100, Resolution.Daily)
all_history_bars = self.History[BrainCompanyFilingLanguageMetricsAll](self.dataset_all_symbol, 100, Resolution.Daily)
// Dataset objects
var tenKHistory = History<BrainCompanyFilingLanguageMetrics10K>(_dataset10KSymbol, 100, Resolution.Daily);
var allHistory = History<BrainCompanyFilingLanguageMetricsAll>(_datasetAllSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_dataset10KSymbol, _datasetAllSymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Brain Language Metrics on Company Filings data, call the AddUniverse method with the BrainCompanyFilingLanguageMetricsUniverseAll class or the BrainCompanyFilingLanguageMetricsUniverse10K class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(BrainCompanyFilingLanguageMetricsUniverseAll, "BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[BrainCompanyFilingLanguageMetricsUniverseAll]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.ReportSentiment.Sentiment > 0 \
                and d.ManagementDiscussionAnalyasisOfFinancialConditionAndResultsOfOperations.Sentiment > 0]
AddUniverse<BrainCompanyFilingLanguageMetricsUniverseAll>("BrainCompanyFilingLanguageMetricsUniverseAll", Resolution.Daily, altCoarse =>
{
    return from d in altCoarse 
        where d.ReportSentiment.Sentiment > 0m && d.ManagementDiscussionAnalyasisOfFinancialConditionAndResultsOfOperations.Sentiment > 0m
        select d.Symbol;
});

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_10k_symbol)
self.RemoveSecurity(self.dataset_all_symbol)
RemoveSecurity(_dataset10KSymbol);
RemoveSecurity(_datasetAllSymbol);

If you subscribe to Brain Language Metrics on Company Filings data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Brain Language Metrics on Company Filings dataset enables you to test strategies using language metrics and their differences gathered from 10K and 10Q reports. Examples include the following strategies:

Disclaimer: The dataset is provided by the data provider for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor do they constitute an offer to provide investment advisory or other services by the data provider.

 

6.10.2 Brain ML Stock Ranking

Introduction

The Brain ML Stock Ranking dataset by Brain generates a daily ranking for US Equities based on their predicted ranking of future returns relative to the universe median across four-time horizons: next 2, 3, 5, 10, and 21 days (one trading month). The data covers 1,000 US Equities (universe updated yearly by including the largest 1,000 US companies of the previous year), starts in January 2010, and is delivered on a daily frequency. This dataset is created by a voting scheme of machine learning classifiers that non-linearly combine a variety of features with a series of techniques aimed at mitigating the well-known overfitting problem for financial data with a low signal-to-noise ratio. Examples of features are time-varying stock-specific features like price and volume-related metrics or fundamentals; time-fixed stock-specific features like the sector and other database information; market regime features such as volatility and other financial stress indicators; calendar features representing possible anomalies, for example, the month of the year.

More precisely the ML Stock Ranking score is related to the confidence of a Machine Learning classifier in predicting top or bottom quintile returns for the next N trading days (e.g. next 21 trading days) for a stock with the respect to the median of the universe and ranges from -1 to +1.

A negative score means that the system is more confident that the stock belongs to the lower returns quintile, a positive score means that the system is more confident that the stock belongs to the higher returns quintile. It is important to note that the score has a meaning only if used to compare different stocks to perform a ranking.

Typical use is to download the score for a large stock universe for a given day, e.g. 500 stocks or the full universe of 1000 stocks, order the stocks by mlAlpha score and go long the top K stocks, or build a long-short strategy going long the top K and short the bottom K stocks.

For more information, refer to Brain's summary paper .

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Brain ML Stock Ranking dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

Getting Started

The following snippet demonstrates how to request data from the Brain ML Stock Ranking dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(BrainStockRanking2Day, self.symbol).Symbol

self.AddUniverse(BrainStockRankingUniverse, "BrainStockRankingUniverse", Resolution.Daily, self.UniverseSelectionMethod)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<BrainStockRanking2Day>(_symbol).Symbol;

AddUniverse<BrainStockRankingUniverse>("BrainStockRankingUniverse", Resolution.Daily, UniverseSelectionMethod);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2010
Asset Coverage 1,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Brain ML Stock Ranking dataset provides BrainStockRankingBase and BrainStockRankingUniverse objects.

BrainStockRankingBase Attributes

BrainStockRankingBase objects have the following attributes:

BrainStockRankingUniverse Attributes

BrainStockRankingUniverse objects have the following attributes:

Requesting Data

To add Brain ML Stock Ranking data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BrainMLRankingDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 7, 8)
        self.SetCash(100000) 
        
        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.two_day_symbol = self.AddData(BrainStockRanking2Day, self.symbol).Symbol
        self.three_day_symbol = self.AddData(BrainStockRanking3Day, self.symbol).Symbol
        self.five_day_symbol = self.AddData(BrainStockRanking5Day, self.symbol).Symbol
        self.ten_day_symbol = self.AddData(BrainStockRanking10Day, self.symbol).Symbol
        self.month_symbol = self.AddData(BrainStockRanking21Day, self.symbol).Symbol
namespace QuantConnect
{
    public class BrainMLRankingDataAlgorithm : QCAlgorithm
    {
    	private Symbol _symbol, _2DaySymbol, _3DaySymbol, _5DaySymbol, _10DaySymbol, _monthSymbol;
    	
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 7, 8);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _2DaySymbol = AddData<BrainStockRanking2Day>(_symbol).Symbol;
            _3DaySymbol = AddData<BrainStockRanking3Day>(_symbol).Symbol;
            _5DaySymbol = AddData<BrainStockRanking5Day>(_symbol).Symbol;
            _10DaySymbol = AddData<BrainStockRanking10Day>(_symbol).Symbol;
            _monthSymbol = AddData<BrainStockRanking21Day>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Brain ML Stock Ranking data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.two_day_symbol):
        data_point = slice[self.two_day_symbol]
        self.Log(f"{self.two_day_symbol} rank at {slice.Time}: {data_point.Rank}")

    if slice.ContainsKey(self.three_day_symbol):
        data_point = slice[self.three_day_symbol]
        self.Log(f"{self.three_day_symbol} rank at {slice.Time}: {data_point.Rank}")

    if slice.ContainsKey(self.five_day_symbol):
        data_point = slice[self.five_day_symbol]
        self.Log(f"{self.five_day_symbol} rank at {slice.Time}: {data_point.Rank}")

    if slice.ContainsKey(self.ten_day_symbol):
        data_point = slice[self.ten_day_symbol]
        self.Log(f"{self.ten_day_symbol} rank at {slice.Time}: {data_point.Rank}")

    if slice.ContainsKey(self.month_symbol):
        data_point = slice[self.month_symbol]
        self.Log(f"{self.month_symbol} rank at {slice.Time}: {data_point.Rank}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_2DaySymbol))
    {
        var dataPoint = slice[_2DaySymbol];
        Log($"{_2DaySymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    if (slice.ContainsKey(_3DaySymbol))
    {
        var dataPoint = slice[_3DaySymbol];
        Log($"{_3DaySymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    if (slice.ContainsKey(_5DaySymbol))
    {
        var dataPoint = slice[_5DaySymbol];
        Log($"{_5DaySymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    if (slice.ContainsKey(_10DaySymbol))
    {
        var dataPoint = slice[_10DaySymbol];
        Log($"{_10DaySymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    if (slice.ContainsKey(_monthSymbol))
    {
        var dataPoint = slice[_monthSymbol];
        Log($"{_monthSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(BrainStockRanking2Day).items():
        self.Log(f"{dataset_symbol} rank at {slice.Time}: {data_point.Rank}")

    for dataset_symbol, data_point in slice.Get(BrainStockRanking3Day).items():
        self.Log(f"{dataset_symbol} rank at {slice.Time}: {data_point.Rank}")

    for dataset_symbol, data_point in slice.Get(BrainStockRanking5Day).items():
        self.Log(f"{dataset_symbol} rank at {slice.Time}: {data_point.Rank}")

    for dataset_symbol, data_point in slice.Get(BrainStockRanking10Day).items():
        self.Log(f"{dataset_symbol} rank at {slice.Time}: {data_point.Rank}")

    for dataset_symbol, data_point in slice.Get(BrainStockRanking21Day).items():
        self.Log(f"{dataset_symbol} rank at {slice.Time}: {data_point.Rank}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BrainStockRanking2Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    foreach (var kvp in slice.Get<BrainStockRanking3Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    foreach (var kvp in slice.Get<BrainStockRanking5Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    foreach (var kvp in slice.Get<BrainStockRanking10Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }

    foreach (var kvp in slice.Get<BrainStockRanking21Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} rank at {slice.Time}: {dataPoint.Rank}");
    }
}

Historical Data

To get historical Brain ML Stock Ranking data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
two_day_history_df = self.History(self.two_day_symbol, 100, Resolution.Daily)
three_day_history_df = self.History(self.three_day_symbol, 100, Resolution.Daily)
five_day_history_df = self.History(self.five_day_symbol, 100, Resolution.Daily)
ten_day_history_df = self.History(self.ten_day_symbol, 100, Resolution.Daily)
thirty_day_history_df = self.History(self.month_symbol, 100, Resolution.Daily)
history_df = self.History([self.two_day_symbol, 
                           self.three_day_symbol, 
                           self.five_day_symbol, 
                           self.ten_day_symbol,
                           self.month_symbol], 100, Resolution.Daily)

# Dataset objects
two_day_history_bars = self.History[BrainStockRanking2Day](self.two_day_symbol, 100, Resolution.Daily)
three_day_history_bars = self.History[BrainStockRanking3Day](self.three_day_symbol, 100, Resolution.Daily)
five_day_history_bars = self.History[BrainStockRanking5Day](self.five_day_symbol, 100, Resolution.Daily)
ten_day_history_bars = self.History[BrainStockRanking10Day](self.ten_day_symbol, 100, Resolution.Daily)
month_history_bars = self.History[BrainStockRanking21Day](self.month_symbol, 100, Resolution.Daily)
// Dataset objects
var twoDayHistory = History<BrainStockRanking2Day>(_2DaySymbol, 100, Resolution.Daily);
var threeDayHistory = History<BrainStockRanking3Day>(_3DaySymbol, 100, Resolution.Daily);
var fiveDayHistory = History<BrainStockRanking5Day>(_5DaySymbol, 100, Resolution.Daily);
var tenDayHistory = History<BrainStockRanking10Day>(_10DaySymbol, 100, Resolution.Daily);
var monthHistory = History<BrainStockRanking21Day>(_monthSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_2DaySymbol, _3DaySymbol, _5DaySymbol, 
                             _10DaySymbol, _monthSymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Brain ML Stock Ranking data, call the AddUniverse method with the BrainStockRankingUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(BrainStockRankingUniverse, "BrainStockRankingUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[BrainStockRankingUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.Rank2Days > 0 \
                and d.Rank3Days > 0 \
                and d.Rank5Days > 0]
AddUniverse<BrainStockRankingUniverse>("BrainStockRankingUniverse", Resolution.Daily, altCoarse =>
{
    return from d in altCoarse 
        where d.Rank2Days > 0m && d.Rank3Days > 0m  && d.Rank5Days > 0m
        select d.Symbol;
});

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.two_day_symbol)
self.RemoveSecurity(self.three_day_symbol)
self.RemoveSecurity(self.five_day_symbol)
self.RemoveSecurity(self.ten_day_symbol)
self.RemoveSecurity(self.month_symbol)
RemoveSecurity(_2DaySymbol);
RemoveSecurity(_3DaySymbol);
RemoveSecurity(_5DaySymbol);
RemoveSecurity(_10DaySymbol);
RemoveSecurity(_monthSymbol);

If you subscribe to Brain ML Stock Ranking data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Brain ML Stock Ranking dataset enables you to test strategies using the machine learning ranking provided by Brain. Examples include the following strategies:

Disclaimer: The dataset is provided by the data provider for informational purposes only and do not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor do they constitute an offer to provide investment advisory or other services by the data provider.

 

6.10.3 Brain Sentiment Indicator

Introduction

The Brain Sentiment Indicator dataset by Brain tracks the public sentiment around US Equities. The data covers 4,500 US Equities, starts in August 2016, and is delivered on a daily frequency. This dataset is created by analyzing financial news using Natural Language Processing techniques while taking into account the similarity and repetition of news on the same topic. The sentiment score assigned to each stock ranges from -1 (most negative) to +1 (most positive). The sentiment score corresponds to the average sentiment for each piece of news. The score is updated daily and is available on two time scales: 7 days and 30 days. For more information, see Brain's summary paper .

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Brain Sentiment Indicator dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Brain is a Research Company that creates proprietary datasets and algorithms for investment strategies, combining experience in financial markets with strong competencies in Statistics, Machine Learning, and Natural Language Processing. The founders share a common academic background of research in Physics as well as extensive experience in Financial markets.

Getting Started

The following snippet demonstrates how to request data from the Brain Sentiment Indicator dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_7day_symbol = self.AddData(BrainSentimentIndicator7Day, self.symbol).Symbol
self.dataset_30day_symbol = self.AddData(BrainSentimentIndicator30Day, self.symbol).Symbol

self.AddUniverse(BrainSentimentIndicatorUniverse, "BrainSentimentIndicatorUniverse", Resolution.Daily, self.UniverseSelectionMethod)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_dataset7DaySymbol = AddData<BrainSentimentIndicator7Day>(_symbol).Symbol;
_dataset30DaySymbol = AddData<BrainSentimentIndicator30Day>(_symbol).Symbol;

AddUniverse<BrainSentimentIndicatorUniverse>("BrainSentimentIndicatorUniverse", Resolution.Daily, UniverseSelectionMethod);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date August 2016
Asset Coverage 4,500 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Brain Sentiment Indicator dataset provides BrainSentimentIndicatorBase and BrainSentimentIndicatorUniverse objects.

BrainSentimentIndicatorBase Attributes

BrainSentimentIndicatorBase objects have the following attributes:

BrainSentimentIndicatorUniverse Attributes

BrainSentimentIndicatorUniverse objects have the following attributes:

Requesting Data

To add Brain Sentiment Indicator data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class BrainSentimentDataAlgorithm(QCAlgorithm):
    
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2021, 7, 8)
        self.SetCash(100000) 
        
        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_7day_symbol = self.AddData(BrainSentimentIndicator7Day, self.symbol).Symbol
        self.dataset_30day_symbol = self.AddData(BrainSentimentIndicator30Day, self.symbol).Symbol
namespace QuantConnect
{
    public class BrainSentimentDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _dataset7DaySymbol, _dataset30DaySymbol;
    	
        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2021, 7, 8);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _dataset7DaySymbol = AddData<BrainSentimentIndicator7Day>(_symbol).Symbol;
            _dataset30DaySymbol = AddData<BrainSentimentIndicator30Day>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Brain Sentiment Indicator data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_7day_symbol):
        data_point = slice[self.dataset_7day_symbol]
        self.Log(f"{self.dataset_7day_symbol} sentiment at {slice.Time}: {data_point.Sentiment}")

    if slice.ContainsKey(self.dataset_30day_symbol):
        data_point = slice[self.dataset_30day_symbol]
        self.Log(f"{self.dataset_30day_symbol} sentiment at {slice.Time}: {data_point.Sentiment}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_dataset7DaySymbol))
    {
        var dataPoint = slice[_dataset7DaySymbol];
        Log($"{_dataset7DaySymbol} sentiment at {slice.Time}: {dataPoint.Sentiment}");
    }

    if (slice.ContainsKey(_dataset30DaySymbol))
    {
        var dataPoint = slice[_dataset30DaySymbol];
        Log($"{_dataset30DaySymbol} sentiment at {slice.Time}: {dataPoint.Sentiment}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(BrainSentimentIndicator7Day).items():
        self.Log(f"{dataset_symbol} sentiment at {slice.Time}: {data_point.Sentiment}")

    for dataset_symbol, data_point in slice.Get(BrainSentimentIndicator30Day).items():
        self.Log(f"{dataset_symbol} sentiment at {slice.Time}: {data_point.Sentiment}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BrainSentimentIndicator7Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} sentiment at {slice.Time}: {dataPoint.Sentiment}");
    }

    foreach (var kvp in slice.Get<BrainSentimentIndicator30Day>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} sentiment at {slice.Time}: {dataPoint.Sentiment}");
    }
}

Historical Data

To get historical Brain Sentiment Indicator data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
week_history_df = self.History(self.dataset_7day_symbol, 100, Resolution.Daily)
month_history_df = self.History(self.dataset_30day_symbol, 100, Resolution.Daily)
history_df = self.History([self.dataset_7day_symbol, self.dataset_30day_symbol], 100, Resolution.Daily)

# Dataset objects
week_history_bars = self.History[BrainSentimentIndicator7Day](self.dataset_7day_symbol, 100, Resolution.Daily)
month_history_bars = self.History[BrainSentimentIndicator30Day](self.dataset_30day_symbol, 100, Resolution.Daily)
// Dataset objects
var weekHistory = History<BrainSentimentIndicator7Day>(_dataset7DaySymbol, 100, Resolution.Daily);
var monthHistory = History<BrainSentimentIndicator30Day>(_dataset30DaySymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_dataset7DaySymbol, _dataset30DaySymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Brain Sentiment Indicator data, call the AddUniverse method with the BrainSentimentIndicatorUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(BrainSentimentIndicatorUniverse, "BrainSentimentIndicatorUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[BrainSentimentIndicatorUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.TotalArticleMentions7Days > 0 \
                and d.Sentiment7Days]
AddUniverse<BrainSentimentIndicatorUniverse>("BrainSentimentIndicatorUniverse", Resolution.Daily, altCoarse=>
{
    return from d in altCoarse 
           where d.TotalArticleMentions7Days > 0m && d.Sentiment7Days > 0m
           select d.Symbol;
});

The Brain Sentiment Indicator universe runs at 7 AM Eastern Time (ET) in live trading. For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_7day_symbol)
self.RemoveSecurity(self.dataset_30day_symbol)
RemoveSecurity(_dataset7DaySymbol);
RemoveSecurity(_dataset30DaySymbol);

If you subscribe to Brain Sentiment Indicator data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Brain Sentiment Indicator dataset enables you to incorporate sentiment from financial news sources into your strategies. Examples include the following strategies:

Disclaimer: The dataset is provided by the data provider for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor do they constitute an offer to provide investment advisory or other services by the data provider.

 

6.11 CBOE

The Chicago Board Options Exchange ( CBOE ) is the largest U.S. options exchange with annual trading volume that hovered around 1.27 billion contracts at the end of 2014. CBOE offers Options on over 2,200 companies, 22 Equity indices, and 140 exchange-traded funds (ETFs).

 

6.11.1 VIX Daily Price

Introduction

The VIX Daily Price dataset by CBOE covers 14 US volatility indices. The data starts in January 1990 and is delivered on a daily frequency. The dataset is cached daily from the CBOE website. The volatility index measures the stock market's expectation of volatility on the market index (e.g.: S&P500) using implied volatility from its Options for a fixed time horizon.

For more information about the VIX Daily Price dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

The Chicago Board Options Exchange ( CBOE ) is the largest U.S. options exchange with annual trading volume that hovered around 1.27 billion contracts at the end of 2014. CBOE offers Options on over 2,200 companies, 22 Equity indices, and 140 exchange-traded funds (ETFs).

Getting Started

The following snippet demonstrates how to request data from the VIX Daily Price dataset:

using QuantConnect.DataSource;

_datasetSymbol = AddData<CBOE>("VIX", Resolution.Daily).Symbol;
from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(CBOE, "VIX", Resolution.Daily).Symbol

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1990
Asset Coverage 14 US Volatility Indices
Data Density Regular
Resolution Daily
Timezone New York

Supported Indices

The following table shows the volatility indices in the VIX Daily Price dataset:

Ticker Index Expiry Start Date Data Points
VIX S&P500 30 Days Jan 1990 OHLC
VIX9D S&P500 9 Days Apr 2011 OHLC
VIX3M S&P500 3 Months Sep 2009 OHLC
VIX6M S&P500 6 Months Jan 2008 OHLC
VIX1Y S&P500 1 Year Jan 2007 OHLC
VXO S&P100 30 Days Feb 1993 OHLC
VXN Nasdaq 100 30 Days Sep 2009 OHLC
RVX Russell 2000 30 Days Sep 2009 OHLC
VVIX VIX 30 Days Mar 2006 Close
TYVIX 10-year US Treasury Note 30 Days Jan 2003 OHLC
VXTLT 20-year US Treasury Bond 30 Days Jan 2004 Close
VXEEM MSCI Emerging Markets 30 Days Mar 2011 OHLC
OVX United States Oil Fund (USO) 30 Days Sep 2009 Close
GVZ SPDR Gold Shares ETF (GLD) 30 Days Sep 2009 Close

Data Point Attributes

The VIX Daily Price dataset provides CBOE objects, which have the following attributes:

Requesting Data

To add VIX Daily Price data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class CboeDataAlgorithm(QCAlgorithm):
 
    def Initialize(self) -> None:
        self.SetStartDate(2003, 1, 1)
        self.SetEndDate(2019, 10, 11)
        self.SetCash(100000)
 
        self.dataset_symbol = self.AddData(CBOE, "VIX", Resolution.Daily).Symbol
namespace QuantConnect
{
    public class CboeDataAlgorithm : QCAlgorithm
    {
        private Symbol _datasetSymbol;
 
        public override void Initialize()
        {
            SetStartDate(2003, 1, 1);
            SetEndDate(2019, 10, 11);
            SetCash(100000);
 
            _datasetSymbol = AddData<CBOE>("VIX", Resolution.Daily).Symbol;
        }
    }
}

Accessing Data

To get the current VIX Daily Price data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} close at {slice.Time}: {data_point.Close}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} close at {slice.Time}: {dataPoint.Close}");
    }
}

Historical Data

To get historical VIX Daily Price data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[CBOE](self.dataset_symbol, 100, Resolution.Daily)
var history = History<CBOE>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove your subscription to VIX Daily Price data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The VIX Daily Price enables you to incorporate popular US volatility indicies in your strategies. Examples include the following strategies:

 

6.12 CoinGecko

CoinGecko was founded in 2014 by TM Lee (CEO) and Bobby Ong (COO) with the mission to democratize the access of crypto data and empower users with actionable insights. We also deep dive into the crypto space to deliver valuable insights to our users through our cryptocurrency reports, as well as our publications, newsletter, and more.

 

6.12.1 Crypto Market Cap

Introduction

The Crypto Market Cap dataset by CoinGecko tracks the market cap of cryptocurrencies. The data covers 620 cryptocurrencies that are supported by QuantConnect, starts in 28 April 2013, and is delivered on a daily frequency. This dataset is created by scraping CoinGecko's Market Chart.

For more information about the Crypto Market Cap dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CoinGecko was founded in 2014 by TM Lee (CEO) and Bobby Ong (COO) with the mission to democratize the access of crypto data and empower users with actionable insights. We also deep dive into the crypto space to deliver valuable insights to our users through our cryptocurrency reports, as well as our publications, newsletter, and more.

Getting Started

The following snippet demonstrates how to request data from the CoinGecko Crypto Market Cap dataset:

self.symbol = self.AddData(CoinGecko, "BTC").Symbol
_symbol = AddData<CoinGecko>("BTC").Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date 28 April 2013
Asset Coverage 620 cryptocurrencies
Resolution Daily
Timezone UTC

Supported Assets

Data Point Attributes

The Crypto Market Cap dataset provides CoinGecko objects, which have the following attributes:

Requesting Data

To add CoinGecko Crypto Market Cap data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

from Algorithm import *

class CoinGeckoMarketCapDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddCrypto("BTCUSD", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(CoinGecko, "BTC").Symbol
using QuantConnect.DataSource;

namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class CoinGeckoMarketCapDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddCrypto("BTCUSD", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<CoinGecko>("BTC").Symbol;
        }
    }
}

Accessing Data

To get the current Crypto Market Cap data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} market cap::volume at {slice.Time}: {data_point.MarketCap}::{data_point.Volume}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} market cap::volume at {slice.Time}: {dataPoint.MarketCap}::{dataPoint.Volume}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(CoinGecko).items():
        self.Log(f"{dataset_symbol} market cap::volume at {slice.Time}: {data_point.MarketCap}::{data_point.Volume}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<CoinGecko>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} market cap::volume at {slice.Time}: {dataPoint.MarketCap}::{dataPoint.Volume}");
    }
}

Historical Data

To get historical CoinGecko Crypto Market Cap data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[CoinGecko](self.dataset_symbol, 100, Resolution.Daily)
var history = History<CoinGecko>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of Cryptos based on CoinGecko Crypto Market Cap data, call the AddUniverse method with the CoinGeckoUniverse class and a selection function. Note that the filtered output is a list of names of the coins. If corresponding tradable crypto pairs are preferred, call CreateSymbol(market, quoteCurrency) method for each output item.

def Initialize(self) -> None:
    self.AddUniverse(CoinGeckoUniverse, "CoinGeckoUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, data: List[CoinGeckoUniverse]) -> List[Symbol]:
    for datum in data:
        self.Debug(f'{datum.Coin},{datum.MarketCap},{datum.Price}')

    # define our selection criteria
    selected = sorted(data, key=lambda x: x.MarketCap, reverse=True)[:3]
            
    # Use the CreateSymbol method to generate the Symbol object for
    # the desired market (Coinbase) and quote currency (e.g. USD)
    return [x.CreateSymbol(Market.GDAX, "USD") for x in selected]
AddUniverse<CoinGeckoUniverse>("CoinGeckoUniverse", Resolution.Daily, data =>
{
    foreach (var datum in data)
    {
        Debug($"{datum.Coin},{datum.MarketCap},{datum.Price}");
    }

    // define our selection criteria
    // Use the CreateSymbol method to generate the Symbol object for
    // the desired market (Coinbase) and quote currency (e.g. USD)
    return (from d in data
            orderby d.MarketCap descending
            select d.CreateSymbol(Market.GDAX, "USD")).Take(3);
});

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove your subscription to CoinGecko Crypto Market Cap data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The CoinGecko Crypto Market Cap dataset provide information on the size of the crypto coin and can be used to compare the size of one coin to another. Examples include the following strategies:

 

6.13 CryptoSlam!

CryptoSlam! is an NFT industry data aggregator backed by Mark Cuban. Features project analytics, NFT values, rarity, scarcity, most popular collections, activity history & more.

 

6.13.1 NFT Sales

Introduction

The NFT Sales dataset by CryptoSlam! provides Non-Fungible Tokens (NFT) sales volume data in various blockchain marketplaces. This dataset covers 11 blockchains that have their own native Cryptocurrencies. The data starts in June 2017 and is delivered on a daily frequency. This dataset fetches the number of transactions, unique buyers, unique sellers, and the dollar volume of NFT transactions on all secondary marketplaces tracked by CryptoSlam, which includes owner-to-owner sales only (not initial sales from the product directly to the owners).

For more information about the NFT Sales dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

CryptoSlam! is an NFT industry data aggregator backed by Mark Cuban. Features project analytics, NFT values, rarity, scarcity, most popular collections, activity history & more.

Getting Started

The following snippet demonstrates how to request data from the NFT Sales dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddCrypto("ETHUSD", Resolution.Daily, Market.Bitfinex).Symbol
self.dataset_symbol = self.AddData(CryptoSlamNFTSales, "ETH").Symbol
using QuantConnect.DataSource;

_symbol = AddCrypto("ETHUSD", Resolution.Daily, Market.Bitfinex).Symbol;
_datasetSymbol = AddData<CryptoSlamNFTSales>("ETH").Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date June 2017
Asset Coverage 11 blockchains
Data Density Sparse
Resolution Daily
Timezone UTC

Supported Blockchains and Symbols

The following table shows the blockchains tracked in the NFT Sales dataset:

Symbol Blockchain Represented Start Date (yyyy-mm-dd)
AVAX Avalanche 2021-09-01
CRO Cronos 2021-12-18
ETH Ethereum 2017-06-23
FLOW Flow 2020-07-28
FTM Fantom 2021-09-15
MATIC Polygon 2021-03-01
SOL Solana 2021-08-05
THETA Theta 2021-06-24
WAVE Waves 2021-06-03
WAX Wax 2020-03-16
XTZ Tezos 2021-03-01

Data Point Attributes

The NFT Sales dataset provides CryptoSlamNFTSales objects, which have the following attributes:

Requesting Data

To add NFT Sales data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class CryptoSlamNFTSalesAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddCrypto("ETHUSD", Resolution.Daily, Market.Bitfinex).Symbol
        self.dataset_symbol = self.AddData(CryptoSlamNFTSales, "ETH").Symbol
namespace QuantConnect
{
    public class CryptoSlamNFTSalesAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddCrypto("ETHUSD", Resolution.Daily, Market.Bitfinex).Symbol;
            _datasetSymbol = AddData<CryptoSlamNFTSales>("ETH").Symbol;
        }
    }
}

Accessing Data

To get the current NFT Sales data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} unique buyers at {slice.Time}: {data_point.UniqueBuyers}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} unique buyers at {slice.Time}: {dataPoint.UniqueBuyers}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(CryptoSlamNFTSales).items():
        self.Log(f"{dataset_symbol} unique buyers at {slice.Time}: {data_point.UniqueBuyers}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<CryptoSlamNFTSales>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} unique buyers at {slice.Time}: {dataPoint.UniqueBuyers}");
    }
}

Historical Data

To get historical NFT Sales data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame 
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[CryptoSlamNFTSales](self.dataset_symbol, 100, Resolution.Daily)
var history = History<CryptoSlamNFTSales>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The NFT Sales dataset enables you to incorporate NFT sales information into your strategies. Examples include the following strategies:

 

6.14 Energy Information Administration

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation"s financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

 

6.14.1 US Energy Information Administration (EIA)

Introduction

The US Energy Information Administration (EIA) datasets by the Department of the Treasury tracks national and international oil production and consumption. The data covers 190 datasets, starts in January 1991, and is delivered on a daily frequency. This dataset is created by QuantConnect processing and caching the EIA archives.

For more information about the US Energy Information Administration (EIA) dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation's financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

Getting Started

The following snippet demonstrates how to request data from the EIA dataset:

from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(USEnergy, USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts).Symbol
using QuantConnect.DataSource;

_datasetSymbol = AddData<USEnergy>(USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1991
Asset Coverage 190 Datasets
Data Density Sparse
Resolution Daily
Timezone New York

Supported Datasets

The following table shows the accessor code you need to add each EIA dataset to your algorithm:

Symbol Accessor Code Description
UnitedStates
PET.WGFRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderAdjustedNetProductionOfFinishedMotorGasoline U.S. Refiner and Blender Adjusted Net Production of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WGFSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfFinishedMotorGasoline U.S. Ending Stocks of Finished Motor Gasoline in Thousand Barrels (Mbbl)
PET.WGFUPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfFinishedMotorGasoline U.S. Product Supplied of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WCSSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfCrudeOilInSpr U.S. Ending Stocks of Crude Oil in SPR in Thousand Barrels (Mbbl)
PET.WDGRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfDistillateFuelOilGreaterThan500PpmSulfur U.S. Refiner and Blender Net Production of Distillate Fuel Oil Greater than 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WDGSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfDistillateFuelOilGreaterThan500PpmSulfur U.S. Ending Stocks of Distillate Fuel Oil, Greater Than 500 ppm Sulfur in Thousand Barrels (Mbbl)
PET.WDIEXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfTotalDistillate U.S. Exports of Total Distillate in Thousand Barrels per Day (Mbbl/d)
PET.WDIIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfDistillateFuelOil U.S. Imports of Distillate Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WDIRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfDistillateFuelOil U.S. Refiner and Blender Net Production of Distillate Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WKJSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfKeroseneTypeJetFuel U.S. Ending Stocks of Kerosene-Type Jet Fuel in Thousand Barrels (Mbbl)
PET.WKJUPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfKeroseneTypeJetFuel U.S. Product Supplied of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WGTIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfTotalGasoline U.S. Imports of Total Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WGTSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfTotalGasoline U.S. Ending Stocks of Total Gasoline in Thousand Barrels (Mbbl)
PET.WGIRIUS2.W USEnergy.Petroleum.UnitedStates.WeeklyGrossInputsIntoRefineries U.S. Gross Inputs into Refineries in Thousand Barrels per Day (Mbbl/d)
PET.WGRIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfReformulatedMotorGasoline U.S. Imports of Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WGRRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfReformulatedMotorGasoline U.S. Refiner and Blender Net Production of Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WGRSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedMotorGasoline U.S. Ending Stocks of Reformulated Motor Gasoline in Thousand Barrels (Mbbl)
PET.WDISTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfDistillateFuelOil U.S. Ending Stocks of Distillate Fuel Oil in Thousand Barrels (Mbbl)
PET.WDIUPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfDistillateFuelOil U.S. Product Supplied of Distillate Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WKMRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfMilitaryKeroseneTypeJetFuel U.S. Refiner and Blender Net Production of Military Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WOCLEUS2.W USEnergy.Petroleum.UnitedStates.WeeklyOperableCrudeOilDistillationCapacity U. S. Operable Crude Oil Distillation Capacity in Thousand Barrels per Calendar Day (Mbbl/d)
PET.WPLSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyPropyleneNonfuelUseStocksAtBulkTerminals U.S. Propylene Nonfuel Use Stocks at Bulk Terminals in Thousand Barrels (Mbbl)
PET.WPRSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfPropaneAndPropylene U.S. Ending Stocks of Propane and Propylene in Thousand Barrels (Mbbl)
PET.WPULEUS3.W USEnergy.Petroleum.UnitedStates.WeeklyPercentUtilizationOfRefineryOperableCapacity U.S. Percent Utilization of Refinery Operable Capacity in Percent (%)
PET.WREEXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfResidualFuelOil U.S. Exports of Residual Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WREIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfResidualFuelOil U.S. Imports of Residual Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WKCRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfCommercialKeroseneTypeJetFuel U.S. Refiner and Blender Net Production of Commercial Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WKJEXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfKeroseneTypeJetFuel U.S. Exports of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WKJIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfKeroseneTypeJetFuel U.S. Imports of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WKJRPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfKeroseneTypeJetFuel U.S. Refiner and Blender Net Production of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.WCESTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksExcludingSprOfCrudeOil U.S. Ending Stocks excluding SPR of Crude Oil in Thousand Barrels (Mbbl)
PET.WCREXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfCrudeOil U.S. Exports of Crude Oil in Thousand Barrels per Day (Mbbl/d)
PET.WCRFPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyFieldProductionOfCrudeOil U.S. Field Production of Crude Oil in Thousand Barrels per Day (Mbbl/d)
PET.WCRIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfCrudeOil U.S. Imports of Crude Oil in Thousand Barrels per Day (Mbbl/d)
PET.WCRNTUS2.W USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfCrudeOil U.S. Net Imports of Crude Oil in Thousand Barrels per Day (Mbbl/d)
PET.WCRRIUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetInputOfCrudeOil U.S. Refiner Net Input of Crude Oil in Thousand Barrels per Day (Mbbl/d)
PET.WRERPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfResidualFuelOil U.S. Refiner and Blender Net Production of Residual Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WRESTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfResidualFuelOil U.S. Ending Stocks of Residual Fuel Oil in Thousand Barrels (Mbbl)
PET.WREUPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfResidualFuelOil U.S. Product Supplied of Residual Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.WRPEXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfTotalPetroleumProducts U.S. Exports of Total Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WRPIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfTotalPetroleumProducts U.S. Imports of Total Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WRPNTUS2.W USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts U.S. Net Imports of Total Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WRPUPUS2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfPetroleumProducts U.S. Product Supplied of Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WTESTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksExcludingSprOfCrudeOilAndPetroleumProducts U.S. Ending Stocks excluding SPR of Crude Oil and Petroleum Products in Thousand Barrels (Mbbl)
PET.WTTEXUS2.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfCrudeOilAndPetroleumProducts U.S. Exports of Crude Oil and Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WTTIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfCrudeOilAndPetroleumProducts U.S. Imports of Crude Oil and Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WTTNTUS2.W USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfCrudeOilAndPetroleumProducts U.S. Net Imports of Crude Oil and Petroleum Products in Thousand Barrels per Day (Mbbl/d)
PET.WTTSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfCrudeOilAndPetroleumProducts U.S. Ending Stocks of Crude Oil and Petroleum Products in Thousand Barrels (Mbbl)
PET.WUOSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfUnfinishedOils U.S. Ending Stocks of Unfinished Oils in Thousand Barrels (Mbbl)
PET.WG6TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfOtherFinishedConventionalMotorGasoline U.S. Refiner and Blender Net Production of Other Finished Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WD0TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfDistillateFuelOil0To15PpmSulfur U.S. Refiner and Blender Net Production of Distillate Fuel Oil, 0 to 15 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WD1ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Ending Stocks of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels (Mbbl)
PET.WD1TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyProductionOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Production of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WG1ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedMotorGasolineWithFuelAlcohol U.S. Ending Stocks of Reformulated Motor Gasoline with Fuel ALcohol in Thousand Barrels (Mbbl)
PET.WCRSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfCrudeOil U.S. Ending Stocks of Crude Oil in Thousand Barrels (Mbbl)
PET.WCSIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyCrudeOilImportsBySpr U.S. Crude Oil Imports by SPR in Thousand Barrels per Day (Mbbl/d)
PET.WBCIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfGasolineBlendingComponents U.S. Imports of Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WBCSTUS1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfGasolineBlendingComponents U.S. Ending Stocks of Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.WCEIMUS2.W USEnergy.Petroleum.UnitedStates.WeeklyCommercialCrudeOilImportsExcludingSpr U.S. Commercial Crude Oil Imports Excluding SPR in Thousand Barrels per Day (Mbbl/d)
PET.WPRTP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerBlenderAndGasPlantNetProductionOfPropaneAndPropylene U.S. Refiner, Blender, and Gas Plant Net Production of Propane and Propylene in Thousand Barrels per Day (Mbbl/d)
PET.WG1TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfFinishedReformulatedMotorGasolineWithEthanol U.S. Refiner and Blender Net Production of Finished Reformulated Motor Gasoline with Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.WG3ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedMotorGasolineNonOxygentated U.S. Ending Stocks of Reformulated Motor Gasoline, Non-Oxygentated in Thousand Barrels (Mbbl)
PET.WG4ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalMotorGasoline U.S. Ending Stocks of Conventional Motor Gasoline in Thousand Barrels (Mbbl)
PET.WG4TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfConventionalMotorGasoline U.S. Refiner and Blender Net Production of Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WG5ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalMotorGasolineWithFuelEthanol U.S. Ending Stocks of Conventional Motor Gasoline with Fuel Ethanol in Thousand Barrels (Mbbl)
PET.WG5TP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfFinishedConventionalMotorGasolineWithEthanol U.S. Refiner and Blender Net Production of Finished Conventional Motor Gasoline with Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.WG6ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfOtherConventionalMotorGasoline U.S. Ending Stocks of Other Conventional Motor Gasoline in Thousand Barrels (Mbbl)
PET.WO6RI_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfConventionalCbobGasolineBlendingComponents U.S. Refiner and Blender Net Input of Conventional CBOB Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO6ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalCbobGasolineBlendingComponents U.S. Ending Stocks of Conventional CBOB Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.WO7RI_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfConventionalGtabGasolineBlendingComponents U.S. Refiner and Blender Net Input of Conventional GTAB Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO7ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalGtabGasolineBlendingComponents U.S. Ending Stocks of Conventional GTAB Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.WO9RI_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfConventionalOtherGasolineBlendingComponents U.S. Refiner and Blender Net Input of Conventional Other Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO9ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalOtherGasolineBlendingComponents U.S. Ending Stocks of Conventional Other Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.W_EPD2F_PWR_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyNo2HeatingOilWholesaleResalePrice U.S. No. 2 Heating Oil Wholesale/Resale Price in Dollars per Gallon ($/gal)
PET.W_EPC0_SKA_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyCrudeOilStocksInTransitOnShipsFromAlaska U.S. Crude Oil Stocks in Transit (on Ships) from Alaska in Thousand Barrels (Mbbl)
PET.W_EPC0_VSD_NUS_DAYS.W USEnergy.Petroleum.UnitedStates.WeeklyDaysOfSupplyOfCrudeOilExcludingSpr U.S. Days of Supply of Crude Oil excluding SPR in Number of Days (Days)
PET.W_EPD0_VSD_NUS_DAYS.W USEnergy.Petroleum.UnitedStates.WeeklyDaysOfSupplyOfTotalDistillate U.S. Days of Supply of Total Distillate in Number of Days (Days)
PET.W_EPD2F_PRS_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyWeeklyNo2HeatingOilResidentialPrice U.S. Weekly No. 2 Heating Oil Residential Price in Dollars per Gallon ($/gal)
PET.WPRUP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfPropaneAndPropylene U.S. Product Supplied of Propane and Propylene in Thousand Barrels per Day (Mbbl/d)
PET.WWOUP_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyProductSuppliedOfOtherOils U.S. Product Supplied of Other Oils in Thousand Barrels per Day (Mbbl/d)
PET.WBCRI_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfGasolineBlendingComponents U.S. Refiner and Blender Net Input of Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WD0ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfDistillateFuelOil0To15PpmSulfur U.S. Ending Stocks of Distillate Fuel Oil, 0 to 15 ppm Sulfur in Thousand Barrels (Mbbl)
PET.W_EPJK_VSD_NUS_DAYS.W USEnergy.Petroleum.UnitedStates.WeeklyDaysOfSupplyOfKeroseneTypeJetFuel U.S. Days of Supply of Kerosene-Type Jet Fuel in Number of Days (Days)
PET.W_EPM0_VSD_NUS_DAYS.W USEnergy.Petroleum.UnitedStates.WeeklyDaysOfSupplyOfTotalGasoline U.S. Days of Supply of Total Gasoline in Number of Days (Days)
PET.W_EPPA_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfAsphaltAndRoadOil U.S. Ending Stocks of Asphalt and Road Oil in Thousand Barrels (Mbbl)
PET.W_EPPK_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfKerosene U.S. Ending Stocks of Kerosene in Thousand Barrels (Mbbl)
PET.W_EPDM10_VUA_NUS_2.W USEnergy.Petroleum.UnitedStates.WeeklySupplyAdjustmentOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Supply Adjustment of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WG5IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfConventionalMotorGasolineWithFuelEthanol U.S. Imports of Conventional Motor Gasoline with Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.WG6IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfOtherConventionalMotorGasoline U.S. Imports of Other Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WD0IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfDistillateFuelOil0To15PpmSulfur U.S. Imports of Distillate Fuel Oil, 0 to 15 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WD1IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Imports of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WD2IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfDistillateFuelOilGreaterThan500To2000PpmSulfur U.S. Imports of Distillate Fuel Oil, Greater than 500 to 2000 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WPRIM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfPropaneAndPropylene U.S. Imports of Propane and Propylene in Thousand Barrels per Day (Mbbl/d)
PET.WO7IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfConventionalGtabGasolineBlendingComponents U.S. Imports of Conventional GTAB Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WD3IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfDistillateFuelOilGreaterThan2000PpmSulfur U.S. Imports of Distillate Fuel Oil, Greater than 2000 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.WG1IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfReformulatedMotorGasolineWithFuelAlcohol U.S. Imports of Reformulated Motor Gasoline with Fuel ALcohol in Thousand Barrels per Day (Mbbl/d)
PET.WG4IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfConventionalMotorGasoline U.S. Imports of Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.WO9IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfConventionalOtherGasolineBlendingComponents U.S. Imports of Conventional Other Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO6IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfConventionalCbobGasolineBlendingComponents U.S. Imports of Conventional CBOB Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.W_EPPK_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfKerosene U.S. Blender Net Production of Kerosene in Thousand Barrels per Day (Mbbl/d)
PET.W_EPPK_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfKerosene U.S. Refiner Net Production of Kerosene in Thousand Barrels per Day (Mbbl/d)
PET.W_EPPO6_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfOtherOilsExcludingFuelEthanol U.S. Ending Stocks of Other Oils (Excluding Fuel Ethanol) in Thousand Barrels (Mbbl)
PET.W_EPPR_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfResidualFuelOil U.S. Refiner Net Production of Residual Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0R_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfReformulatedMotorGasoline U.S. Blender Net Production of Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0R_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfReformulatedMotorGasoline U.S. Refiner Net Production of Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPOOXE_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfFuelEthanol U.S. Ending Stocks of Fuel Ethanol in Thousand Barrels (Mbbl)
PET.W_EPD0_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfDistillateFuelOil U.S. Blender Net Production of Distillate Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.W_EPD0_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfDistillateFuelOil U.S. Refiner Net Production of Distillate Fuel Oil in Thousand Barrels per Day (Mbbl/d)
PET.W_EPJK_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfKeroseneTypeJetFuel U.S. Blender Net Production of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.W_EPJK_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfKeroseneTypeJetFuel U.S. Refiner Net Production of Kerosene-Type Jet Fuel in Thousand Barrels per Day (Mbbl/d)
PET.W_EPLLPA_PRS_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyPropaneResidentialPrice U.S. Propane Residential Price in Dollars per Gallon ($/gal)
PET.W_EPLLPA_PWR_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyPropaneWholesaleResalePrice U.S. Propane Wholesale/Resale Price in Dollars per Gallon ($/gal)
PET.W_EPOBGRR_YIR_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfMotorGasolineBlendingComponentsRbob U.S. Refiner and Blender Net Input of Motor Gasoline Blending Components, RBOB in Thousand Barrels per Day (Mbbl/d)
PET.W_EPL0XP_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfNgplsLrgsExcludingPropanePropylene U.S. Ending Stocks of NGPLs/LRGs (Excluding Propane/Propylene) in Thousand Barrels (Mbbl)
PET.W_EPLLPZ_VSD_NUS_DAYS.W USEnergy.Petroleum.UnitedStates.WeeklyDaysOfSupplyOfPropanePropylene U.S. Days of Supply of Propane/Propylene in Number of Days (Days)
PET.W_EPM0C_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfConventionalMotorGasoline U.S. Blender Net Production of Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0C_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfConventionalMotorGasoline U.S. Refiner Net Production of Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_VUA_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklySupplyAdjustmentOfFinishedMotorGasoline U.S. Supply Adjustment of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfFinishedMotorGasoline U.S. Blender Net Production of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_YPR_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfFinishedMotorGasoline U.S. Refiner and Blender Net Production of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfFinishedMotorGasoline U.S. Refiner Net Production of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPD00H_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfDistillateFuelOilGreaterThan500PpmSulfur U.S. Blender Net Production of Distillate Fuel Oil, Greater Than 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPD00H_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfDistillateFuelOilGreaterThan500PpmSulfur U.S. Refiner Net Production of Distillate Fuel Oil, Greater Than 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPDM10_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Blender Net Production of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPDM10_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfDistillateFuelOilGreaterThan15To500PpmSulfur U.S. Refiner Net Production of Distillate Fuel Oil, Greater than 15 to 500 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPDXL0_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfDistillateFuelOil0To15PpmSulfur U.S. Blender Net Production of Distillate Fuel Oil, 0 to 15 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPDXL0_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfDistillateFuelOil0To15PpmSulfur U.S. Refiner Net Production of Distillate Fuel Oil, 0 to 15 ppm Sulfur in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CA_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfConventionalMotorGasolineWithFuelEthanol U.S. Blender Net Production of Conventional Motor Gasoline with Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CA_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfConventionalMotorGasolineWithFuelEthanol U.S. Refiner Net Production of Conventional Motor Gasoline with Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CO_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfOtherConventionalMotorGasoline U.S. Blender Net Production of Other Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CO_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfOtherConventionalMotorGasoline U.S. Refiner Net Production of Other Conventional Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RA_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfReformulatedMotorGasolineWithFuelAlcohol U.S. Blender Net Production of Reformulated Motor Gasoline with Fuel ALcohol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RA_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfReformulatedMotorGasolineWithFuelAlcohol U.S. Refiner Net Production of Reformulated Motor Gasoline with Fuel ALcohol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPOOXE_YOP_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyOxygenatePlantProductionOfFuelEthanol U.S. Oxygenate Plant Production of Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAL55_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfMotorGasolineFinishedConventionalEd55AndLower U.S. Blender Net Production of Motor Gasoline, Finished, Conventional, Ed55 and Lower in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAL55_YPT_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfFinishedConventionalMotorGasolineEd55AndLower U.S. Refiner and Blender Net Production of Finished Conventional Motor Gasoline, Ed 55 and Lower in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAL55_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfMotorGasolineFinishedConventionalEd55AndLower U.S. Refiner Net Production of Motor Gasoline, Finished, Conventional, Ed55 and Lower in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_EEX_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfFinishedMotorGasoline U.S. Exports of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0F_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfFinishedMotorGasoline U.S. Imports of Finished Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RO_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfOtherReformulatedMotorGasoline U.S. Blender Net Production of Other Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RO_YPT_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfOtherFinishedReformulatedMotorGasoline U.S. Refiner and Blender Net Production of Other Finished Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RO_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfOtherReformulatedMotorGasoline U.S. Refiner Net Production of Other Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPOBGRR_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfMotorGasolineBlendingComponentsRbob U.S. Ending Stocks of Motor Gasoline Blending Components, RBOB in Thousand Barrels (Mbbl)
PET.W_EPOOXE_YIR_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetInputOfFuelEthanol U.S. Refiner and Blender Net Input of Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAG55_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfMotorGasolineFinishedConventionalGreaterThanEd55 U.S. Imports of Motor Gasoline, Finished, Conventional, Greater than Ed55 in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAL55_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfMotorGasolineFinishedConventionalEd55AndLower U.S. Imports of Motor Gasoline, Finished, Conventional, Ed55 and Lower in Thousand Barrels per Day (Mbbl/d)
PET.W_EPC0_IMU_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyCrudeOilImportsForSprByOthers U.S. Crude Oil Imports for SPR by Others in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAG55_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalMotorGasolineGreaterThanEd55 U.S. Ending Stocks of Conventional Motor Gasoline, Greater than Ed55 in Thousand Barrels (Mbbl)
PET.W_EPOOXE_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfFuelEthanol U.S. Imports of Fuel Ethanol in Thousand Barrels per Day (Mbbl/d)
PET.W_EPL0XP_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfLiquefiedPetroleumGassesLessPropanePropylene U.S. Imports of Liquefied Petroleum Gasses Less Propane/Propylene in Thousand Barrels per Day (Mbbl/d)
PET.W_EPLLPZ_EEX_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfPropaneAndPropylene U.S. Exports of Propane and Propylene in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0RO_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfOtherReformulatedMotorGasoline U.S. Imports of Other Reformulated Motor Gasoline in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAG55_YPB_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyBlenderNetProductionOfMotorGasolineFinishedConventionalGreaterThanEd55 U.S. Blender Net Production of Motor Gasoline, Finished, Conventional, Greater Than Ed55 in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAG55_YPT_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerAndBlenderNetProductionOfFinishedConventionalMotorGasolineGreaterThanEd55 U.S. Refiner and Blender Net Production of Finished Conventional Motor Gasoline, Greater than Ed 55 in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAG55_YPY_NUS_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyRefinerNetProductionOfFinishedConventionalMotorGasolineGreaterThanEd55 U.S. Refiner Net Production of Finished Conventional Motor Gasoline, Greater than Ed 55 in Thousand Barrels per Day (Mbbl/d)
PET.W_EPM0CAL55_SAE_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfConventionalMotorGasolineEd55AndLower U.S. Ending Stocks of Conventional Motor Gasoline, Ed55 and Lower in Thousand Barrels (Mbbl)
PET.W_EPPK_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfKerosene U.S. Imports of Kerosene in Thousand Barrels per Day (Mbbl/d)
PET.W_EPPO4_EEX_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyExportsOfOtherOils U.S. Exports of Other Oils in Thousand Barrels per Day (Mbbl/d)
PET.W_EPPO6_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfOtherOilsExcludingFuelEthanol U.S. Imports of Other Oils (Excluding Fuel Ethanol) in Thousand Barrels per Day (Mbbl/d)
PET.W_EPOBGRR_IM0_NUS-Z00_MBBLD.W USEnergy.Petroleum.UnitedStates.WeeklyImportsFromAllCountriesOfMotorGasolineBlendingComponentsRbob U.S. Imports from All Countries of Motor Gasoline Blending Components, RBOB in Thousand Barrels per Day (Mbbl/d)
PET.EMM_EPMR_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyRegularAllFormulationsRetailGasolinePrices U.S. Regular All Formulations Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMM_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyMidgradeAllFormulationsRetailGasolinePrices U.S. Midgrade All Formulations Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMP_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyPremiumAllFormulationsRetailGasolinePrices U.S. Premium All Formulations Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPM0_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyAllGradesAllFormulationsRetailGasolinePrices U.S. All Grades All Formulations Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPM0R_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyAllGradesReformulatedRetailGasolinePrices U.S. All Grades Reformulated Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMMR_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyMidgradeReformulatedRetailGasolinePrices U.S. Midgrade Reformulated Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMPR_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyPremiumReformulatedRetailGasolinePrices U.S. Premium Reformulated Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMRU_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyRegularConventionalRetailGasolinePrices U.S. Regular Conventional Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMRR_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyRegularReformulatedRetailGasolinePrices U.S. Regular Reformulated Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMD_EPD2D_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyNo2DieselRetailPrices U.S. No 2 Diesel Retail Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMPU_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyPremiumConventionalRetailGasolinePrices U.S. Premium Conventional Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPMMU_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyMidgradeConventionalRetailGasolinePrices U.S. Midgrade Conventional Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMM_EPM0U_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyAllGradesConventionalRetailGasolinePrices U.S. All Grades Conventional Retail Gasoline Prices in Dollars per Gallon ($/gal)
PET.EMD_EPD2DXL0_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyNo2DieselUltraLowSulfur015PpmRetailPrices U.S. No 2 Diesel Ultra Low Sulfur (0-15 ppm) Retail Prices in Dollars per Gallon ($/gal)
PET.W_EPC0_SAX_NUS_MBBL.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksExcludingSprAndIncludingLeaseStockOfCrudeOil U.S. Ending Stocks excluding SPR and including Lease Stock of Crude Oil in Thousand Barrels (Mbbl)
PET.EMD_EPD2DM10_PTE_NUS_DPG.W USEnergy.Petroleum.UnitedStates.WeeklyNo2DieselLowSulfur15500PpmRetailPrices U.S. No 2 Diesel Low Sulfur (15-500 ppm) Retail Prices in Dollars per Gallon ($/gal)
PET.WO3IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfReformulatedRbobWithAlcoholGasolineBlendingComponents U.S. Imports of Reformulated RBOB with Alcohol Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO4IM_NUS-Z00_2.W USEnergy.Petroleum.UnitedStates.WeeklyImportsOfReformulatedRbobWithEtherGasolineBlendingComponents U.S. Imports of Reformulated RBOB with Ether Gasoline Blending Components in Thousand Barrels per Day (Mbbl/d)
PET.WO2ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedGtabGasolineBlendingComponents U.S. Ending Stocks of Reformulated GTAB Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.WO3ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedRbobWithAlcoholGasolineBlendingComponents U.S. Ending Stocks of Reformulated RBOB with Alcohol Gasoline Blending Components in Thousand Barrels (Mbbl)
PET.WO4ST_NUS_1.W USEnergy.Petroleum.UnitedStates.WeeklyEndingStocksOfReformulatedRbobWithEtherGasolineBlendingComponents U.S. Ending Stocks of Reformulated RBOB with Ether Gasoline Blending Components in Thousand Barrels (Mbbl)
EquatorialGuinea
PET.W_EPC0_IM0_NUS-NEK_MBBLD.W USEnergy.Petroleum.EquatorialGuinea.WeeklyImportsFromEquatorialGuineaOfCrudeOil U.S. Imports from Equatorial Guinea of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Iraq
PET.W_EPC0_IM0_NUS-NIZ_MBBLD.W USEnergy.Petroleum.Iraq.WeeklyImportsFromIraqOfCrudeOil U.S. Imports from Iraq of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Kuwait
PET.W_EPC0_IM0_NUS-NKU_MBBLD.W USEnergy.Petroleum.Kuwait.WeeklyImportsFromKuwaitOfCrudeOil U.S. Imports from Kuwait of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Mexico
PET.W_EPC0_IM0_NUS-NMX_MBBLD.W USEnergy.Petroleum.Mexico.WeeklyImportsFromMexicoOfCrudeOil U.S. Imports from Mexico of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Nigeria
PET.W_EPC0_IM0_NUS-NNI_MBBLD.W USEnergy.Petroleum.Nigeria.WeeklyImportsFromNigeriaOfCrudeOil U.S. Imports from Nigeria of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Norway
PET.W_EPC0_IM0_NUS-NNO_MBBLD.W USEnergy.Petroleum.Norway.WeeklyImportsFromNorwayOfCrudeOil U.S. Imports from Norway of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Russia
PET.W_EPC0_IM0_NUS-NRS_MBBLD.W USEnergy.Petroleum.Russia.WeeklyImportsFromRussiaOfCrudeOil U.S. Imports from Russia of Crude Oil in Thousand Barrels per Day (Mbbl/d)
SaudiArabia
PET.W_EPC0_IM0_NUS-NSA_MBBLD.W USEnergy.Petroleum.SaudiArabia.WeeklyImportsFromSaudiArabiaOfCrudeOil U.S. Imports from Saudi Arabia of Crude Oil in Thousand Barrels per Day (Mbbl/d)
UnitedKingdom
PET.W_EPC0_IM0_NUS-NUK_MBBLD.W USEnergy.Petroleum.UnitedKingdom.WeeklyImportsFromUnitedKingdomOfCrudeOil U.S. Imports from United Kingdom of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Venezuela
PET.W_EPC0_IM0_NUS-NVE_MBBLD.W USEnergy.Petroleum.Venezuela.WeeklyImportsFromVenezuelaOfCrudeOil U.S. Imports from Venezuela of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Algeria
PET.W_EPC0_IM0_NUS-NAG_MBBLD.W USEnergy.Petroleum.Algeria.WeeklyImportsFromAlgeriaOfCrudeOil U.S. Imports from Algeria of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Angola
PET.W_EPC0_IM0_NUS-NAO_MBBLD.W USEnergy.Petroleum.Angola.WeeklyImportsFromAngolaOfCrudeOil U.S. Imports from Angola of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Brazil
PET.W_EPC0_IM0_NUS-NBR_MBBLD.W USEnergy.Petroleum.Brazil.WeeklyImportsFromBrazilOfCrudeOil U.S. Imports from Brazil of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Canada
PET.W_EPC0_IM0_NUS-NCA_MBBLD.W USEnergy.Petroleum.Canada.WeeklyImportsFromCanadaOfCrudeOil U.S. Imports from Canada of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Congo
PET.W_EPC0_IM0_NUS-NCF_MBBLD.W USEnergy.Petroleum.Congo.WeeklyImportsFromCongoBrazzavilleOfCrudeOil U.S. Imports from Congo (Brazzaville) of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Colombia
PET.W_EPC0_IM0_NUS-NCO_MBBLD.W USEnergy.Petroleum.Colombia.WeeklyImportsFromColombiaOfCrudeOil U.S. Imports from Colombia of Crude Oil in Thousand Barrels per Day (Mbbl/d)
Ecuador
PET.W_EPC0_IM0_NUS-NEC_MBBLD.W USEnergy.Petroleum.Ecuador.WeeklyImportsFromEcuadorOfCrudeOil U.S. Imports from Ecuador of Crude Oil in Thousand Barrels per Day (Mbbl/d)

Data Point Attributes

The EIA dataset provides USEnergy objects, which have the following attributes:

Requesting Data

To add EIA data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class USEnergyDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.dataset_symbol = self.AddData(USEnergy, USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts).Symbol
namespace QuantConnect
{
    public class USEnergyDataAlgorithm: QCAlgorithm
    {
        private Symbol _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _datasetSymbol = AddData<USEnergy>(USEnergy.Petroleum.UnitedStates.WeeklyNetImportsOfTotalPetroleumProducts).Symbol;
        }
    }
}

Accessing Data

To get the current EIA data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} value at {slice.Time}: {data_point.Value}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} value at {slice.Time}: {dataPoint.Value}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(USEnergy).items():
        self.Log(f"{dataset_symbol} value at {slice.Time}: {data_point.Value}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<USEnergy>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} value at {slice.Time}: {dataPoint.Value}");
    }
}

Historical Data

To get historical EIA data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[USEnergy](self.dataset_symbol, 100, Resolution.Daily)
var history = History<USEnergy>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove your subscription to EIA data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The EIA dataset enables you to monitor national and international oil production and consumption in you trading strategies. Examples include the following strategies:

 

6.15 ExtractAlpha

ExtractAlpha was founded by Vinesh Jha in 2013 with the goal of providing alternative data for investors. ExtractAlpha"s rigorously researched data sets and quantitative stock selection models leverage unique sources and analytical techniques, allowing users to gain an investment edge.

 

6.15.1 Cross Asset Model

Introduction

The Cross Asset Model by ExtractAlpha provides stock scoring values based on the trading activity in the Options market. Since the Options market has a higher proportion of institutional traders than the Equities market, the Options market is composed of investors who are more informed and information-driven on average. The data covers a dynamic universe of over 3,000 US Equities, starts in July 2005, and is delivered on a daily frequency. This dataset is created by feature engineering on the Options market put-call spread, volatility skewness, and volume.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Cross Asset Model dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

ExtractAlpha was founded by Vinesh Jha in 2013 with the goal of providing alternative data for investors. ExtractAlpha's rigorously researched data sets and quantitative stock selection models leverage unique sources and analytical techniques, allowing users to gain an investment edge.

Getting Started

The following snippet demonstrates how to request data from the Cross Asset Model dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(ExtractAlphaCrossAssetModel, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<ExtractAlphaCrossAssetModel>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date July 2005
Asset Coverage Over 3,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Cross Asset Model dataset provides ExtractAlphaCrossAssetModel objects, which have the following attributes:

Requesting Data

To add Cross Asset Model data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class ExtractAlphaCrossAssetModelDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(ExtractAlphaCrossAssetModel, self.symbol).Symbol
namespace QuantConnect
{
    public class ExtractAlphaCrossAssetModelDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<ExtractAlphaCrossAssetModel>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Cross Asset Model data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} score at {slice.Time}: {data_point.Score}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} score at {slice.Time}: {dataPoint.Score}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(ExtractAlphaCrossAssetModel).items():
        self.Log(f"{dataset_symbol} score at {slice.Time}: {data_point.Score}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<ExtractAlphaCrossAssetModel>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} score at {slice.Time}: {dataPoint.Score}");
    }
}

Historical Data

To get historical Cross Asset Model data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[ExtractAlphaCrossAssetModel](self.dataset_symbol, 100, Resolution.Daily)
var history = History<ExtractAlphaCrossAssetModel>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Cross Asset Model data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Cross Asset Model dataset by ExtractAlpha enables you to utilize Options market information to extract alpha. Examples include the following strategies:

 

6.15.2 Estimize

Introduction

The Estimize dataset by ExtractAlpha estimates the financials of companies, including EPS, revenues, industry-specific KPIs, macroeconomic indicators, and more. The data covers over 2,800 US-listed Equities’ EPS/Revenue, over 200 company KPIs, 27 US and 55 international macroeconomic indicator datasets, and more. The data starts in January 2011 and is delivered on a daily frequency. This dataset is crowdsourced from a community of 100,000+ contributors via the data provider’s web platform.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Estimize dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

ExtractAlpha was founded by Vinesh Jha in 2013 with the goal of providing alternative data for investors. ExtractAlpha's rigorously researched data sets and quantitative stock selection models leverage unique sources and analytical techniques, allowing users to gain an investment edge.

Getting Started

The following snippet demonstrates how to request data from the Estimize dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.estimize_consensus_symbol = self.AddData(EstimizeConsensus, self.symbol).Symbol
self.estimize_estimate_symbol = self.AddData(EstimizeEstimate, self.symbol).Symbol
self.estimize_release_symbol = self.AddData(EstimizeRelease, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_estimizeConsensusSymbol = AddData<EstimizeConsensus>(_symbol).Symbol;
_estimizeEstimateSymbol = AddData<EstimizeEstimate>(_symbol).Symbol; 
_estimizeReleaseSymbol = AddData<EstimizeRelease>(_symbol).Symbol; 

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2011
Asset Coverage 2,800 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Estimize dataset provides EstimizeConsensus , EstimizeEstimate , and EstimizeRelease objects.

EstimizeConsensus Attributes

EstimizeConsensus objects have the following attributes:

EstimizeEstimate Attributes

EstimizeEstimate objects have the following attributes:

EstimizeRelease Attributes

EstimizeRelease objects have the following attributes:

Requesting Data

To add Estimize data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class ExtractAlphaEstimizeDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.estimize_consensus_symbol = self.AddData(EstimizeConsensus, self.symbol).Symbol
        self.estimize_estimate_symbol = self.AddData(EstimizeEstimate, self.symbol).Symbol
        self.estimize_release_symbol = self.AddData(EstimizeRelease, self.symbol).Symbol
namespace QuantConnect
{
    public class ExtractAlphaEstimizeDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _estimizeConsensusSymbol, _estimizeEstimateSymbol, _estimizeReleaseSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _estimizeConsensusSymbol = AddData<EstimizeConsensus>(_symbol).Symbol;
            _estimizeEstimateSymbol = AddData<EstimizeEstimate>(_symbol).Symbol; 
            _estimizeReleaseSymbol = AddData<EstimizeRelease>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Estimize data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.estimize_consensus_symbol):
        data_point = slice[self.estimize_consensus_symbol]
        self.Log(f"{self.estimize_consensus_symbol} mean at {slice.Time}: {data_point.Mean}")

    if slice.ContainsKey(self.estimize_estimate_symbol):
        data_point = slice[self.estimize_estimate_symbol]
        self.Log(f"{self.estimize_estimate_symbol} EPS at {slice.Time}: {data_point.Eps}")

    if slice.ContainsKey(self.estimize_release_symbol):
        data_point = slice[self.estimize_release_symbol]
        self.Log(f"{self.estimize_release_symbol} EPS at {slice.Time}: {data_point.Eps}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_estimizeConsensusSymbol))
    {
        var dataPoint = slice[_estimizeConsensusSymbol];
        Log($"{_estimizeConsensusSymbol} mean at {slice.Time}: {dataPoint.Mean}");
    }

    if (slice.ContainsKey(_estimizeEstimateSymbol))
    {
        var dataPoint = slice[_estimizeEstimateSymbol];
        Log($"{_estimizeEstimateSymbol} EPS at {slice.Time}: {dataPoint.Eps}");
    }

    if (slice.ContainsKey(_estimizeReleaseSymbol))
    {
        var dataPoint = slice[_estimizeReleaseSymbol];
        Log($"{_estimizeReleaseSymbol} EPS at {slice.Time}: {dataPoint.Eps}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(EstimizeConsensus).items():
        self.Log(f"{dataset_symbol} mean at {slice.Time}: {data_point.Mentions}")

    for dataset_symbol, data_point in slice.Get(EstimizeEstimate).items():
        self.Log(f"{dataset_symbol} EPS at {slice.Time}: {data_point.Eps}")

    for dataset_symbol, data_point in slice.Get(EstimizeRelease).items():
        self.Log(f"{dataset_symbol} EPS at {slice.Time}: {data_point.Eps}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<EstimizeConsensus>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} mean at {slice.Time}: {dataPoint.Mentions}");
    }

    foreach (var kvp in slice.Get<EstimizeEstimate>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} EPS at {slice.Time}: {dataPoint.Eps}");
    }

    foreach (var kvp in slice.Get<EstimizeRelease>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} EPS at {slice.Time}: {dataPoint.Eps}");
    }
}

Historical Data

To get historical Estimize data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
consensus_history_df = self.History(self.estimize_consensus_symbol, 100, Resolution.Daily)
estimate_history_df = self.History(self.estimize_estimate_symbol, 100, Resolution.Daily)
release_history_df = self.History(self.estimize_release_symbol, 100, Resolution.Daily)
history_df = self.History([
    self.estimize_consensus_symbol,
    self.estimize_estimate_symbol,
    self.estimize_release_symbol], 100, Resolution.Daily)

# Dataset objects
consensus_history_bars = self.History[EstimizeConsensus](self.estimize_consensus_symbol, 100, Resolution.Daily)
estimate_history_bars = self.History[EstimizeEstimate](self.estimize_estimate_symbol, 100, Resolution.Daily)
release_history_bars = self.History[EstimizeRelease](self.estimize_release_symbol, 100, Resolution.Daily)
// Dataset objects
var concensusHistory = History<EstimizeConsensus>(_estimizeConsensusSymbol, 100, Resolution.Daily);
var estimateHistory = History<EstimizeEstimate>(_estimizeEstimateSymbol, 100, Resolution.Daily);
var releaseHistory = History<EstimizeRelease>(_estimizeReleaseSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[]{_estimizeConsensusSymbol,
                            _estimizeEstimateSymbol,
                            _estimizeReleaseSymbol}, 10, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.estimize_consensus_symbol)
self.RemoveSecurity(self.estimize_estimate_symbol)
self.RemoveSecurity(self.estimize_release_symbol)
RemoveSecurity(_estimizeConsensusSymbol);
RemoveSecurity(_estimizeEstimateSymbol);
RemoveSecurity(_estimizeReleaseSymbol);

If you subscribe to Estimize data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Estimize dataset enables you to estimate the financial data of a company more accurately for alpha. Examples include the following use cases:

 

6.15.3 Tactical

Introduction

The Tactical dataset by ExtractAlpha is a stock scoring algorithm that captures the technical dynamics of individual US Equities over one to ten trading day horizons. It can assist a longer-horizon investor in timing their entry or exit points or be used in combination with existing systematic or qualitative strategies with similar holding periods.

The data covers a dynamic universe of around 4,700 US Equities per day on average, starts in January 2000, and is delivered on a daily frequency. The Tactical dataset expands upon simple reversal, liquidity, and seasonality factors to identify stocks that are likely to trend or reverse.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Tactical dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

ExtractAlpha was founded by Vinesh Jha in 2013 with the goal of providing alternative data for investors. ExtractAlpha's rigorously researched data sets and quantitative stock selection models leverage unique sources and analytical techniques, allowing users to gain an investment edge.

Getting Started

The following snippet demonstrates how to request data from the Tactical dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(ExtractAlphaTacticalModel, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<ExtractAlphaTacticalModel>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2000
Asset Coverage 5,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Tactical dataset provides ExtractAlphaTacticalModel objects, which have the following attributes:

Requesting Data

To add Tactical data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class ExtractAlphaTacticalModelDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(ExtractAlphaTacticalModel, self.symbol).Symbol
namespace QuantConnect
{
    public class ExtractAlphaTacticalModelDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<ExtractAlphaTacticalModel>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Tactical data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} score at {slice.Time}: {data_point.Score}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} score at {slice.Time}: {dataPoint.Score}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(ExtractAlphaTacticalModel).items():
        self.Log(f"{dataset_symbol} score at {slice.Time}: {data_point.Score}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<ExtractAlphaTacticalModel>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} score at {slice.Time}: {dataPoint.Score}");
    }
}

Historical Data

To get historical Tactical data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_df = self.History[ExtractAlphaTacticalModel](self.dataset_symbol, 100, Resolution.Daily)
var history = History<ExtractAlphaTacticalModel>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Tactical data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Tactical dataset enables you to gain insight into short-term stock dynamics for trading. Examples include the following strategies:

 

6.15.4 True Beats

Introduction

The True Beats dataset by ExtractAlpha provides quantitative predictions of EPS and Revenues for US Equities. The data covers a dynamic universe of around 4,000-5,000 US-listed Equities on a daily average. The data starts in January 2000 and is delivered on a daily frequency. This dataset is created by incorporating the opinions of expert analysts, historical earnings, revenue trends for the company and its peers, and metrics on company earnings management.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the True Beats dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

ExtractAlpha was founded by Vinesh Jha in 2013 with the goal of providing alternative data for investors. ExtractAlpha's rigorously researched data sets and quantitative stock selection models leverage unique sources and analytical techniques, allowing users to gain an investment edge.

Getting Started

The following snippet demonstrates how to request data from the True Beats dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(ExtractAlphaTrueBeats, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<ExtractAlphaTrueBeats>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2000
Asset Coverage Over 5,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The True Beats dataset provides ExtractAlphaTrueBeat objects, which have the following attributes:

The True Beats dataset provides ExtractAlphaTrueBeats and ExtractAlphaTrueBeat objects.

ExtractAlphaTrueBeats

ExtractAlphaTrueBeats objects have the following attributes:

ExtractAlphaTrueBeat

ExtractAlphaTrueBeat objects have the following attributes:

Requesting Data

To add True Beats data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class ExtractAlphaTrueBeatsDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(ExtractAlphaTrueBeats, self.symbol).Symbol
namespace QuantConnect
{
    public class ExtractAlphaTrueBeatsDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<ExtractAlphaTrueBeats>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current True Beats data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} True beat at {slice.Time}: {data_point.TrueBeat}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} True beat at {slice.Time}: {dataPoint.TrueBeat}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(ExtractAlphaTrueBeats).items():
        self.Log(f"{dataset_symbol} True beat at {slice.Time}: {data_point.TrueBeat}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<ExtractAlphaTrueBeats>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} True beat at {slice.Time}: {dataPoint.TrueBeat}");
    }
}

Historical Data

To get historical True Beats data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[ExtractAlphaTrueBeats](self.dataset_symbol, 100, Resolution.Daily)
var history = History<ExtractAlphaTrueBeats>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to True Beats data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The True Beats dataset enables you to predict EPS and revenue of US-listed Equities for trading. Examples include the following strategies:

 

6.16 FRED

The Research Division of the Federal Reserve bank of St. Louis, MO expands the frontier of economic knowledge by producing high-quality original research in the areas of macroeconomics, money and banking, and applied microeconomics. They contribute to monetary policy discussions by advising the Bank president on a range of topics, especially in preparation for Federal Open Market Committee (FOMC) meetings. The Research Division is in the top 1% of all economics research departments worldwide.

 

6.16.1 US Federal Reserve (FRED)

Introduction

The Federal Reserve Economic Data (FRED) by the Research Division of the Federal Reserve bank of St. Louis, MO provides various time series relating to macro-economic data. The data covers 560 datasets, starts in January 1999, and is delivered on a daily frequency. The data is created by aggregating daily updates from more than 85 public and proprietary sources.

For more information about the US Federal Reserve (FRED) dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

The Research Division of the Federal Reserve bank of St. Louis, MO expands the frontier of economic knowledge by producing high-quality original research in the areas of macroeconomics, money and banking, and applied microeconomics. They contribute to monetary policy discussions by advising the Bank president on a range of topics, especially in preparation for Federal Open Market Committee (FOMC) meetings. The Research Division is in the top 1% of all economics research departments worldwide.

Getting Started

The following snippet demonstrates how to request data from the FRED dataset:

from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(Fred, Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough, Resolution.Daily).Symbol
using QuantConnect.DataSource;

_datasetSymbol = AddData<Fred>(Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough, Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1990
Asset Coverage 560 Datasets
Data Density Sparse
Resolution Daily
Timezone New York

Supported Datasets

The following table shows the accessor code you need to add each FRED dataset to your algorithm:

Symbol Accessor Code Summary
CBOE
VXGOGCLS Fred.CBOE.VIXOnGoogle CBOE Equity VIX on Google (in Index)
VXDCLS Fred.CBOE.VXD CBOE DJIA Volatility Index (in Index)
VXGSCLS Fred.CBOE.VIXOnGoldmanSachs CBOE Equity VIX on Goldman Sachs (in Index)
VXIBMCLS Fred.CBOE.VIXOnIBM CBOE Equity VIX on IBM (in Index)
VXAZNCLS Fred.CBOE.VIXOnAmazon CBOE Equity VIX on Amazon (in Index)
VXOCLS Fred.CBOE.VXO CBOE S&P 100 Volatility Index: VXO (in Index)
VXNCLS Fred.CBOE.VXN CBOE NASDAQ 100 Volatility Index (in Index)
VXTYN Fred.CBOE.TenYearTreasuryNoteVolatilityFutures CBOE 10-Year Treasury Note Volatility Futures (in Index)
RVXCLS Fred.CBOE.RVX CBOE Russell 2000 Volatility Index (in Index)
VXVCLS Fred.CBOE.SP500ThreeMonthVolatilityIndex CBOE S&P 500 3-Month Volatility Index (in Index)
VXAPLCLS Fred.CBOE.VIXOnApple CBOE Equity VIX on Apple (in Index)
VXGDXCLS Fred.CBOE.GoldMinersETFVolatilityIndex CBOE Gold Miners ETF Volatility Index (in Index)
VXFXICLS Fred.CBOE.ChinaETFVolatilityIndex CBOE China ETF Volatility Index (in Index)
VXEWZCLS Fred.CBOE.BrazilETFVolatilityIndex CBOE Brazil ETF Volatility Index (in Index)
VXEEMCLS Fred.CBOE.EmergingMarketsETFVolatilityIndex CBOE Emerging Markets ETF Volatility Index (in Index)
EVZCLS Fred.CBOE.EuroCurrencyETFVolatilityIndex CBOE EuroCurrency ETF Volatility Index (in Index)
GVZCLS Fred.CBOE.GoldETFVolatilityIndex CBOE Gold ETF Volatility Index (in Index)
OVXCLS Fred.CBOE.CrudeOilETFVolatilityIndex CBOE Crude Oil ETF Volatility Index (in Index)
VXSLVCLS Fred.CBOE.SilverETFVolatilityIndex CBOE Silver ETF Volatility Index (in Index)
VXXLECLS Fred.CBOE.EnergySectorETFVolatilityIndex CBOE Energy Sector ETF Volatility Index (in Index)
VIXCLS Fred.CBOE.VIX CBOE Volatility Index: VIX (in Index)
CentralBankInterventions
JPINTDDMEJPY Fred.CentralBankInterventions.JapaneseBankPurchasesOfDmEuroAgainstJpy Japan Intervention: Japanese Bank purchases of DM/Euro against JPY (in 100 Million Yen)
JPINTDEXR Fred.CentralBankInterventions.JapaneseBankPurchasesOfUsdAgainstDm Japan Intervention: Japanese Bank purchases of USD against DM (in 100 Million Yen)
JPINTDUSDRP Fred.CentralBankInterventions.JapaneseBankPurchasesOfUsdAgainstRupiah Japan Intervention: Japanese Bank purchases of USD against Rupiah (in 100 Million Yen)
USINTDMRKTJPY Fred.CentralBankInterventions.USInterventionInMarketTransactionsInTheJpyUsd U.S. Intervention: in Market Transactions in the JPY/USD (Millions of USD) (in Millions of USD)
USINTDCSOTH Fred.CentralBankInterventions.USInterventionWithCustomerTransactionsInOtherCurrencies U.S. Intervention: With-Customer Transactions in Other Currencies (Millions of USD) (in Millions of USD)
USINTDCSJPY Fred.CentralBankInterventions.USInterventionWithCustomerTransactionsInTheJpyUsd U.S. Intervention: With-Customer Transactions in the JPY/USD (Millions of USD) (in Millions of USD)
USINTDCSDM Fred.CentralBankInterventions.USInterventionWithCustomerTransactionsInTheDemUsdEuro U.S. Intervention: With-Customer Transactions in the DEM/USD (Euro since 1999) (Millions of USD) (in Millions of USD)
USINTDMRKTOTH Fred.CentralBankInterventions.USInterventionInMarketTransactionsInOtherCurrencies U.S. Intervention: in Market Transactions in Other Currencies (Millions of USD) (in Millions of USD)
TRINTDEXR Fred.CentralBankInterventions.CentralBankOfTurkeyPurchasesOfUsd Turkish Intervention: Central Bank of Turkey Purchases of USD (Millions of USD) (in Millions of USD)
JPINTDUSDJPY Fred.CentralBankInterventions.JapaneseBankPurchasesOfUsdAgainstJpy Japan Intervention: Japanese Bank purchases of USD against JPY (in 100 Million Yen)
USINTDMRKTDM Fred.CentralBankInterventions.USInterventionInMarketTransactionsInTheDemUsdEuro U.S. Intervention: in Market Transactions in the DEM/USD (Euro since 1999) (Millions of USD) (in Millions of USD)
CHINTDCHFDM Fred.CentralBankInterventions.SwissNationalBankPurchasesOfDemAgainstChfMillionsOfDem Swiss Intervention: Swiss National Bank Purchases of DEM against CHF (Millions of DEM) (in Millions of DEM)
CHINTDUSDDM Fred.CentralBankInterventions.SwissNationalBankPurchasesOfUsdAgainstDem Swiss Intervention: Swiss National Bank Purchases of USD against DEM (Millions of USD) (in Millions of USD)
CHINTDUSDJPY Fred.CentralBankInterventions.SwissNationalBankPurchasesOfUsdAgainstJpy Swiss Intervention: Swiss National Bank Purchases of USD against JPY (Millions of USD) (in Millions of USD)
CHINTDCHFUSD Fred.CentralBankInterventions.SwissNationalBankPurchasesOfUsdAgainstChf Swiss Intervention: Swiss National Bank Purchases of USD against CHF (Millions of USD) (in Millions of USD)
MEXINTDUSD Fred.CentralBankInterventions.BancoDeMexicoPurchaseOnTheUsd Mexican Intervention: Banco de Mexico Purchase on the USD (in Millions of USD)
CommercialPaper
DCPN3M Fred.CommercialPaper.ThreeMonthAANonfinancialCommercialPaperRate 3-Month AA Nonfinancial Commercial Paper Rate (in Percent)
DCPN30 Fred.CommercialPaper.OneMonthAANonfinancialCommercialPaperRate 1-Month AA Nonfinancial Commercial Paper Rate (in Percent)
DCPN2M Fred.CommercialPaper.TwoMonthAANonfinancialCommercialPaperRate 2-Month AA Nonfinancial Commercial Paper Rate (in Percent)
DCPF3M Fred.CommercialPaper.ThreeMonthAAFinancialCommercialPaperRate 3-Month AA Financial Commercial Paper Rate (in Percent)
DCPF2M Fred.CommercialPaper.TwoMonthAAFinancialCommercialPaperRate 2-Month AA Financial Commercial Paper Rate (in Percent)
DCPF1M Fred.CommercialPaper.OneMonthAAFinancialCommercialPaperRate 1-Month AA Financial Commercial Paper Rate (in Percent)
NONFIN14A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween1and4DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
NONFIN59A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween5and9DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
NONFIN59A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween5and9DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN4180AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween41and80DaysUsedForAANonfinancial Number of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
ABGT80AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityGreaterThan80DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
NONFIN4180AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween41and80DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN4180A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween41and80DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
NONFIN4180A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween41and80DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN2140AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween21and40DaysUsedForAANonfinancial Number of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
NONFIN2140AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween21and40DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN2140A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween21and40DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
NONFIN2140A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween21and40DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN14AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween1and4DaysUsedForAANonfinancial Number of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
NONFIN1020A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween10And20DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
NONFIN1020AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween10And20DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
AB2140AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween21and40DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
NONFIN1020AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween10And20DaysUsedForAANonfinancial Number of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
NONFIN14A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween1and4DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
NONFIN14AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween1and4DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
MKT14MKTAMT Fred.CommercialPaper.TotalValueofCommercialPaperIssueswithaMaturityBetween1and4Days Total Value of Commercial Paper Issues with a Maturity Between 1 and 4 Days (in Millions of Dollars)
NONFIN1020A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween10And20DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
FINGT80AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityGreaterThan80DaysUsedForAAFinancial Number of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
FIN1020AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween10And20DaysUsedForAAFinancial Number of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
FIN14AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween1and4DaysUsedForAAFinancial Total Value of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
FIN14AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween1and4DaysUsedForAAFinancial Number of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
MKT1020MKTAMT Fred.CommercialPaper.TotalValueofCommercialPaperIssueswithaMaturityBetween10And20Days Total Value of Commercial Paper Issues with a Maturity Between 10 and 20 Days (in Millions of Dollars)
MKT1020MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityBetween10And20Days Number of Commercial Paper Issues with a Maturity Between 10 and 20 Days (in Number)
FIN2140AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween21and40DaysUsedForAAFinancial Total Value of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
MKT14MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityBetween1and4Days Number of Commercial Paper Issues with a Maturity Between 1 and 4 Days (in Number)
MKT2140MKTAMT Fred.CommercialPaper.TotalValueofIssuersofCommercialPaperwithaMaturityBetween21and40Days Total Value of Issuers of Commercial Paper with a Maturity Between 21 and 40 Days (in Millions of Dollars)
MKT2140MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityBetween21and40Days Number of Commercial Paper Issues with a Maturity Between 21 and 40 Days (in Number)
FIN2140AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween21and40DaysUsedForAAFinancial Number of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
MKT4180MKTAMT Fred.CommercialPaper.TotalValueofIssuersofCommercialPaperwithaMaturityBetween41and80Days Total Value of Issuers of Commercial Paper with a Maturity Between 41 and 80 Days (in Millions of Dollars)
NONFIN59AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween5and9DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
MKT4180MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityBetween41and80Days Number of Commercial Paper Issues with a Maturity Between 41 and 80 Days (in Number)
MKT59MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityBetween5and9Days Number of Commercial Paper Issues with a Maturity Between 5 and 9 Days (in Number)
MKTGT80MKTAMT Fred.CommercialPaper.TotalValueofIssuersofCommercialPaperwithaMaturityGreaterThan80Days Total Value of Issuers of Commercial Paper with a Maturity Greater Than 80 Days (in Millions of Dollars)
MKTGT80MKTVOL Fred.CommercialPaper.NumberofCommercialPaperIssueswithaMaturityGreaterThan80Days Number of Commercial Paper Issues with a Maturity Greater Than 80 Days (in Number)
FIN4180AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween41and80DaysUsedForAAFinancial Total Value of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
FIN4180AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween41and80DaysUsedForAAFinancial Number of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
AB4180AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween41and80DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
FIN59AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween5and9DaysUsedForAAFinancial Total Value of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
FIN59AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween5and9DaysUsedForAAFinancial Number of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Number)
FINGT80AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityGreaterThan80DaysUsedForAAFinancial Total Value of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
FIN1020AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween10And20DaysUsedForAAFinancial Total Value of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Financial Commercial Paper Rates (in Millions of Dollars)
AB2140AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween21and40DaysUsedForAAAssetBacked Number of Issues, with a Maturity Between 21 and 40 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
MKT59MKTAMT Fred.CommercialPaper.TotalValueofIssuersofCommercialPaperwithaMaturityBetween5and9Days Total Value of Issuers of Commercial Paper with a Maturity Between 5 and 9 Days (in Millions of Dollars)
ABGT80AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityGreaterThan80DaysUsedForAAAssetBacked Number of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
NONFIN59AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween5and9DaysUsedForAANonfinancial Number of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
RIFSPPAAAD15NB Fred.CommercialPaper.FifteenDayAAAssetbackedCommercialPaperInterestRate 15-Day AA Asset-backed Commercial Paper Interest Rate (in Percent)
AB59AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween5and9DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
AB4180AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween41and80DaysUsedForAAAssetBacked Number of Issues, with a Maturity Between 41 and 80 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
RIFSPPNA2P2D15NB Fred.CommercialPaper.FifteenDayA2P2NonfinancialCommercialPaperInterestRate 15-Day A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNA2P2D07NB Fred.CommercialPaper.SevenDayA2P2NonfinancialCommercialPaperInterestRate 7-Day A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNA2P2D01NB Fred.CommercialPaper.OvernightA2P2NonfinancialCommercialPaperInterestRate Overnight A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD90NB Fred.CommercialPaper.NinetyDayAAFinancialCommercialPaperInterestRate 90-Day AA Financial Commercial Paper Interest Rate (in Percent)
RIFSPPAAAD01NB Fred.CommercialPaper.OvernightAAAssetbackedCommercialPaperInterestRate Overnight AA Asset-backed Commercial Paper Interest Rate (in Percent)
RIFSPPNA2P2D30NB Fred.CommercialPaper.Three0DayA2P2NonfinancialCommercialPaperInterestRate 30-Day A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD60NB Fred.CommercialPaper.SixtyDayAAFinancialCommercialPaperInterestRate 60-Day AA Financial Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD30NB Fred.CommercialPaper.Three0DayAAFinancialCommercialPaperInterestRate 30-Day AA Financial Commercial Paper Interest Rate (in Percent)
NONFINGT80A2P2AMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityGreaterThan80DaysUsedForA2P2Nonfinancial Total Value of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Millions of Dollars)
RIFSPPAAAD30NB Fred.CommercialPaper.Three0DayAAAssetbackedCommercialPaperInterestRate 30-Day AA Asset-backed Commercial Paper Interest Rate (in Percent)
RIFSPPAAAD60NB Fred.CommercialPaper.SixtyDayAAAssetbackedCommercialPaperInterestRate 60-Day AA Asset-backed Commercial Paper Interest Rate (in Percent)
RIFSPPAAAD90NB Fred.CommercialPaper.NinetyDayAAAssetbackedCommercialPaperInterestRate 90-Day AA Asset-backed Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD15NB Fred.CommercialPaper.FifteenDayAAFinancialCommercialPaperInterestRate 15-Day AA Financial Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD07NB Fred.CommercialPaper.SevenDayAAFinancialCommercialPaperInterestRate 7-Day AA Financial Commercial Paper Interest Rate (in Percent)
RIFSPPAAAD07NB Fred.CommercialPaper.SevenDayAAAssetbackedCommercialPaperInterestRate 7-Day AA Asset-backed Commercial Paper Interest Rate (in Percent)
RIFSPPFAAD01NB Fred.CommercialPaper.OvernightAAFinancialCommercialPaperInterestRate Overnight AA Financial Commercial Paper Interest Rate (in Percent)
RIFSPPNA2P2D60NB Fred.CommercialPaper.SixtyDayA2P2NonfinancialCommercialPaperInterestRate 60-Day A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
AB59AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween5and9DaysUsedForAAAssetBacked Number of Issues, with a Maturity Between 5 and 9 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
AB14AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween1and4DaysUsedForAAAssetBacked Number of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
NONFINGT80A2P2VOL Fred.CommercialPaper.NumberOfIssuesWithMaturityGreaterThan80DaysUsedForA2P2Nonfinancial Number of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the A2/P2 Nonfinancial Commercial Paper Rates (in Number)
AB14AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween1and4DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Between 1 and 4 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
RIFSPPNA2P2D90NB Fred.CommercialPaper.NinetyDayA2P2NonfinancialCommercialPaperInterestRate 90-Day A2/P2 Nonfinancial Commercial Paper Interest Rate (in Percent)
AB1020AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityBetween10And20DaysUsedForAAAssetBacked Number of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Number)
NONFINGT80AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityGreaterThan80DaysUsedForAANonfinancial Total Value of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Millions of Dollars)
RIFSPPNAAD01NB Fred.CommercialPaper.OvernightAANonfinancialCommercialPaperInterestRate Overnight AA Nonfinancial Commercial Paper Interest Rate (in Percent)
AB1020AAAMT Fred.CommercialPaper.TotalValueOfIssuesWithMaturityBetween10And20DaysUsedForAAAssetBacked Total Value of Issues, with a Maturity Between 10 and 20 Days, Used in Calculating the AA Asset-Backed Commercial Paper Rates (in Millions of Dollars)
RIFSPPNAAD07NB Fred.CommercialPaper.SevenDayAANonfinancialCommercialPaperInterestRate 7-Day AA Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNAAD90NB Fred.CommercialPaper.NinetyDayAANonfinancialCommercialPaperInterestRate 90-Day AA Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNAAD15NB Fred.CommercialPaper.FifteenDayAANonfinancialCommercialPaperInterestRate 15-Day AA Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNAAD30NB Fred.CommercialPaper.Three0DayAANonfinancialCommercialPaperInterestRate 30-Day AA Nonfinancial Commercial Paper Interest Rate (in Percent)
RIFSPPNAAD60NB Fred.CommercialPaper.SixtyDayAANonfinancialCommercialPaperInterestRate 60-Day AA Nonfinancial Commercial Paper Interest Rate (in Percent)
NONFINGT80AAVOL Fred.CommercialPaper.NumberOfIssuesWithMaturityGreaterThan80DaysUsedForAANonfinancial Number of Issues, with a Maturity Greater Than 80 Days, Used in Calculating the AA Nonfinancial Commercial Paper Rates (in Number)
CPFF Fred.CommercialPaper.ThreeMonthCommercialPaperMinusFederalFundsRate 3-Month Commercial Paper Minus Federal Funds Rate (in Percent)
ICEBofAML
BAMLEM1BRRAAA2ACRPITRIV Fred.ICEBofAML.AAAAEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML AAA-A Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM1RAAA2ALCRPIUSTRIV Fred.ICEBofAML.AAAAUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML AAA-A US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMRACRPIASIATRIV Fred.ICEBofAML.AsiaEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Asia Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMALLCRPIASIAUSTRIV Fred.ICEBofAML.AsiaUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Asia US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM4BRRBLCRPITRIV Fred.ICEBofAML.BandLowerEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML B and Lower Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM4RBLLCRPIUSTRIV Fred.ICEBofAML.BandLowerUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML B and Lower US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM3BRRBBCRPITRIV Fred.ICEBofAML.BBEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML BB Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM3RBBLCRPIUSTRIV Fred.ICEBofAML.BBUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML BB US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM2BRRBBBCRPITRIV Fred.ICEBofAML.BBBEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML BBB Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM2RBBBLCRPIUSTRIV Fred.ICEBofAML.BBBUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML BBB US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEM5BCOCRPITRIV Fred.ICEBofAML.CrossoverEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Crossover Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMXOCOLCRPIUSTRIV Fred.ICEBofAML.CrossoverUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Crossover US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMCBPITRIV Fred.ICEBofAML.EmergingMarketsCorporatePlusIndexTotalReturnIndexValue ICE BofAML Emerging Markets Corporate Plus Index Total Return Index Value (in Index)
BAMLEMEBCRPIETRIV Fred.ICEBofAML.EuroEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Euro Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMRECRPIEMEATRIV Fred.ICEBofAML.EMEAEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Europe, the Middle East, and Africa (EMEA) Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMELLCRPIEMEAUSTRIV Fred.ICEBofAML.EMEAUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Europe, the Middle East, and Africa (EMEA) US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMFSFCRPITRIV Fred.ICEBofAML.FinancialEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Financial Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMFLFLCRPIUSTRIV Fred.ICEBofAML.FinancialUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Financial US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMIBHGCRPITRIV Fred.ICEBofAML.HighGradeEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML High Grade Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMHGHGLCRPIUSTRIV Fred.ICEBofAML.HighGradeUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML High Grade US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMHBHYCRPITRIV Fred.ICEBofAML.HighYieldEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML High Yield Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMHYHYLCRPIUSTRIV Fred.ICEBofAML.HighYieldUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML High Yield US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMRLCRPILATRIV Fred.ICEBofAML.LatinAmericaEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Latin America Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMLLLCRPILAUSTRIV Fred.ICEBofAML.LatinAmericaUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Latin America US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMNSNFCRPITRIV Fred.ICEBofAML.NonFinancialEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Non-Financial Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMNFNFLCRPIUSTRIV Fred.ICEBofAML.NonFinancialUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Non-Financial US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLC0A0CM Fred.ICEBofAML.USCorporateMasterOptionAdjustedSpread ICE BofAML US Corporate Master Option-Adjusted Spread (in Percent)
BAMLH0A0HYM2 Fred.ICEBofAML.USHighYieldMasterIIOptionAdjustedSpread ICE BofAML US High Yield Master II Option-Adjusted Spread (in Percent)
BAMLC1A0C13Y Fred.ICEBofAML.USCorporate1To3YearOptionAdjustedSpread ICE BofAML US Corporate 1-3 Year Option-Adjusted Spread (in Percent)
BAMLC7A0C1015Y Fred.ICEBofAML.USCorporate10To15YearOptionAdjustedSpread ICE BofAML US Corporate 10-15 Year Option-Adjusted Spread (in Percent)
BAMLC8A0C15PY Fred.ICEBofAML.USCorporateMoreThan15YearOptionAdjustedSpread ICE BofAML US Corporate 15+ Year Option-Adjusted Spread (in Percent)
BAMLC2A0C35Y Fred.ICEBofAML.USCorporate3To5YearOptionAdjustedSpread ICE BofAML US Corporate 3-5 Year Option-Adjusted Spread (in Percent)
BAMLC3A0C57Y Fred.ICEBofAML.USCorporate5To7YearOptionAdjustedSpread ICE BofAML US Corporate 5-7 Year Option-Adjusted Spread (in Percent)
BAMLC4A0C710Y Fred.ICEBofAML.USCorporate7To10YearOptionAdjustedSpread ICE BofAML US Corporate 7-10 Year Option-Adjusted Spread (in Percent)
BAMLEMPUPUBSLCRPIUSTRIV Fred.ICEBofAML.PublicSectorIssuersUSEmergingMarketsLiquidCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML Public Sector Issuers US Emerging Markets Liquid Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMUBCRPIUSTRIV Fred.ICEBofAML.USEmergingMarketsCorporatePlusSubIndexTotalReturnIndexValue ICE BofAML US Emerging Markets Corporate Plus Sub-Index Total Return Index Value (in Index)
BAMLEMCLLCRPIUSTRIV Fred.ICEBofAML.USEmergingMarketsLiquidCorporatePlusIndexTotalReturnIndexValue ICE BofAML US Emerging Markets Liquid Corporate Plus Index Total Return Index Value (in Index)
BAMLHE00EHYITRIV Fred.ICEBofAML.EuroHighYieldIndexTotalReturnIndexValue ICE BofAML Euro High Yield Index Total Return Index Value (in Index)
BAMLCC1A013YTRIV Fred.ICEBofAML.USCorp1To3YearsTotalReturnIndexValue ICE BofAML US Corp 1-3yr Total Return Index Value (in Index)
BAMLCC7A01015YTRIV Fred.ICEBofAML.USCorp10To15TotalReturnIndexValue ICE BofAML US Corp 10-15yr Total Return Index Value (in Index)
BAMLCC8A015PYTRIV Fred.ICEBofAML.USCorpMoreThan15YearsTotalReturnIndexValue ICE BofAML US Corp 15+yr Total Return Index Value (in Index)
BAMLCC2A035YTRIV Fred.ICEBofAML.USCorpeTo5YearsTotalReturnIndexValue ICE BofAML US Corp 3-5yr Total Return Index Value (in Index)
BAMLCC3A057YTRIV Fred.ICEBofAML.USCorp5To7YearsTotalReturnIndexValue ICE BofAML US Corp 5-7yr Total Return Index Value (in Index)
BAMLCC4A0710YTRIV Fred.ICEBofAML.USCorporate7To10YearsTotalReturnIndexValue ICE BofAML US Corporate 7-10yr Total Return Index Value (in Index)
BAMLCC0A3ATRIV Fred.ICEBofAML.USCorpATotalReturnIndexValue ICE BofAML US Corp A Total Return Index Value (in Index)
BAMLCC0A2AATRIV Fred.ICEBofAML.USCorpAATotalReturnIndexValue ICE BofAML US Corp AA Total Return Index Value (in Index)
BAMLCC0A1AAATRIV Fred.ICEBofAML.USCorpAAATotalReturnIndexValue ICE BofAML US Corp AAA Total Return Index Value (in Index)
BAMLHYH0A2BTRIV Fred.ICEBofAML.USHighYieldBTotalReturnIndexValue ICE BofAML US High Yield B Total Return Index Value (in Index)
BAMLHYH0A1BBTRIV Fred.ICEBofAML.USHighYieldBBTotalReturnIndexValue ICE BofAML US High Yield BB Total Return Index Value (in Index)
BAMLCC0A4BBBTRIV Fred.ICEBofAML.USCorpBBBTotalReturnIndexValue ICE BofAML US Corp BBB Total Return Index Value (in Index)
BAMLHYH0A3CMTRIV Fred.ICEBofAML.USHighYieldCCCorBelowTotalReturnIndexValue ICE BofAML US High Yield CCC or Below Total Return Index Value (in Index)
BAMLCC0A0CMTRIV Fred.ICEBofAML.USCorpMasterTotalReturnIndexValue ICE BofAML US Corp Master Total Return Index Value (in Index)
BAMLHYH0A0HYM2TRIV Fred.ICEBofAML.USHighYieldMasterIITotalReturnIndexValue ICE BofAML US High Yield Master II Total Return Index Value (in Index)
BAMLEM1BRRAAA2ACRPIOAS Fred.ICEBofAML.AAAAEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML AAA-A Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM1RAAA2ALCRPIUSOAS Fred.ICEBofAML.AAAAUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML AAA-A US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMRACRPIASIAOAS Fred.ICEBofAML.AsiaEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Asia Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMALLCRPIASIAUSOAS Fred.ICEBofAML.AsiaUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Asia US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM4BRRBLCRPIOAS Fred.ICEBofAML.BandLowerEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML B and Lower Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM4RBLLCRPIUSOAS Fred.ICEBofAML.BandLowerUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML B and Lower US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM3BRRBBCRPIOAS Fred.ICEBofAML.BBEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML BB Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM3RBBLCRPIUSOAS Fred.ICEBofAML.BBUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML BB US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM2BRRBBBCRPIOAS Fred.ICEBofAML.BBBEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML BBB Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM2RBBBLCRPIUSOAS Fred.ICEBofAML.BBBUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML BBB US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEM5BCOCRPIOAS Fred.ICEBofAML.CrossoverEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Crossover Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMXOCOLCRPIUSOAS Fred.ICEBofAML.CrossoverUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Crossover US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMCBPIOAS Fred.ICEBofAML.EmergingMarketsCorporatePlusIndexOptionAdjustedSpread ICE BofAML Emerging Markets Corporate Plus Index Option-Adjusted Spread (in Percent)
BAMLEMEBCRPIEOAS Fred.ICEBofAML.EuroEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Euro Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMRECRPIEMEAOAS Fred.ICEBofAML.EMEAEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Europe, the Middle East, and Africa (EMEA) Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMELLCRPIEMEAUSOAS Fred.ICEBofAML.EMEAUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Europe, the Middle East, and Africa (EMEA) US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMFSFCRPIOAS Fred.ICEBofAML.FinancialEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Financial Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMFLFLCRPIUSOAS Fred.ICEBofAML.FinancialUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Financial US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMIBHGCRPIOAS Fred.ICEBofAML.HighGradeEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML High Grade Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMHGHGLCRPIUSOAS Fred.ICEBofAML.HighGradeUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML High Grade US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMHBHYCRPIOAS Fred.ICEBofAML.HighYieldEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML High Yield Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMHYHYLCRPIUSOAS Fred.ICEBofAML.HighYieldUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML High Yield US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMRLCRPILAOAS Fred.ICEBofAML.LatinAmericaEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Latin America Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMLLLCRPILAUSOAS Fred.ICEBofAML.LatinAmericaUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Latin America US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMNSNFCRPIOAS Fred.ICEBofAML.NonFinancialEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Non-Financial Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMNFNFLCRPIUSOAS Fred.ICEBofAML.NonFinancialUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Non-Financial US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMPUPUBSLCRPIUSOAS Fred.ICEBofAML.PublicSectorIssuersUSEmergingMarketsLiquidCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML Public Sector Issuers US Emerging Markets Liquid Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMUBCRPIUSOAS Fred.ICEBofAML.USEmergingMarketsCorporatePlusSubIndexOptionAdjustedSpread ICE BofAML US Emerging Markets Corporate Plus Sub-Index Option-Adjusted Spread (in Percent)
BAMLEMCLLCRPIUSOAS Fred.ICEBofAML.USEmergingMarketsLiquidCorporatePlusIndexOptionAdjustedSpread ICE BofAML US Emerging Markets Liquid Corporate Plus Index Option-Adjusted Spread (in Percent)
BAMLHE00EHYIOAS Fred.ICEBofAML.EuroHighYieldIndexOptionAdjustedSpread ICE BofAML Euro High Yield Index Option-Adjusted Spread (in Percent)
BAMLC0A3CA Fred.ICEBofAML.USCorporateAOptionAdjustedSpread ICE BofAML US Corporate A Option-Adjusted Spread (in Percent)
BAMLC0A2CAA Fred.ICEBofAML.USCorporateAAOptionAdjustedSpread ICE BofAML US Corporate AA Option-Adjusted Spread (in Percent)
BAMLC0A1CAAA Fred.ICEBofAML.USCorporateAAAOptionAdjustedSpread ICE BofAML US Corporate AAA Option-Adjusted Spread (in Percent)
BAMLH0A2HYB Fred.ICEBofAML.USHighYieldBOptionAdjustedSpread ICE BofAML US High Yield B Option-Adjusted Spread (in Percent)
BAMLH0A1HYBB Fred.ICEBofAML.USHighYieldBBOptionAdjustedSpread ICE BofAML US High Yield BB Option-Adjusted Spread (in Percent)
BAMLC0A4CBBB Fred.ICEBofAML.USCorporateBBBOptionAdjustedSpread ICE BofAML US Corporate BBB Option-Adjusted Spread (in Percent)
BAMLH0A3HYC Fred.ICEBofAML.USHighYieldCCCorBelowOptionAdjustedSpread ICE BofAML US High Yield CCC or Below Option-Adjusted Spread (in Percent)
BAMLEM1BRRAAA2ACRPIEY Fred.ICEBofAML.AAAAEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML AAA-A Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM1RAAA2ALCRPIUSEY Fred.ICEBofAML.AAAAUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML AAA-A US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMRACRPIASIAEY Fred.ICEBofAML.AsiaEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Asia Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMALLCRPIASIAUSEY Fred.ICEBofAML.AsiaUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Asia US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM4BRRBLCRPIEY Fred.ICEBofAML.BandLowerEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML B and Lower Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM4RBLLCRPIUSEY Fred.ICEBofAML.BandLowerUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML B and Lower US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM3BRRBBCRPIEY Fred.ICEBofAML.BBEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML BB Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM3RBBLCRPIUSEY Fred.ICEBofAML.BBUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML BB US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM2BRRBBBCRPIEY Fred.ICEBofAML.BBBEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML BBB Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM2RBBBLCRPIUSEY Fred.ICEBofAML.BBBUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML BBB US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEM5BCOCRPIEY Fred.ICEBofAML.CrossoverEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Crossover Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMXOCOLCRPIUSEY Fred.ICEBofAML.CrossoverUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Crossover US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMCBPIEY Fred.ICEBofAML.EmergingMarketsCorporatePlusIndexEffectiveYield ICE BofAML Emerging Markets Corporate Plus Index Effective Yield (in Percent)
BAMLEMEBCRPIEEY Fred.ICEBofAML.EuroEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Euro Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLHE00EHYIEY Fred.ICEBofAML.EuroHighYieldIndexEffectiveYield ICE BofAML Euro High Yield Index Effective Yield (in Percent)
BAMLEMRECRPIEMEAEY Fred.ICEBofAML.EMEAEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Europe, the Middle East, and Africa (EMEA) Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMELLCRPIEMEAUSEY Fred.ICEBofAML.EMEAUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Europe, the Middle East, and Africa (EMEA) US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMFSFCRPIEY Fred.ICEBofAML.FinancialEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Financial Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMFLFLCRPIUSEY Fred.ICEBofAML.FinancialUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Financial US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMIBHGCRPIEY Fred.ICEBofAML.HighGradeEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML High Grade Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMHGHGLCRPIUSEY Fred.ICEBofAML.HighGradeUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML High Grade US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMHBHYCRPIEY Fred.ICEBofAML.HighYieldEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML High Yield Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMHYHYLCRPIUSEY Fred.ICEBofAML.HighYieldUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML High Yield US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMRLCRPILAEY Fred.ICEBofAML.LatinAmericaEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Latin America Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMLLLCRPILAUSEY Fred.ICEBofAML.LatinAmericaUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Latin America US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMNSNFCRPIEY Fred.ICEBofAML.NonFinancialEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML Non-Financial Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMNFNFLCRPIUSEY Fred.ICEBofAML.NonFinancialUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Non-Financial US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMPUPUBSLCRPIUSEY Fred.ICEBofAML.PublicSectorIssuersUSEmergingMarketsLiquidCorporatePlusSubIndexEffectiveYield ICE BofAML Public Sector Issuers US Emerging Markets Liquid Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLC1A0C13YEY Fred.ICEBofAML.USCorporate1ThreeYearEffectiveYield ICE BofAML US Corporate 1-3 Year Effective Yield (in Percent)
BAMLC7A0C1015YEY Fred.ICEBofAML.USCorporate10To15YearEffectiveYield ICE BofAML US Corporate 10-15 Year Effective Yield (in Percent)
BAMLC8A0C15PYEY Fred.ICEBofAML.USCorporateMoreThan15YearEffectiveYield ICE BofAML US Corporate 15+ Year Effective Yield (in Percent)
BAMLC2A0C35YEY Fred.ICEBofAML.USCorporate3To5YearEffectiveYield ICE BofAML US Corporate 3-5 Year Effective Yield (in Percent)
BAMLC3A0C57YEY Fred.ICEBofAML.USCorporate5To7YearEffectiveYield ICE BofAML US Corporate 5-7 Year Effective Yield (in Percent)
BAMLC4A0C710YEY Fred.ICEBofAML.USCorporate7To10YearEffectiveYield ICE BofAML US Corporate 7-10 Year Effective Yield (in Percent)
BAMLC0A3CAEY Fred.ICEBofAML.USCorporateAEffectiveYield ICE BofAML US Corporate A Effective Yield (in Percent)
BAMLC0A2CAAEY Fred.ICEBofAML.USCorporateAAEffectiveYield ICE BofAML US Corporate AA Effective Yield (in Percent)
BAMLC0A1CAAAEY Fred.ICEBofAML.USCorporateAAAEffectiveYield ICE BofAML US Corporate AAA Effective Yield (in Percent)
BAMLH0A2HYBEY Fred.ICEBofAML.USHighYieldBEffectiveYield ICE BofAML US High Yield B Effective Yield (in Percent)
BAMLH0A1HYBBEY Fred.ICEBofAML.USHighYieldBBEffectiveYield ICE BofAML US High Yield BB Effective Yield (in Percent)
BAMLC0A4CBBBEY Fred.ICEBofAML.USCorporateBBBEffectiveYield ICE BofAML US Corporate BBB Effective Yield (in Percent)
BAMLH0A3HYCEY Fred.ICEBofAML.USHighYieldCCCorBelowEffectiveYield ICE BofAML US High Yield CCC or Below Effective Yield (in Percent)
BAMLC0A0CMEY Fred.ICEBofAML.USCorporateMasterEffectiveYield ICE BofAML US Corporate Master Effective Yield (in Percent)
BAMLEMUBCRPIUSEY Fred.ICEBofAML.USEmergingMarketsCorporatePlusSubIndexEffectiveYield ICE BofAML US Emerging Markets Corporate Plus Sub-Index Effective Yield (in Percent)
BAMLEMCLLCRPIUSEY Fred.ICEBofAML.USEmergingMarketsLiquidCorporatePlusIndexEffectiveYield ICE BofAML US Emerging Markets Liquid Corporate Plus Index Effective Yield (in Percent)
BAMLH0A0HYM2EY Fred.ICEBofAML.USHighYieldMasterIIEffectiveYield ICE BofAML US High Yield Master II Effective Yield (in Percent)
BAMLEM1BRRAAA2ACRPISYTW Fred.ICEBofAML.AAAAEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML AAA-A Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM1RAAA2ALCRPIUSSYTW Fred.ICEBofAML.AAAAUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML AAA-A US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMRACRPIASIASYTW Fred.ICEBofAML.AsiaEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Asia Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMALLCRPIASIAUSSYTW Fred.ICEBofAML.AsiaUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Asia US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM4BRRBLCRPISYTW Fred.ICEBofAML.BandLowerEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML B and Lower Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM4RBLLCRPIUSSYTW Fred.ICEBofAML.BandLowerUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML B and Lower US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM3BRRBBCRPISYTW Fred.ICEBofAML.BBEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML BB Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM3RBBLCRPIUSSYTW Fred.ICEBofAML.BBUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML BB US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM2BRRBBBCRPISYTW Fred.ICEBofAML.BBBEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML BBB Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM2RBBBLCRPIUSSYTW Fred.ICEBofAML.BBBUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML BBB US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEM5BCOCRPISYTW Fred.ICEBofAML.CrossoverEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Crossover Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMXOCOLCRPIUSSYTW Fred.ICEBofAML.CrossoverUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Crossover US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMCBPISYTW Fred.ICEBofAML.EmergingMarketsCorporatePlusIndexSemiAnnualYieldtoWorst ICE BofAML Emerging Markets Corporate Plus Index Semi-Annual Yield to Worst (in Percent)
BAMLEMEBCRPIESYTW Fred.ICEBofAML.EuroEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Euro Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLHE00EHYISYTW Fred.ICEBofAML.EuroHighYieldIndexSemiAnnualYieldtoWorst ICE BofAML Euro High Yield Index Semi-Annual Yield to Worst (in Percent)
BAMLEMRECRPIEMEASYTW Fred.ICEBofAML.EMEAEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Europe, the Middle East, and Africa (EMEA) Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMELLCRPIEMEAUSSYTW Fred.ICEBofAML.EMEAUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Europe, the Middle East, and Africa (EMEA) US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMFSFCRPISYTW Fred.ICEBofAML.FinancialEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Financial Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMFLFLCRPIUSSYTW Fred.ICEBofAML.FinancialUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Financial US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMIBHGCRPISYTW Fred.ICEBofAML.HighGradeEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML High Grade Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMHGHGLCRPIUSSYTW Fred.ICEBofAML.HighGradeUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML High Grade US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMHBHYCRPISYTW Fred.ICEBofAML.HighYieldEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML High Yield Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMHYHYLCRPIUSSYTW Fred.ICEBofAML.HighYieldUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML High Yield US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMRLCRPILASYTW Fred.ICEBofAML.LatinAmericaEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Latin America Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMLLLCRPILAUSSYTW Fred.ICEBofAML.LatinAmericaUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Latin America US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMNSNFCRPISYTW Fred.ICEBofAML.NonFinancialEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Non-Financial Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMNFNFLCRPIUSSYTW Fred.ICEBofAML.NonFinancialUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Non-Financial US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMPTPRVICRPISYTW Fred.ICEBofAML.PrivateSectorIssuersEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Private Sector Issuers Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMPVPRIVSLCRPIUSSYTW Fred.ICEBofAML.PrivateSectorIssuersUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Private Sector Issuers US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMPBPUBSICRPISYTW Fred.ICEBofAML.PublicSectorIssuersEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Public Sector Issuers Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMPUPUBSLCRPIUSSYTW Fred.ICEBofAML.PublicSectorIssuersUSEmergingMarketsLiquidCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML Public Sector Issuers US Emerging Markets Liquid Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLC1A0C13YSYTW Fred.ICEBofAML.USCorporate1To3YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 1-3 Year Semi-Annual Yield to Worst (in Percent)
BAMLC7A0C1015YSYTW Fred.ICEBofAML.USCorporate10To15YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 10-15 Year Semi-Annual Yield to Worst (in Percent)
BAMLC8A0C15PYSYTW Fred.ICEBofAML.USCorporateMoreThan15YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 15+ Year Semi-Annual Yield to Worst (in Percent)
BAMLC2A0C35YSYTW Fred.ICEBofAML.USCorporate3To5YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 3-5 Year Semi-Annual Yield to Worst (in Percent)
BAMLC3A0C57YSYTW Fred.ICEBofAML.USCorporate5To7YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 5-7 Year Semi-Annual Yield to Worst (in Percent)
BAMLC4A0C710YSYTW Fred.ICEBofAML.USCorporate7To10YearSemiAnnualYieldtoWorst ICE BofAML US Corporate 7-10 Year Semi-Annual Yield to Worst (in Percent)
BAMLC0A3CASYTW Fred.ICEBofAML.USCorporateASemiAnnualYieldtoWorst ICE BofAML US Corporate A Semi-Annual Yield to Worst (in Percent)
BAMLC0A2CAASYTW Fred.ICEBofAML.USCorporateAASemiAnnualYieldtoWorst ICE BofAML US Corporate AA Semi-Annual Yield to Worst (in Percent)
BAMLC0A1CAAASYTW Fred.ICEBofAML.USCorporateAAASemiAnnualYieldtoWorst ICE BofAML US Corporate AAA Semi-Annual Yield to Worst (in Percent)
BAMLH0A2HYBSYTW Fred.ICEBofAML.USHighYieldBSemiAnnualYieldtoWorst ICE BofAML US High Yield B Semi-Annual Yield to Worst (in Percent)
BAMLH0A1HYBBSYTW Fred.ICEBofAML.USHighYieldBBSemiAnnualYieldtoWorst ICE BofAML US High Yield BB Semi-Annual Yield to Worst (in Percent)
BAMLC0A4CBBBSYTW Fred.ICEBofAML.USCorporateBBBSemiAnnualYieldtoWorst ICE BofAML US Corporate BBB Semi-Annual Yield to Worst (in Percent)
BAMLH0A3HYCSYTW Fred.ICEBofAML.USHighYieldCCCorBelowSemiAnnualYieldtoWorst ICE BofAML US High Yield CCC or Below Semi-Annual Yield to Worst (in Percent)
BAMLC0A0CMSYTW Fred.ICEBofAML.USCorporateMasterSemiAnnualYieldtoWorst ICE BofAML US Corporate Master Semi-Annual Yield to Worst (in Percent)
BAMLEMUBCRPIUSSYTW Fred.ICEBofAML.USEmergingMarketsCorporatePlusSubIndexSemiAnnualYieldtoWorst ICE BofAML US Emerging Markets Corporate Plus Sub-Index Semi-Annual Yield to Worst (in Percent)
BAMLEMCLLCRPIUSSYTW Fred.ICEBofAML.USEmergingMarketsLiquidCorporatePlusIndexSemiAnnualYieldtoWorst ICE BofAML US Emerging Markets Liquid Corporate Plus Index Semi-Annual Yield to Worst (in Percent)
BAMLH0A0HYM2SYTW Fred.ICEBofAML.USHighYieldMasterIISemiAnnualYieldtoWorst ICE BofAML US High Yield Master II Semi-Annual Yield to Worst (in Percent)
LIBOR
CHFONTD156N Fred.LIBOR.SpotNextBasedOnSwissFranc Spot Next London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
JPYONTD156N Fred.LIBOR.SpotNextBasedOnJapaneseYen Spot Next London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
JPY6MTD156N Fred.LIBOR.SixMonthBasedOnJapaneseYen 6-Month London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
JPY3MTD156N Fred.LIBOR.ThreeMonthBasedOnJapaneseYen 3-Month London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
USD6MTD156N Fred.LIBOR.SixMonthBasedOnUSD 6-Month London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
JPY1MTD156N Fred.LIBOR.OneMonthBasedOnJapaneseYen 1-Month London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
JPY12MD156N Fred.LIBOR.TwelveMonthBasedOnJapaneseYen 12-Month London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
GBP12MD156N Fred.LIBOR.TwelveMonthBasedOnBritishPound 12-Month London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
GBP1MTD156N Fred.LIBOR.OneMonthBasedOnBritishPound 1-Month London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
GBP1WKD156N Fred.LIBOR.OneWeekBasedOnBritishPound 1-Week London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
GBP2MTD156N Fred.LIBOR.TwoMonthBasedOnBritishPound 2-Month London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
GBP3MTD156N Fred.LIBOR.ThreeMonthBasedOnBritishPound 3-Month London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
JPY1WKD156N Fred.LIBOR.OneWeekBasedOnJapaneseYen 1-Week London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
JPY2MTD156N Fred.LIBOR.TwoMonthBasedOnJapaneseYen 2-Month London Interbank Offered Rate (LIBOR), based on Japanese Yen (in Percent)
CHF6MTD156N Fred.LIBOR.SixMonthBasedOnSwissFranc 6-Month London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
CHF3MTD156N Fred.LIBOR.ThreeMonthBasedOnSwissFranc 3-Month London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
USD1MTD156N Fred.LIBOR.OneMonthBasedOnUSD 1-Month London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
CHF12MD156N Fred.LIBOR.TwelveMonthBasedOnSwissFranc 12-Month London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
USD12MD156N Fred.LIBOR.TwelveMonthBasedOnUSD 12-Month London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
CHF1MTD156N Fred.LIBOR.OneMonthBasedOnSwissFranc 1-Month London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
CHF1WKD156N Fred.LIBOR.OneWeekBasedOnSwissFranc 1-Week London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
CHF2MTD156N Fred.LIBOR.TwoMonthBasedOnSwissFranc 2-Month London Interbank Offered Rate (LIBOR), based on Swiss Franc (in Percent)
EUR12MD156N Fred.LIBOR.TwelveMonthBasedOnEuro 12-Month London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
GBP6MTD156N Fred.LIBOR.SixMonthBasedOnBritishPound 6-Month London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
EUR1MTD156N Fred.LIBOR.OneMonthBasedOnEuro 1-Month London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
EUR2MTD156N Fred.LIBOR.TwoMonthBasedOnEuro 2-Month London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
EUR3MTD156N Fred.LIBOR.ThreeMonthBasedOnEuro 3-Month London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
EUR6MTD156N Fred.LIBOR.SixMonthBasedOnEuro 6-Month London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
EURONTD156N Fred.LIBOR.OvernightBasedOnEuro Overnight London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
USD1WKD156N Fred.LIBOR.OneWeekBasedOnUSD 1-Week London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
USD2MTD156N Fred.LIBOR.TwoMonthBasedOnUSD 2-Month London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
USD3MTD156N Fred.LIBOR.ThreeMonthBasedOnUSD 3-Month London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
USDONTD156N Fred.LIBOR.OvernightBasedOnUSD Overnight London Interbank Offered Rate (LIBOR), based on U.S. Dollar (in Percent)
EUR1WKD156N Fred.LIBOR.OneWeekBasedOnEuro 1-Week London Interbank Offered Rate (LIBOR), based on Euro (in Percent)
GBPONTD156N Fred.LIBOR.OvernightBasedOnBritishPound Overnight London Interbank Offered Rate (LIBOR), based on British Pound (in Percent)
OECDRecessionIndicators
4BIGEURORECDM Fred.OECDRecessionIndicators.FourBigEuropeanCountriesFromPeakThroughTheTrough OECD based Recession Indicators for Four Big European Countries from the Peak through the Trough (in +1 or 0)
AUSRECDM Fred.OECDRecessionIndicators.AustraliaFromPeakThroughTheTrough OECD based Recession Indicators for Australia from the Peak through the Trough (in +1 or 0)
AUTRECDM Fred.OECDRecessionIndicators.AustriaFromPeakThroughTheTrough OECD based Recession Indicators for Austria from the Peak through the Trough (in +1 or 0)
BELRECDM Fred.OECDRecessionIndicators.BelgiumFromPeakThroughTheTrough OECD based Recession Indicators for Belgium from the Peak through the Trough (in +1 or 0)
BRARECDM Fred.OECDRecessionIndicators.BrazilFromPeakThroughTheTrough OECD based Recession Indicators for Brazil from the Peak through the Trough (in +1 or 0)
CANRECDM Fred.OECDRecessionIndicators.CanadaFromPeakThroughTheTrough OECD based Recession Indicators for Canada from the Peak through the Trough (in +1 or 0)
CHERECDM Fred.OECDRecessionIndicators.SwitzerlandFromPeakThroughTheTrough OECD based Recession Indicators for Switzerland from the Peak through the Trough (in +1 or 0)
CHLRECDM Fred.OECDRecessionIndicators.ChileFromPeakThroughTheTrough OECD based Recession Indicators for Chile from the Peak through the Trough (in +1 or 0)
CHNRECDM Fred.OECDRecessionIndicators.ChinaFromPeakThroughTheTrough OECD based Recession Indicators for China from the Peak through the Trough (in +1 or 0)
CZERECDM Fred.OECDRecessionIndicators.CzechRepublicFromPeakThroughTheTrough OECD based Recession Indicators for the Czech Republic from the Peak through the Trough (in +1 or 0)
DEURECDM Fred.OECDRecessionIndicators.GermanyFromPeakThroughTheTrough OECD based Recession Indicators for Germany from the Peak through the Trough (in +1 or 0)
DNKRECDM Fred.OECDRecessionIndicators.DenmarkFromPeakThroughTheTrough OECD based Recession Indicators for Denmark from the Peak through the Trough (in +1 or 0)
ESPRECDM Fred.OECDRecessionIndicators.SpainFromPeakThroughTheTrough OECD based Recession Indicators for Spain from the Peak through the Trough (in +1 or 0)
ESTRECDM Fred.OECDRecessionIndicators.EstoniaFromPeakThroughTheTrough OECD based Recession Indicators for Estonia from the Peak through the Trough (in +1 or 0)
EURORECDM Fred.OECDRecessionIndicators.EuroAreaFromPeakThroughTheTrough OECD based Recession Indicators for Euro Area from the Peak through the Trough (in +1 or 0)
FINRECDM Fred.OECDRecessionIndicators.FinlandFromPeakThroughTheTrough OECD based Recession Indicators for Finland from the Peak through the Trough (in +1 or 0)
FRARECDM Fred.OECDRecessionIndicators.FranceFromPeakThroughTheTrough OECD based Recession Indicators for France from the Peak through the Trough (in +1 or 0)
GBRRECDM Fred.OECDRecessionIndicators.UnitedKingdomFromPeakThroughTheTrough OECD based Recession Indicators for the United Kingdom from the Peak through the Trough (in +1 or 0)
GRCRECDM Fred.OECDRecessionIndicators.GreeceFromPeakThroughTheTrough OECD based Recession Indicators for Greece from the Peak through the Trough (in +1 or 0)
HUNRECDM Fred.OECDRecessionIndicators.HungaryFromPeakThroughTheTrough OECD based Recession Indicators for Hungary from the Peak through the Trough (in +1 or 0)
IDNRECDM Fred.OECDRecessionIndicators.IndonesiaFromPeakThroughTheTrough OECD based Recession Indicators for Indonesia from the Peak through the Trough (in +1 or 0)
INDRECDM Fred.OECDRecessionIndicators.IndiaFromPeakThroughTheTrough OECD based Recession Indicators for India from the Peak through the Trough (in +1 or 0)
IRLRECDM Fred.OECDRecessionIndicators.IrelandFromPeakThroughTheTrough OECD based Recession Indicators for Ireland from the Peak through the Trough (in +1 or 0)
ISRRECDM Fred.OECDRecessionIndicators.IsraelFromPeakThroughTheTrough OECD based Recession Indicators for Israel from the Peak through the Trough (in +1 or 0)
ITARECDM Fred.OECDRecessionIndicators.ItalyFromPeakThroughTheTrough OECD based Recession Indicators for Italy from the Peak through the Trough (in +1 or 0)
JPNRECDM Fred.OECDRecessionIndicators.JapanFromPeakThroughTheTrough OECD based Recession Indicators for Japan from the Peak through the Trough (in +1 or 0)
KORRECDM Fred.OECDRecessionIndicators.KoreaFromPeakThroughTheTrough OECD based Recession Indicators for Korea from the Peak through the Trough (in +1 or 0)
LUXRECDM Fred.OECDRecessionIndicators.LuxembourgFromPeakThroughTheTrough OECD based Recession Indicators for Luxembourg from the Peak through the Trough (in +1 or 0)
MAJOR5ASIARECDM Fred.OECDRecessionIndicators.MajorFiveAsiaFromPeakThroughTheTrough OECD based Recession Indicators for Major 5 Asia from the Peak through the Trough (in +1 or 0)
MEXRECDM Fred.OECDRecessionIndicators.MexicoFromPeakThroughTheTrough OECD based Recession Indicators for Mexico from the Peak through the Trough (in +1 or 0)
MSCRECDM Fred.OECDRecessionIndicators.MajorSevenCountriesFromPeakThroughTheTrough OECD based Recession Indicators for Major Seven Countries from the Peak through the Trough (in +1 or 0)
NAFTARECDM Fred.OECDRecessionIndicators.NAFTAAreaFromPeakThroughTheTrough OECD based Recession Indicators for NAFTA Area from the Peak through the Trough (in +1 or 0)
NDLRECDM Fred.OECDRecessionIndicators.NetherlandsFromPeakThroughTheTrough OECD based Recession Indicators for Netherlands from the Peak through the Trough (in +1 or 0)
NORRECDM Fred.OECDRecessionIndicators.NorwayFromPeakThroughTheTrough OECD based Recession Indicators for Norway from the Peak through the Trough (in +1 or 0)
NZLRECDM Fred.OECDRecessionIndicators.NewZealandFromPeakThroughTheTrough OECD based Recession Indicators for New Zealand from the Peak through the Trough (in +1 or 0)
OECDEUROPERECDM Fred.OECDRecessionIndicators.OECDEuropeFromPeakThroughTheTrough OECD based Recession Indicators for OECD Europe from the Peak through the Trough (in +1 or 0)
OECDNMERECDM Fred.OECDRecessionIndicators.OECDAndNonmemberEconomiesFromPeakThroughTheTrough OECD based Recession Indicators for OECD and Non-member Economies from the Peak through the Trough (in +1 or 0)
OECDRECDM Fred.OECDRecessionIndicators.OECDTotalAreaFromPeakThroughTheTrough OECD based Recession Indicators for the OECD Total Area from the Peak through the Trough (in +1 or 0)
POLRECDM Fred.OECDRecessionIndicators.PolandFromPeakThroughTheTrough OECD based Recession Indicators for Poland from the Peak through the Trough (in +1 or 0)
PRTRECDM Fred.OECDRecessionIndicators.PortugalFromPeakThroughTheTrough OECD based Recession Indicators for Portugal from the Peak through the Trough (in +1 or 0)
RUSRECDM Fred.OECDRecessionIndicators.RussianFederationFromPeakThroughTheTrough OECD based Recession Indicators for Russian Federation from the Peak through the Trough (in +1 or 0)
SVKRECDM Fred.OECDRecessionIndicators.SlovakRepublicFromPeakThroughTheTrough OECD based Recession Indicators for the Slovak Republic from the Peak through the Trough (in +1 or 0)
SVNRECDM Fred.OECDRecessionIndicators.SloveniaFromPeakThroughTheTrough OECD based Recession Indicators for Slovenia from the Peak through the Trough (in +1 or 0)
SWERECDM Fred.OECDRecessionIndicators.SwedenFromPeakThroughTheTrough OECD based Recession Indicators for Sweden from the Peak through the Trough (in +1 or 0)
TURRECDM Fred.OECDRecessionIndicators.TurkeyFromPeakThroughTheTrough OECD based Recession Indicators for Turkey from the Peak through the Trough (in +1 or 0)
USARECDM Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough OECD based Recession Indicators for the United States from the Peak through the Trough (in +1 or 0)
ZAFRECDM Fred.OECDRecessionIndicators.SouthAfricaFromPeakThroughTheTrough OECD based Recession Indicators for South Africa from the Peak through the Trough (in +1 or 0)
4BIGEURORECD Fred.OECDRecessionIndicators.FourBigEuropeanCountriesFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Four Big European Countries from the Period following the Peak through the Trough (in +1 or 0)
AUSRECD Fred.OECDRecessionIndicators.AustraliaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Australia from the Period following the Peak through the Trough (in +1 or 0)
AUTRECD Fred.OECDRecessionIndicators.AustriaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Austria from the Period following the Peak through the Trough (in +1 or 0)
BELRECD Fred.OECDRecessionIndicators.BelgiumFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Belgium from the Period following the Peak through the Trough (in +1 or 0)
BRARECD Fred.OECDRecessionIndicators.BrazilFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Brazil from the Period following the Peak through the Trough (in +1 or 0)
CANRECD Fred.OECDRecessionIndicators.CanadaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Canada from the Period following the Peak through the Trough (in +1 or 0)
CHERECD Fred.OECDRecessionIndicators.SwitzerlandFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Switzerland from the Period following the Peak through the Trough (in +1 or 0)
CHLRECD Fred.OECDRecessionIndicators.ChileFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Chile from the Period following the Peak through the Trough (in +1 or 0)
CHNRECD Fred.OECDRecessionIndicators.ChinaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for China from the Period following the Peak through the Trough (in +1 or 0)
CZERECD Fred.OECDRecessionIndicators.CzechRepublicFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for the Czech Republic from the Period following the Peak through the Trough (in +1 or 0)
DEURECD Fred.OECDRecessionIndicators.GermanyFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Germany from the Period following the Peak through the Trough (in +1 or 0)
DNKRECD Fred.OECDRecessionIndicators.DenmarkFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Denmark from the Period following the Peak through the Trough (in +1 or 0)
ESPRECD Fred.OECDRecessionIndicators.SpainFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Spain from the Period following the Peak through the Trough (in +1 or 0)
ESTRECD Fred.OECDRecessionIndicators.EstoniaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Estonia from the Period following the Peak through the Trough (in +1 or 0)
EURORECD Fred.OECDRecessionIndicators.EuroAreaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Euro Area from the Period following the Peak through the Trough (in +1 or 0)
FINRECD Fred.OECDRecessionIndicators.FinlandFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Finland from the Period following the Peak through the Trough (in +1 or 0)
FRARECD Fred.OECDRecessionIndicators.FranceFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for France from the Period following the Peak through the Trough (in +1 or 0)
GBRRECD Fred.OECDRecessionIndicators.UnitedKingdomFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for the United Kingdom from the Period following the Peak through the Trough (in +1 or 0)
GRCRECD Fred.OECDRecessionIndicators.GreeceFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Greece from the Period following the Peak through the Trough (in +1 or 0)
HUNRECD Fred.OECDRecessionIndicators.HungaryFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Hungary from the Period following the Peak through the Trough (in +1 or 0)
IDNRECD Fred.OECDRecessionIndicators.IndonesiaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Indonesia from the Period following the Peak through the Trough (in +1 or 0)
INDRECD Fred.OECDRecessionIndicators.IndiaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for India from the Period following the Peak through the Trough (in +1 or 0)
IRLRECD Fred.OECDRecessionIndicators.IrelandFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Ireland from the Period following the Peak through the Trough (in +1 or 0)
ISRRECD Fred.OECDRecessionIndicators.IsraelFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Israel from the Period following the Peak through the Trough (in +1 or 0)
ITARECD Fred.OECDRecessionIndicators.ItalyFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Italy from the Period following the Peak through the Trough (in +1 or 0)
JPNRECD Fred.OECDRecessionIndicators.JapanFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Japan from the Period following the Peak through the Trough (in +1 or 0)
KORRECD Fred.OECDRecessionIndicators.KoreaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Korea from the Period following the Peak through the Trough (in +1 or 0)
LUXRECD Fred.OECDRecessionIndicators.LuxembourgFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Luxembourg from the Period following the Peak through the Trough (in +1 or 0)
MAJOR5ASIARECD Fred.OECDRecessionIndicators.MajorFiveAsiaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Major 5 Asia from the Period following the Peak through the Trough (in +1 or 0)
MEXRECD Fred.OECDRecessionIndicators.MexicoFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Mexico from the Period following the Peak through the Trough (in +1 or 0)
MSCRECD Fred.OECDRecessionIndicators.MajorSevenCountriesFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Major Seven Countries from the Period following the Peak through the Trough (in +1 or 0)
NAFTARECD Fred.OECDRecessionIndicators.NAFTAAreaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for NAFTA Area from the Period following the Peak through the Trough (in +1 or 0)
NDLRECD Fred.OECDRecessionIndicators.NetherlandsFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Netherlands from the Period following the Peak through the Trough (in +1 or 0)
NORRECD Fred.OECDRecessionIndicators.NorwayFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Norway from the Period following the Peak through the Trough (in +1 or 0)
NZLRECD Fred.OECDRecessionIndicators.NewZealandFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for New Zealand from the Period following the Peak through the Trough (in +1 or 0)
OECDEUROPERECD Fred.OECDRecessionIndicators.OECDEuropeFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for OECD Europe from the Period following the Peak through the Trough (in +1 or 0)
OECDNMERECD Fred.OECDRecessionIndicators.OECDandNonmemberEconomiesFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for OECD and Non-member Economies from the Period following the Peak through the Trough (in +1 or 0)
OECDRECD Fred.OECDRecessionIndicators.OECDTotalAreaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for the OECD Total Area from the Period following the Peak through the Trough (in +1 or 0)
POLRECD Fred.OECDRecessionIndicators.PolandFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Poland from the Period following the Peak through the Trough (in +1 or 0)
PRTRECD Fred.OECDRecessionIndicators.PortugalFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Portugal from the Period following the Peak through the Trough (in +1 or 0)
RUSRECD Fred.OECDRecessionIndicators.RussianFederationFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Russian Federation from the Period following the Peak through the Trough (in +1 or 0)
SVKRECD Fred.OECDRecessionIndicators.SlovakRepublicFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for the Slovak Republic from the Period following the Peak through the Trough (in +1 or 0)
SVNRECD Fred.OECDRecessionIndicators.SloveniaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Slovenia from the Period following the Peak through the Trough (in +1 or 0)
SWERECD Fred.OECDRecessionIndicators.SwedenFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Sweden from the Period following the Peak through the Trough (in +1 or 0)
TURRECD Fred.OECDRecessionIndicators.TurkeyFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for Turkey from the Period following the Peak through the Trough (in +1 or 0)
USARECD Fred.OECDRecessionIndicators.UnitedStatesFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for the United States from the Period following the Peak through the Trough (in +1 or 0)
ZAFRECD Fred.OECDRecessionIndicators.SouthAfricaFromPeriodFollowingPeakThroughTheTrough OECD based Recession Indicators for South Africa from the Period following the Peak through the Trough (in +1 or 0)
4BIGEURORECDP Fred.OECDRecessionIndicators.FourBigEuropeanCountriesFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Four Big European Countries from the Peak through the Period preceding the Trough (in +1 or 0)
AUSRECDP Fred.OECDRecessionIndicators.AustraliaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Australia from the Peak through the Period preceding the Trough (in +1 or 0)
AUTRECDP Fred.OECDRecessionIndicators.AustriaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Austria from the Peak through the Period preceding the Trough (in +1 or 0)
BELRECDP Fred.OECDRecessionIndicators.BelgiumFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Belgium from the Peak through the Period preceding the Trough (in +1 or 0)
BRARECDP Fred.OECDRecessionIndicators.BrazilFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Brazil from the Peak through the Period preceding the Trough (in +1 or 0)
CANRECDP Fred.OECDRecessionIndicators.CanadaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Canada from the Peak through the Period preceding the Trough (in +1 or 0)
CHERECDP Fred.OECDRecessionIndicators.SwitzerlandFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Switzerland from the Peak through the Period preceding the Trough (in +1 or 0)
CHLRECDP Fred.OECDRecessionIndicators.ChileFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Chile from the Peak through the Period preceding the Trough (in +1 or 0)
CHNRECDP Fred.OECDRecessionIndicators.ChinaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for China from the Peak through the Period preceding the Trough (in +1 or 0)
CZERECDP Fred.OECDRecessionIndicators.CzechRepublicFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for the Czech Republic from the Peak through the Period preceding the Trough (in +1 or 0)
DEURECDP Fred.OECDRecessionIndicators.GermanyFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Germany from the Peak through the Period preceding the Trough (in +1 or 0)
DNKRECDP Fred.OECDRecessionIndicators.DenmarkFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Denmark from the Peak through the Period preceding the Trough (in +1 or 0)
ESPRECDP Fred.OECDRecessionIndicators.SpainFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Spain from the Peak through the Period preceding the Trough (in +1 or 0)
ESTRECDP Fred.OECDRecessionIndicators.EstoniaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Estonia from the Peak through the Period preceding the Trough (in +1 or 0)
EURORECDP Fred.OECDRecessionIndicators.EuroAreaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Euro Area from the Peak through the Period preceding the Trough (in +1 or 0)
FINRECDP Fred.OECDRecessionIndicators.FinlandFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Finland from the Peak through the Period preceding the Trough (in +1 or 0)
FRARECDP Fred.OECDRecessionIndicators.FranceFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for France from the Peak through the Period preceding the Trough (in +1 or 0)
GBRRECDP Fred.OECDRecessionIndicators.UnitedKingdomFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for the United Kingdom from the Peak through the Period preceding the Trough (in +1 or 0)
GRCRECDP Fred.OECDRecessionIndicators.GreeceFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Greece from the Peak through the Period preceding the Trough (in +1 or 0)
HUNRECDP Fred.OECDRecessionIndicators.HungaryFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Hungary from the Peak through the Period preceding the Trough (in +1 or 0)
IDNRECDP Fred.OECDRecessionIndicators.IndonesiaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Indonesia from the Peak through the Period preceding the Trough (in +1 or 0)
INDRECDP Fred.OECDRecessionIndicators.IndiaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for India from the Peak through the Period preceding the Trough (in +1 or 0)
IRLRECDP Fred.OECDRecessionIndicators.IrelandFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Ireland from the Peak through the Period preceding the Trough (in +1 or 0)
ISRRECDP Fred.OECDRecessionIndicators.IsraelFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Israel from the Peak through the Period preceding the Trough (in +1 or 0)
ITARECDP Fred.OECDRecessionIndicators.ItalyFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Italy from the Peak through the Period preceding the Trough (in +1 or 0)
JPNRECDP Fred.OECDRecessionIndicators.JapanFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Japan from the Peak through the Period preceding the Trough (in +1 or 0)
KORRECDP Fred.OECDRecessionIndicators.KoreaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Korea from the Peak through the Period preceding the Trough (in +1 or 0)
LUXRECDP Fred.OECDRecessionIndicators.LuxembourgFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Luxembourg from the Peak through the Period preceding the Trough (in +1 or 0)
MAJOR5ASIARECDP Fred.OECDRecessionIndicators.MajorFiveAsiaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Major 5 Asia from the Peak through the Period preceding the Trough (in +1 or 0)
MEXRECDP Fred.OECDRecessionIndicators.MexicoFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Mexico from the Peak through the Period preceding the Trough (in +1 or 0)
MSCRECDP Fred.OECDRecessionIndicators.MajorSevenCountriesFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Major Seven Countries from the Peak through the Period preceding the Trough (in +1 or 0)
NAFTARECDP Fred.OECDRecessionIndicators.NAFTAAreaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for NAFTA Area from the Peak through the Period preceding the Trough (in +1 or 0)
NDLRECDP Fred.OECDRecessionIndicators.NetherlandsFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Netherlands from the Peak through the Period preceding the Trough (in +1 or 0)
NORRECDP Fred.OECDRecessionIndicators.NorwayFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Norway from the Peak through the Period preceding the Trough (in +1 or 0)
NZLRECDP Fred.OECDRecessionIndicators.NewZealandFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for New Zealand from the Peak through the Period preceding the Trough (in +1 or 0)
OECDEUROPERECDP Fred.OECDRecessionIndicators.OECDEuropeFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for OECD Europe from the Peak through the Period preceding the Trough (in +1 or 0)
OECDNMERECDP Fred.OECDRecessionIndicators.OECDandNonmemberEconomiesFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for OECD and Non-member Economies from the Peak through the Period preceding the Trough (in +1 or 0)
OECDRECDP Fred.OECDRecessionIndicators.OECDTotalAreaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for the OECD Total Area from the Peak through the Period preceding the Trough (in +1 or 0)
POLRECDP Fred.OECDRecessionIndicators.PolandFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Poland from the Peak through the Period preceding the Trough (in +1 or 0)
PRTRECDP Fred.OECDRecessionIndicators.PortugalFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Portugal from the Peak through the Period preceding the Trough (in +1 or 0)
RUSRECDP Fred.OECDRecessionIndicators.RussianFederationFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Russian Federation from the Peak through the Period preceding the Trough (in +1 or 0)
SVKRECDP Fred.OECDRecessionIndicators.SlovakRepublicFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for the Slovak Republic from the Peak through the Period preceding the Trough (in +1 or 0)
SVNRECDP Fred.OECDRecessionIndicators.SloveniaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Slovenia from the Peak through the Period preceding the Trough (in +1 or 0)
SWERECDP Fred.OECDRecessionIndicators.SwedenFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Sweden from the Peak through the Period preceding the Trough (in +1 or 0)
TURRECDP Fred.OECDRecessionIndicators.TurkeyFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for Turkey from the Peak through the Period preceding the Trough (in +1 or 0)
USARECDP Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for the United States from the Peak through the Period preceding the Trough (in +1 or 0)
ZAFRECDP Fred.OECDRecessionIndicators.SouthAfricaFromPeakThroughThePeriodPrecedingtheTrough OECD based Recession Indicators for South Africa from the Peak through the Period preceding the Trough (in +1 or 0)
TradeWeightedIndexes
DTWEXM Fred.TradeWeightedIndexes.MajorCurrenciesGoods Trade Weighted U.S. Dollar Index: Major Currencies, Goods (in Index Mar 1973=100)
DTWEXO Fred.TradeWeightedIndexes.OtherImportantTradingPartnersGoods Trade Weighted U.S. Dollar Index: Other Important Trading Partners, Goods (in Index Jan 1997=100)
DTWEXB Fred.TradeWeightedIndexes.BroadGoods Trade Weighted U.S. Dollar Index: Broad, Goods (in Index Jan 1997=100)
DTWEXAFEGS Fred.TradeWeightedIndexes.AdvancedForeignEconomiesGoodsAndServices Trade Weighted U.S. Dollar Index: Advanced Foreign Economies, Goods and Services (in Index Jan 2006=100)
DTWEXBGS Fred.TradeWeightedIndexes.BroadGoodsAndServices Trade Weighted U.S. Dollar Index: Broad, Goods and Services (in Index Jan 2006=100)
DTWEXEMEGS Fred.TradeWeightedIndexes.EmergingMarketsEconomiesGoodsAndServices Trade Weighted U.S. Dollar Index: Emerging Markets Economies, Goods and Services (in Index Jan 2006=100)
Wilshire
WILLSMLCAPVALPR Fred.Wilshire.USSmallCapValuePrice Wilshire US Small-Cap Value Price Index (in Index)
WILL2500PR Fred.Wilshire.Price2500 Wilshire 2500 Price Index (in Index)
WILL4500PR Fred.Wilshire.Price4500 Wilshire 4500 Price Index (in Index)
WILL2500PRVAL Fred.Wilshire.ValuePrice2500 Wilshire 2500 Value Price Index (in Index)
WILL2500PRGR Fred.Wilshire.GrowthPrice2500 Wilshire 2500 Growth Price Index (in Index)
WILLSMLCAPPR Fred.Wilshire.USSmallCapPrice Wilshire US Small-Cap Price Index (in Index)
WILL5000PR Fred.Wilshire.Price5000 Wilshire 5000 Price Index (in Index)
WILLSMLCAPGRPR Fred.Wilshire.USSmallCapGrowthPrice Wilshire US Small-Cap Growth Price Index (in Index)
WILLMIDCAPVALPR Fred.Wilshire.USMidCapValuePrice Wilshire US Mid-Cap Value Price Index (in Index)
WILLRESIPR Fred.Wilshire.USRealEstateSecuritiesPrice Wilshire US Real Estate Securities Price Index (Wilshire US RESI) (in Index)
WILLLRGCAPPR Fred.Wilshire.USLargeCapPrice Wilshire US Large-Cap Price Index (in Index)
WILLMIDCAPPR Fred.Wilshire.USMidCapPrice Wilshire US Mid-Cap Price Index (in Index)
WILLMIDCAPGRPR Fred.Wilshire.USMidCapGrowthPrice Wilshire US Mid-Cap Growth Price Index (in Index)
WILLMICROCAPPR Fred.Wilshire.USMicroCapPrice Wilshire US Micro-Cap Price Index (in Index)
WILLREITPR Fred.Wilshire.USRealEstateInvestmentTrustPrice Wilshire US Real Estate Investment Trust Price Index (Wilshire US REIT) (in Index)
WILLLRGCAPVALPR Fred.Wilshire.USLargeCapValuePrice Wilshire US Large-Cap Value Price Index (in Index)
WILLLRGCAPGRPR Fred.Wilshire.USLargeCapGrowthPrice Wilshire US Large-Cap Growth Price Index (in Index)
WILL5000PRFC Fred.Wilshire.FullCapPrice5000 Wilshire 5000 Full Cap Price Index (in Index)
WILLMIDCAPVAL Fred.Wilshire.USMidCapValue Wilshire US Mid-Cap Value Total Market Index (in Index)
WILLMIDCAPGR Fred.Wilshire.USMidCapGrowth Wilshire US Mid-Cap Growth Total Market Index (in Index)
WILLMIDCAP Fred.Wilshire.USMidCap Wilshire US Mid-Cap Total Market Index (in Index)
WILLRESIND Fred.Wilshire.USRealEstateSecurities Wilshire US Real Estate Securities Total Market Index (Wilshire US RESI) (in Index)
WILL4500IND Fred.Wilshire.Index4500 Wilshire 4500 Total Market Index (in Index)
WILL5000IND Fred.Wilshire.Index5000 Wilshire 5000 Total Market Index (in Index)
WILLLRGCAPGR Fred.Wilshire.USLargeCapGrowth Wilshire US Large-Cap Growth Total Market Index (in Index)
WILLMICROCAP Fred.Wilshire.USMicroCap Wilshire US Micro-Cap Total Market Index (in Index)
WILL2500INDVAL Fred.Wilshire.Value2500 Wilshire 2500 Value Total Market Index (in Index)
WILLSMLCAPGR Fred.Wilshire.USSmallCapGrowth Wilshire US Small-Cap Growth Total Market Index (in Index)
WILLSMLCAPVAL Fred.Wilshire.USSmallCapValue Wilshire US Small-Cap Value Total Market Index (in Index)
WILLLRGCAPVAL Fred.Wilshire.USLargeCapValue Wilshire US Large-Cap Value Total Market Index (in Index)
WILLREITIND Fred.Wilshire.USRealEstateInvestmentTrust Wilshire US Real Estate Investment Trust Total Market Index (Wilshire US REIT) (in Index)
WILL2500IND Fred.Wilshire.Index2500 Wilshire 2500 Total Market Index (in Index)
WILLSMLCAP Fred.Wilshire.USSmallCap Wilshire US Small-Cap Total Market Index (in Index)
WILLLRGCAP Fred.Wilshire.USLargeCap Wilshire US Large-Cap Total Market Index (in Index)
WILL2500INDGR Fred.Wilshire.Growth2500 Wilshire 2500 Growth Total Market Index (in Index)
WILL5000INDFC Fred.Wilshire.TotalMarketFullCap5000 Wilshire 5000 Total Market Full Cap Index (in Index)

Data Point Attributes

The FRED dataset provides Fred objects, which have the following attributes:

Requesting Data

To add FRED data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class FredAlternativeDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2003, 1, 1)
        self.SetEndDate(2019, 10, 11)
        self.SetCash(100000)

        self.dataset_symbol = self.AddData(Fred, Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough, Resolution.Daily).Symbol
namespace QuantConnect
{
    public class FredAlternativeDataAlgorithm : QCAlgorithm
    {
        private Symbol _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2003, 1, 1);
            SetEndDate(2019, 10, 11);
            SetCash(100000);
            
            _datasetSymbol = AddData<Fred>(Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough, Resolution.Daily).Symbol;
        }
    }
}

Accessing Data

To get the current FRED data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} value at {slice.Time}: {data_point.Value}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} value at {slice.Time}: {dataPoint.Value}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(Fred).items():
        self.Log(f"{dataset_symbol} value at {slice.Time}: {data_point.Value}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<Fred>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} value at {slice.Time}: {dataPoint.Value}");
    }
}

Historical Data

To get historical FRED data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[Fred](self.dataset_symbol, 100, Resolution.Daily)
var history = History<Fred>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove your subscription to FRED data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The FRED dataset enables you to accurately design strategies utilizing macroeconomic indicators. Examples include the following strategies:

 

6.17 Kavout

Kavout was created by ex-Googlers and the founding team used to work at Google, Microsoft, Baidu, and financial firms with a proven track record of building many mission-critical machine learning systems where billions of data points were processed in real-time to predict the best outcome for core search ranking, ads monetization, recommendations, and trading platforms.

Their mission is to build machine investing solutions to find alpha with adaptive learning algorithms and to create an edge by assimilating vast quantities of complex data through the latest AI and Machine Learning methods to generate signals to uncover hidden, dynamic, and nonlinear patterns in the financial markets.

 

6.17.1 Composite Factor Bundle

Introduction

The Composite Factor Bundle dataset by Kavout provides ensemble scores for popular market factors. Kavout signals are machine-learning enhanced scores that capture the returns of systematic factors such as quality, value, momentum, growth, and low volatility. There are many different anomalies discovered by researchers and practitioners across these factor categories and there is no good common definition of each style across the literature. Kavout creates an ensemble score for each style that gauges the different factors considered in the literature and industry practice.

In this data set, you will find Kavout's proprietary signals for quality, value, momentum, growth, and low volatility, which have been adopted by some of the multi-billion dollar quant funds in New York and London. Each signal is generated by an ensemble model consisting of inputs from hundreds of anomalies. The data is generated on a daily basis and covers all the stocks traded in US major markets such as NYSE and Nasdaq since 2003. You could leverage this abundant set of signals to construct and backtest your strategies.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Composite Factor Bundle dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Kavout was created by ex-Googlers and the founding team used to work at Google, Microsoft, Baidu, and financial firms with a proven track record of building many mission-critical machine learning systems where billions of data points were processed in real-time to predict the best outcome for core search ranking, ads monetization, recommendations, and trading platforms.

Their mission is to build machine investing solutions to find alpha with adaptive learning algorithms and to create an edge by assimilating vast quantities of complex data through the latest AI and Machine Learning methods to generate signals to uncover hidden, dynamic, and nonlinear patterns in the financial markets.

Getting Started

The following snippet demonstrates how to request data from the Composite Factor Bundle dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(KavoutCompositeFactorBundle, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<KavoutCompositeFactorBundle>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2003
Asset Coverage 8,000 US Equities
Data Density Regular
Resolution Daily
Timezone UTC

Data Point Attributes

Template content example

The Composite Factor Bundle dataset provides KavoutCompositeFactorBundle objects, which have the following attributes:

Requesting Data

To add Composite Factor Bundle data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class KavoutCompositeFactorBundleAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(KavoutCompositeFactorBundle, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class KavoutCompositeFactorBundleAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<KavoutCompositeFactorBundle>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Composite Factor Bundle data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} momentum at {slice.Time}: {data_point.Momentum}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} momentum at {slice.Time}: {dataPoint.Momentum}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(KavoutCompositeFactorBundle).items():
        self.Log(f"{dataset_symbol} momentum at {slice.Time}: {data_point.Momentum}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<KavoutCompositeFactorBundle>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} momentum at {slice.Time}: {dataPoint.Momentum}");
    }
}

Historical Data

To get historical Composite Factor Bundle data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[KavoutCompositeFactorBundle](self.dataset_symbol, 100, Resolution.Daily)
var history = History<KavoutCompositeFactorBundle>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Composite Factor Bundle data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Composite Factor Bundle dataset enables you to access the performance of 5 different factors in order to engineer strategies. Examples include the following strategies:

 

6.18 Nasdaq

" Nasdaq " was initially an acronym for the National Association of Securities Dealers Automated Quotations. It was founded in 1971 by the National Association of Securities Dealers (NASD), now known as the Financial Industry Regulatory Authority ( FINRA ), with the goal to provide financial services and operate stock exchanges.

On Dec. 4th, 2018, Nasdaq announced it had acquired Quandl, Inc. , a leading provider of alternative and core financial data. Quandl was founded by Tammer Kamel in 2012, with goal of making it easy for anyone to find and use high-quality data effectively in their professional decision-making. In 2021, Quandl was replaced by Nasdaq Data Link .

 

6.18.1 Data Link

Introduction

The Data Link dataset by Nasdaq, previously known as Quandl, is a collection of alternative data sets. It has indexed millions of time-series datasets from over 400 sources, which start in different years. This dataset is delivered on several frequencies, but the free data sets have often a daily frequency.

For more information about the Data Link dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

" Nasdaq " was initially an acronym for the National Association of Securities Dealers Automated Quotations. It was founded in 1971 by the National Association of Securities Dealers (NASD), now known as the Financial Industry Regulatory Authority ( FINRA ), with the goal to provide financial services and operate stock exchanges.

On Dec. 4th, 2018, Nasdaq announced it had acquired Quandl, Inc. , a leading provider of alternative and core financial data. Quandl was founded by Tammer Kamel in 2012, with goal of making it easy for anyone to find and use high-quality data effectively in their professional decision-making. In 2021, Quandl was replaced by Nasdaq Data Link .

Getting Started

The following snippet demonstrates how to request data from the Data Link dataset:

from QuantConnect.DataSource import *

# For premium datasets, provide your API Key
# NasdaqDataLink.SetAuthCode(self.GetParameter("nasdaq-data-link-api-key"))

self.pe_ratio_symbol = self.AddData(NasdaqDataLink, "MULTPL/SP500_PE_RATIO_MONTH", Resolution.Daily).Symbol
# This dataset has one data column ("Value")

self.position_change_symbol = self.AddData(NasdaqCustomColumns, "CFTC/066393_FO_L_CHG", Resolution.Daily).Symbol
# This dataset has multiple data columns. Create a subclass to set the default value column.

class NasdaqCustomColumns(NasdaqDataLink):
    def __init__(self) -> None:
        # Select the column "open interest - change".
        self.ValueColumnName = "open interest - change"
using QuantConnect.DataSource;

// For premium datasets, provide your API Key
// NasdaqDataLink.SetAuthCode(GetParameter("nasdaq-data-link-api-key"));

_peRatioSymbol = AddData<NasdaqDataLink>("MULTPL/SP500_PE_RATIO_MONTH", Resolution.Daily).Symbol;
// This dataset has one data column ("Value")

_positionChangeSymbol = AddData<NasdaqCustomColumns>("CFTC/066393_FO_L_CHG", Resolution.Daily).Symbol;
// This dataset has multiple data columns. Create a subclass to set the default value column.

public class NasdaqCustomColumns : NasdaqDataLink
{
    // Select the column "open interest - change"
    public NasdaqCustomColumns() : base(valueColumnName: "open interest - change") { }
}

Our Nasdaq Data Link integration supports any dataset from Nasdaq that has a URL starting with data.nasdaq.com/data/ . To import a dataset from Data Link, you need to get the dataset code. Follow these steps to get the dataset code:

  1. Open the Data Link catalog .
  2. (Optional) Use the filters on the left side bar to narrow down the catalog results.
  3. Click one of the data products.
  4. On the data product page, click one of the table names.
  5. In the top-right corner of the dataset page, copy the Nasdaq Data Link Code.

Data Summary

The data summary depends on the specific Data Link dataset you use. Follow these steps to view the data summary of a dataset:

  1. Open the Data Link catalog .
  2. Click one of the data products.
  3. On the data product page, click one of the table names.
  4. View the data frequency and description in the left sidebar.
  5. Above the chart, click Table to view the start date, end date, and data point attributes.

Backward Compatibility

QuantConnect/LEAN has supported Quandl since 2015. On January, 12, 2022, we moved the implementation from the LEAN GitHub repository to the Lean.DataSource.NasdaqDataLink GitHub repository . Through this transition, we maintained backward compatibility. All of the preceding code snippets work if you replace NasdaqDataLink with Quandl .

Requesting Data

To add Data Link data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm. If there is more than one value column in the Data Link dataset, to set the Value property of the data objects, create a sublcass of the NasdaqDataLink class and set its ValueColumnName property to the column name.

class NasdaqDataLinkDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2022, 1, 1)
        self.SetEndDate(2022, 7, 1)
        self.SetCash(100000)

        # For premium datasets, provide your API Key
        # NasdaqDataLink.SetAuthCode(self.GetParameter("nasdaq-data-link-api-key"))

        self.pe_ratio_symbol = self.AddData(NasdaqDataLink, "MULTPL/SP500_PE_RATIO_MONTH", Resolution.Daily).Symbol
        # This dataset has one data column ("Value")
        # Source : https://data.nasdaq.com/data/MULTPL/SP500_PE_RATIO_MONTH-sp-500-pe-ratio-by-month

        self.position_change_symbol = self.AddData(NasdaqCustomColumns, "CFTC/066393_FO_L_CHG", Resolution.Daily).Symbol
        # This dataset has multiple data columns
        # Source: https://data.nasdaq.com/data/CFTC/066393_FO_L_CHG-commitment-of-traders-propane-argus-far-east-mini-ifed-futures-and-options-change-in-positions-legacy-format-066393

class NasdaqCustomColumns(NasdaqDataLink):
    def __init__(self) -> None:
        # Select the column "open interest - change".
        self.ValueColumnName = "open interest - change"
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class NasdaqDataLinkDataAlgorithm : QCAlgorithm
    {
        private Symbol _peRatioSymbol, _positionChangeSymbol;

        public override void Initialize()
        {
            SetStartDate(2022, 1, 1);
            SetEndDate(2022, 7, 1);
            SetCash(100000);

            // For premium datasets, provide your API Key
            // NasdaqDataLink.SetAuthCode(GetParameter("nasdaq-data-link-api-key"));

            _peRatioSymbol = AddData<NasdaqDataLink>("MULTPL/SP500_PE_RATIO_MONTH", Resolution.Daily).Symbol;
            // This dataset has one data column ("Value")
            // Source : https://data.nasdaq.com/data/MULTPL/SP500_PE_RATIO_MONTH-sp-500-pe-ratio-by-month

            _positionChangeSymbol = AddData<NasdaqCustomColumns>("CFTC/066393_FO_L_CHG", Resolution.Daily).Symbol;
            // This dataset has multiple data columns
            // Source: https://data.nasdaq.com/data/CFTC/066393_FO_L_CHG-commitment-of-traders-propane-argus-far-east-mini-ifed-futures-and-options-change-in-positions-legacy-format-066393
        }
    }

    public class NasdaqCustomColumns : NasdaqDataLink
    {
        // Select the column "open interest - change".
        public NasdaqCustomColumns() : base(valueColumnName: "open interest - change") { }
    }
}

Accessing Data

To get the current Data Link data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

To get the default value of the dataset, use the Value property. To get the value of a specific column in the dataset, call the GetStorageDictionary method and index the result with the column name.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.pe_ratio_symbol):
        value = slice[self.pe_ratio_symbol].Value
        self.Log(f"{self.pe_ratio_symbol} PE ratio at {slice.Time}: {value}")

    if slice.ContainsKey(self.position_change_symbol):
        data_point = slice[self.position_change_symbol]
        open_interest_change = data_point.Value
        storage_dictionary = data_point.GetStorageDictionary()
        longs_change = storage_dictionary["noncommercial longs - change"]        
        self.Log(f"{self.position_change_symbol} open interest change at {slice.Time}: {open_interest_change}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_peRatioSymbol))
    {
        var value = slice[_peRatioSymbol].Value;
        Log($"{_peRatioSymbol} PE ratio at {slice.Time}: {value}");
    }

    if (slice.ContainsKey(_positionChangeSymbol))
    {
        var dataPoint = slice[_positionChangeSymbol];
        var openInterestChange = dataPoint.Value;
        var storageDictionary = dataPoint.GetStorageDictionary();
        var longsChange = storageDictionary["noncommercial longs - change"];
        Log($"{_positionChangeSymbol} open interest change at {slice.Time}: {openInterestChange}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(NasdaqDataLink).items():
        self.Log(f"{dataset_symbol} PE ratio at {slice.Time}: {data_point.Value}")

    for dataset_symbol, data_point in slice.Get(NasdaqCustomColumns).items():
        self.Log(f"{dataset_symbol} value at {slice.Time}: {data_point.Value}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<NasdaqDataLink>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} PE ratio at {slice.Time}: {dataPoint.Value}");
    }

    foreach (var kvp in slice.Get<NasdaqCustomColumns>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} value at {slice.Time}: {dataPoint.Value}");
    }
}

Historical Data

The process to get historical Data Link data depends on your environment.

In Algorithms

To get historical Data Link data in an algorithm, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
pe_ratio_history_df = self.History(self.pe_ratio_symbol, 100, Resolution.Daily)
position_change_history_df = self.History(self.position_change_symbol, 100, Resolution.Daily)

# Dataset objects
pe_ratio_history_df = self.History[NasdaqDataLink](self.pe_ratio_symbol, 100, Resolution.Daily)
position_change_history_df = self.History[NasdaqCustomColumns](self.position_change_symbol, 100, Resolution.Daily)
var peRatioHistory = History<NasdaqDataLink>(_peRatioSymbol, 100, Resolution.Daily);
var positionChangeHistory = History<NasdaqDataLink>(_positionChangeSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

In Research Notebooks

To get historical Data Link data in the Research Environment, call the Download method with the data URL.

from io import StringIO
data = qb.Download("data.nasdaq.com/api/v3/datasets/MULTPL/SP500_PE_RATIO_MONTH.csv?")
df = pd.read_csv(StringIO(data), index_col=0)
var data = qb.Download("data.nasdaq.com/api/v3/datasets/MULTPL/SP500_PE_RATIO_MONTH.csv?");

To receive a notification when you can use the History method in the Research Environment to get data from Data Link, subscribe to Lean.DataSource.NasdaqDataLink GitHub Issue #10 .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.pe_ratio_symbol)
self.RemoveSecurity(self.position_change_symbol)
RemoveSecurity(_peRatioSymbol);
RemoveSecurity(_positionChangeSymbol);

Example Applications

The Nasdaq Data Link sources allow you to explore different kinds of data in their database to develop trading strategies. Examples include the following strategies:

 

6.19 Quiver Quantitative

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

 

6.19.1 CNBC Trading

Introduction

The CNBC Trading dataset by Quiver Quantitative tracks the recommendations made by media personalities on CNBC and their historical performance. The data covers over 1,500 US Equities, starts in December 2020, and is delivered on a daily frequency. This dataset covers recommendations made on Mad Money, Halftime Report, and Fast Money.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the CNBC Trading dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the CNBC Trading dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverCNBCs, self.symbol).Symbol

self.AddUniverse(QuiverCNBCsUniverse, "QuiverCNBCsUniverse", Resolution.Daily, self.UniverseSelectionFilter)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverCNBCs>(_symbol).Symbol;

AddUniverse<QuiverCNBCsUniverse>("QuiverCNBCsUniverse", Resolution.Daily, UniverseSelectionFilter);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date December 25, 2020
Asset Coverage 1,515 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Quiver Quantitative CNBC Trading dataset provides QuiverCNBCs , QuiverCNBC , and QuiverCNBCsUniverse objects.

QuiverCNBCs

QuiverCNBCs objects have the following attributes:

QuiverCNBC

QuiverCNBC objects have the following attributes:

QuiverCNBCsUniverse

QuiverCNBCsUniverse objects have the following attributes:

Requesting Data

To add CNBC Trading data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverCNBCDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverCNBCs, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverCNBCDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol= AddData<QuiverCNBCs>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current CNBC Trading data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} direction at {slice.Time}: {data_point.Direction}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (var dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} direction at {slice.Time}: {dataPoint.Direction}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.Get(QuiverCNBCs).items():
        for data_point in data_points:
            self.Log(f"{dataset_symbol} direction at {slice.Time}: {data_point.Direction}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverCNBCs>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoints = kvp.Value;
        foreach(var dataPoint in dataPoints)
        {
            Log($"{datasetSymbol} direction at {slice.Time}: {dataPoint.Direction}");
        }
    }
}

Historical Data

To get historical CNBC Trading data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverCNBCs](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverCNBCs>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on CNBC Trading data, call the AddUniverse method with the QuiverCNBCsUniverse class and a selection function.

self.AddUniverse(QuiverCNBCsUniverse, "QuiverCNBCsUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverCNBCsUniverse]) -> List[Symbol]:
    cnbc_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.Symbol
        
        if symbol not in cnbc_data_by_symbol:
            cnbc_data_by_symbol[symbol] = []
        cnbc_data_by_symbol[symbol].append(datum)
    
    # define our selection criteria
    return [symbol for symbol, d in cnbc_data_by_symbol.items()
            if len([x for x in d if x.Direction == OrderDirection.Buy]) >= 3]
AddUniverse<QuiverCNBCsUniverse>("QuiverCNBCsUniverse", Resolution.Daily, altCoarse =>
{
    var cnbcDataBySymbol = new Dictionary<Symbol, List<QuiverCNBCsUniverse>>();

    foreach (var datum in altCoarse)
    {
        var symbol = datum.Symbol;

        if (!cnbcDataBySymbol.ContainsKey(symbol))
        {
            cnbcDataBySymbol.Add(symbol, new List<QuiverCNBCsUniverse>());
        }
        cnbcDataBySymbol[symbol].Add(datum);
    }

    // define our selection criteria
    return from kvp in cnbcDataBySymbol
           where kvp.Value.Where(x => x.Direction == OrderDirection.Buy) >= 3
           select kvp.Key;
});

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to CNBC Trading data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Quiver Quantitative CNBC Trading dataset enables you to create strategies using the latest recommendations made by media personalities on CNBC. Examples include the following strategies:

 

6.19.2 Corporate Lobbying

Introduction

The Corporate Lobbying dataset by Quiver Quantitative tracks the lobbying activity of US Equities. The Lobbying Disclosure Act of 1995 requires lobbyists in the United States to disclose information about their activities, such as their clients, which issues they are lobbying on, and how much they are being paid. Quiver Quantiative scrapes this data and maps it to stock tickers to track which companies are spending money for legislative influence. For more information about this dataset, see The Effects and Influence of Corporate Lobbying on the Quiver Quantitative website.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Corporate Lobbying dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the Corporate Lobbying dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverLobbyings, self.symbol).Symbol

self.AddUniverse(QuiverLobbyingUniverse, "QuiverLobbyingUniverse", Resolution.Daily, self.UniverseSelectionFilter)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverLobbyings>(_symbol).Symbol;

AddUniverse<QuiverLobbyingUniverse>("QuiverLobbyingUniverse", Resolution.Daily, UniverseSelectionFilter);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 4, 1999
Asset Coverage 1,418 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Quiver Quantitative Corporate Lobbying dataset provides QuiverLobbyings , QuiverLobbying , and QuiverLobbyingUniverse objects.

QuiverLobbyings

QuiverLobbyings objects have the following attributes:

QuiverLobbying

QuiverLobbying objects have the following attributes:

QuiverLobbyingUniverse

QuiverLobbyingUniverse objects have the following attributes:

Requesting Data

To add Corporate Lobbying data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverLobbyingDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverLobbyings, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverLobbyingDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol= AddData<QuiverLobbyings>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Corporate Lobbying data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (var dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.Get(QuiverLobbyings).items():
        for data_point in data_points:
            self.Log(f"{dataset_symbol} amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverLobbyings>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoints = kvp.Value;
        foreach(var dataPoint in dataPoints)
        {
            Log($"{datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
        }
    }
}

Historical Data

To get historical Corporate Lobbying data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverLobbyings](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverLobbyings>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Corporate Lobbying data, call the AddUniverse method with the QuiverLobbyingUniverse class and a selection function.

self.AddUniverse(QuiverLobbyingUniverse, "QuiverLobbyingUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverLobbyingUniverse]) -> List[Symbol]:
    lobby_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.Symbol
        
        if symbol not in lobby_data_by_symbol:
            lobby_data_by_symbol[symbol] = []
        lobby_data_by_symbol[symbol].append(datum)
    
    return [symbol for symbol, d in lobby_data_by_symbol.items()
            if sum([x.Amount for x in d]) >= 100000]
AddUniverse<QuiverLobbyingUniverse>("QuiverLobbyingUniverse", Resolution.Daily, altCoarse =>
{
    var lobbyDataBySymbol = new Dictionary<Symbol, List<QuiverLobbyingUniverse>>();

    foreach (var datum in altCoarse)
    {
        var symbol = datum.Symbol;

        if (!lobbyDataBySymbol.ContainsKey(symbol))
        {
            lobbyDataBySymbol.Add(symbol, new List<QuiverLobbyingUniverse>());
        }
        lobbyDataBySymbol[symbol].Add(datum);
    }

    return from kvp in lobbyDataBySymbol
           where kvp.Value.Sum(x => x.Amount) >= 100000
           select kvp.Key;
});

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Corporate Lobbying data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Corporate Lobbying dataset enables you to create strategies using the latest information on lobbying activity. Examples include the following strategies:

 

6.19.3 Insider Trading

Introduction

Corporate insiders are required to disclose purchases or sales of their own stock within two business days of when they occur. Using these disclosures, we collect data on insider trading activity, which can give hints on whether executives are bullish or bearish on their own companies. Here is a blog that we did on this dataset: https://www.quiverquant.com/blog/081121

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Insider Trading dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the Insider Trading dataset:

from QuantConnect.DataSource import *

aapl = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.quiver_insider_trading_symbol = self.AddData(QuiverInsiderTradings, aapl).Symbol
self.AddUniverse(QuiverInsiderTradingUniverse, "QuiverInsiderTradingUniverse", Resolution.Daily, self.UniverseSelection)
using QuantConnect.DataSource;

var aapl = AddEquity("AAPL", Resolution.Daily).Symbol;
var quiverInsiderTradingSymbol = AddData<QuiverInsiderTradings>(aapl).Symbol;
AddUniverse<QuiverInsiderTradingUniverse>("QuiverInsiderTradingUniverse", Resolution.Daily, UniverseSelectionFilter);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date 25 April 2014
Asset Coverage 4994 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Insider Trading dataset provides QuiverInsiderTrading objects encapsulated in a QuiverInsiderTradings object, and QuiverInsiderTradingUniverse object.

QuiverInsiderTradings

QuiverInsiderTradings objects have the following attributes:

QuiverInsiderTrading

QuiverInsiderTrading objects have the following attributes:

QuiverInsiderTradingUniverse

QuiverInsiderTradingUniverse objects have the following attributes:

Requesting Data

To add Insider Trading data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverInsiderTradingDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverInsiderTradings, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverInsiderTradingDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol= AddData<QuiverInsiderTradings>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Insider Trading data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} shares at {slice.Time}: {data_point.Shares}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (QuiverInsiderTrading dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} shares at {slice.Time}: {dataPoint.Shares}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.Get(QuiverInsiderTradings).items():
        for data_point in data_points:
            self.Log(f"{dataset_symbol} shares at {slice.Time}: {data_point.Shares}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverInsiderTradings>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoints = kvp.Value;
        foreach(QuiverInsiderTrading dataPoint in dataPoints)
        {
            Log($"{datasetSymbol} shares at {slice.Time}: {dataPoint.Shares}");
        }
    }
}

Historical Data

To get historical Insider Trading data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
self.History[QuiverInsiderTradings](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverInsiderTradings>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Insider Trading data, call the AddUniverse method with the QuiverInsiderTradingUniverse class and a selection function.

self.AddUniverse(QuiverInsiderTradingUniverse, "QuiverInsiderTradingUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverInsiderTradingUniverse]) -> List[Symbol]:
    insider_trading_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.Symbol
        
        if symbol not in insider_trading_data_by_symbol:
            insider_trading_data_by_symbol[symbol] = []
        insider_trading_data_by_symbol[symbol].append(datum)
    
    return [symbol for symbol, d in insider_trading_data_by_symbol.items()
            if len([x for x in d if x.Direction == OrderDirection.Buy]) >= 3]
AddUniverse<QuiverInsiderTradingUniverse>("QuiverInsiderTradingUniverse", Resolution.Daily, altCoarse =>
{
    var insiderTradingDataBySymbol = new Dictionary<Symbol, List<QuiverInsiderTradingUniverse>>();

    foreach (var datum in altCoarse)
    {
        var symbol = datum.Symbol;

        if (!insiderTradingDataBySymbol.ContainsKey(symbol))
        {
            insiderTradingDataBySymbol.Add(symbol, new List<QuiverInsiderTradingUniverse>());
        }
        insiderTradingDataBySymbol[symbol].Add(datum);
    }

    return from kvp in insiderTradingDataBySymbol
           where kvp.Value.Where(x => x.Direction == OrderDirection.Buy) >= 3
           select kvp.Key;
});

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Insider Trading data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Quiver Quantitative Insider Trading dataset enables researchers to create strategies using the latest information on insider trading activity. Examples include:

 

6.19.4 Twitter Followers

Introduction

The Twitter Followers dataset by Quiver Quantitative tracks the number of followers on the official Twitter pages of US-listed companies. The data covers 2,000 equities, starts in May 2020, and is delivered on a daily frequency. This dataset is created by scraping the number of Twitter followers from the official Twitter page of the security.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Twitter Followers dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the Twitter Followers dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverQuantTwitterFollowers, self.symbol).Symbol

self.AddUniverse(QuiverQuantTwitterFollowersUniverse, "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.UniverseSelectionMethod)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverQuantTwitterFollowers>(_symbol).Symbol;

AddUniverse<QuiverQuantTwitterFollowersUniverse>("QuiverQuantTwitterFollowersUniverse", Resolution.Daily, UniverseSelectionMethod);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date May 2020
Asset Coverage 2,000 US Equities
Data Density Sparse
Resolution Daily
Timezone Chicago

Data Point Attributes

The Twitter Followers dataset provides QuiverQuantTwitterFollowers and QuiverQuantTwitterFollowersUniverse objects.

QuiverQuantTwitterFollowers Attributes

QuiverQuantTwitterFollowers objects have the following attributes:

QuiverQuantTwitterFollowersUniverse Attributes

QuiverQuantTwitterFollowersUniverse objects have the following attributes:

Requesting Data

To add Twitter Followers data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverQuantTwitterFollowersDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverQuantTwitterFollowers, self.symbol).Symbol
namespace QuantConnect
{
    public class QuiverQuantTwitterFollowersDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<QuiverQuantTwitterFollowers>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Twitter Followers data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} followers at {slice.Time}: {data_point.Followers}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} followers at {slice.Time}: {dataPoint.Followers}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(QuiverQuantTwitterFollowers).items():
        self.Log(f"{dataset_symbol} followers at {slice.Time}: {data_point.Followers}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverQuantTwitterFollowers>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} followers at {slice.Time}: {dataPoint.Followers}");
    }
}

Historical Data

To get historical Twitter Followers data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverQuantTwitterFollowers](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverQuantTwitterFollowers>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Twitter Followers data, call the AddUniverse method with the QuiverQuantTwitterFollowersUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(QuiverQuantTwitterFollowersUniverse, "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.UniverseSelection)
        
def UniverseSelection(self, alt_coarse: List[QuiverQuantTwitterFollowersUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.Followers > 200000 \
                and d.WeekPercentChange > 0]
public override void Initialize()
{
    AddUniverse("QuiverQuantTwitterFollowersUniverse", Resolution.Daily, altCoarse =>
    {
        return from d in altCoarse
            where d.Followers > 200000 && d.WeekPercentChange > 0m 
            select d.Symbol;
    });
}

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Twitter Followers data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Twitter Followers dataset enables you to create strategies using the number of Twitter followers for companies. Examples include the following strategies:

 

6.19.5 US Congress Trading

Introduction

The US Congress Trading dataset by Quiver Quantitative tracks US Equity trades made by members of Congress in the Senate and the House of Representatives. The data covers 1,800 US Equities, starts in January 2016, and is delivered on a daily frequency. This dataset is created by scraping SEC reports.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Congress Trading dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the US Congress Trading dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverCongress, self.symbol).Symbol

self.AddUniverse(QuiverQuantCongressUniverse, "QuiverQuantCongresssUniverse", Resolution.Daily, self.UniverseSelection)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverCongress>(_symbol).Symbol;

AddUniverse<QuiverQuantCongresssUniverse>("QuiverQuantCongresssUniverse", Resolution.Daily, UniverseSelection);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2016
Asset Coverage 1,800 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The US Congress Trading dataset provides QuiverCongress and QuiverQuantCongressUniverse objects.

QuiverCongress Attributes

QuiverCongress object has the following attributes:

QuiverQuantCongressUniverse Attributes

QuiverQuantCongressUniverse object has the following attributes:

Requesting Data

To add US Congress Trading data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverCongressDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverCongress, self.symbol).Symbol
namespace QuantConnect
{
    public class QuiverCongressDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<QuiverCongress>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current US Congress Trading data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} transaction amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(QuiverCongress).items():
        self.Log(f"{dataset_symbol} transaction amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverCongress>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}");
    }
}

Historical Data

To get historical US Congress Trading data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverCongress](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverCongress>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on US Congress Trading data, call the AddUniverse method with the QuiverQuantCongressUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(QuiverQuantCongressUniverse, "QuiverQuantCongresssUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverQuantCongresssUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
        if d.Amount > 200000 and d.Transaction == OrderDirection.Buy]
AddUniverse<QuiverQuantCongresssUniverse>("QuiverQuantCongresssUniverse", Resolution.Daily, altCoarse =>
{
    return from d in altCoarse 
        where d.Amount > 200000 && d.Transaction == OrderDirection.Buy 
        select d.Symbol;
});

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to US Congress Trading data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The US Congress Trading dataset enables you to take immediate action on trades made by informed Members of Congress. Examples include the following strategies:

 

6.19.6 US Government Contracts

Introduction

The US Government Contracts dataset by Quiver Quantitative tracks the transactions of government contracts with publicly traded companies. The data covers over 700 US Equities, starts in October 2019, and is delivered on a daily frequency. Quiver Quantitative creates this dataset by using the API for USASpending.gov , which has the official open data source of federal spending information. The rows in this dataset only show new contracts, not payments or modifications to existing contracts. The dollar amounts are based on the total dollars obligated from each contract.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Government Contracts dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the US Government Contracts dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverGovernmentContracts, self.symbol).Symbol

self.AddUniverse(QuiverGovernmentContractUniverse, "QuiverGovernmentContractUniverse", Resolution.Daily, self.UniverseSelectionFilter)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverGovernmentContracts>(_symbol).Symbol;

AddUniverse<QuiverGovernmentContractUniverse>("QuiverGovernmentContractUniverse", Resolution.Daily, UniverseSelectionFilter);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date October 15, 2019
Asset Coverage 748 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The US Government Contracts dataset provides QuiverGovernmentContracts , QuiverGovernmentContract , and QuiverGovernmentContractUniverse objects.

QuiverGovernmentContracts

QuiverGovernmentContracts objects have the following attributes:

QuiverGovernmentContract

QuiverGovernmentContract objects have the following attributes:

QuiverGovernmentContractUniverse

QuiverGovernmentContractUniverse objects have the following attributes:

Requesting Data

To add US Government Contracts data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverGovernmentContractsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverGovernmentContracts, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverGovernmentContractsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol= AddData<QuiverGovernmentContracts>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current US Government Contract data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (var dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.Get(QuiverGovernmentContracts).items():
        for data_point in data_points:
            self.Log(f"{dataset_symbol} amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverGovernmentContracts>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoints = kvp.Value;
        foreach(var dataPoint in dataPoints)
        {
            Log($"{datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
        }
    }
}

Historical Data

To get historical US Government Contracts data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverGovernmentContracts](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverGovernmentContracts>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on US Government Contract data, call the AddUniverse method with the QuiverGovernmentContractUniverse class and a selection function.

self.AddUniverse(QuiverGovernmentContractUniverse, "QuiverGovernmentContractUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coase: List[QuiverGovernmentContractUniverse]) -> List[Symbol]:
    gov_contract_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.Symbol
        
        if symbol not in gov_contract_data_by_symbol:
            gov_contract_data_by_symbol[symbol] = []
        gov_contract_data_by_symbol[symbol].append(datum)
    
    return [symbol for symbol, d in gov_contract_data_by_symbol.items()
            if len(d) >= 3 and sum([x.Amount for x in d]) > 50000]
AddUniverse<QuiverGovernmentContractUniverse>("QuiverGovernmentContractUniverse", Resolution.Daily, altCoarse =>
{
    var govContractDataBySymbol = new Dictionary<Symbol, List<QuiverGovernmentContractUniverse>>();

    foreach (var datum in altCoarse)
    {
        var symbol = datum.Symbol;

        if (!govContractDataBySymbol.ContainsKey(symbol))
        {
            govContractDataBySymbol.Add(symbol, new List<QuiverGovernmentContractUniverse>());
        }
        govContractDataBySymbol[symbol].Add(datum);
    }

    return from kvp in govContractDataBySymbol
           where kvp.Value.Count >= 3 && kvp.Value.Sum(x => x.Amount) > 50000m
           select kvp.Key;
});

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to US Government Contracts data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Quiver Quantitative US Government Contracts dataset enables you to create strategies using the latest information on government contracts activity. Examples include the following strategies:

 

6.19.7 WallStreetBets

Introduction

The WallStreetBets dataset by Quiver Quantitative tracks daily mentions of different equities on Reddit’s popular WallStreetBets forum. The data covers 6,000 Equities, starts in August 2018, and is delivered on a daily frequency. The dataset is created by scraping the daily discussion threads on r/WallStreetBets and parsing the comments for ticker mentions.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the WallStreetBets dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the WallStreetBets dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverWallStreetBets, self.symbol).Symbol

self.AddUniverse(QuiverWallStreetBetsUniverse, "QuiverWallStreetBetsUniverse", Resolution.Daily, self.UniverseSelection)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverWallStreetBets>(_symbol).Symbol;

AddUniverse<QuiverWallStreetBetsUniverse>("QuiverWallStreetBetsUniverse", Resolution.Daily, UniverseSelection);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date August 2018
Asset Coverage 6,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The WallStreetBets dataset provides QuiverWallStreetBets and QuiverWallStreetBetsUniverse objects.

QuiverWallStreetBets Attributes

QuiverWallStreetBets objects have the following attributes:

QuiverWallStreetBetsUniverse Attributes

QuiverWallStreetBetsUniverse objects have the following attributes:

Requesting Data

To add WallStreetBets data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverWallStreetBetsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverWallStreetBets, self.symbol).Symbol
namespace QuantConnect
{
    public class QuiverWallStreetBetsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<QuiverWallStreetBets>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current WallStreetBets data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} mentions at {slice.Time}: {data_point.Mentions}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} mentions at {slice.Time}: {dataPoint.Mentions}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(QuiverWallStreetBets).items():
        self.Log(f"{dataset_symbol} mentions at {slice.Time}: {data_point.Mentions}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverWallStreetBets>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} mentions at {slice.Time}: {dataPoint.Mentions}");
    }
}

Historical Data

To get historical WallStreetBets data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverWallStreetBets](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverWallStreetBets>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on WallStreetBets data, call the AddUniverse method with the QuiverWallStreetBetsUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(QuiverWallStreetBetsUniverse, "QuiverWallStreetBetsUniverse", Resolution.Daily, self.UniverseSelection)
        
def UniverseSelection(self, alt_coarse: List[QuiverWallStreetBetsUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.Mentions > 100 \
                and d.Rank < 100]
public override void Initialize()
{
    AddUniverse("QuiverWallStreetBetsUniverse", Resolution.Daily, altCoarse =>
    {
        return from d in altCoarse
            where d.Mentions > 10 && d.Rank > 10
            select d.Symbol;
    });
}

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to WallStreetBets data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The WallStreetBets dataset enables you to create strategies using the latest activity on the WallStreetBets daily discussion thread. Examples include the following strategies:

 

6.19.8 Wikipedia Page Views

Introduction

The Wikipedia Page Views dataset by Quiver Quantitative tracks Wikipedia page views for US Equities. The data covers 1,300 US Equities, starts in October 2016, and is delivered on a daily frequency. This dataset is created by scraping the Wikipedia pages of companies.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Wikipedia Page Views dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the Wikipedia Page Views dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverWikipedia, self.symbol).Symbol

self.AddUniverse(QuiverWikipediaUniverse, "QuiverWikipediaUniverse", Resolution.Daily, self.UniverseSelectionMethod)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverWikipedia>(_symbol).Symbol;

AddUniverse<QuiverWikipediaUniverse>("QuiverWikipediaUniverse", Resolution.Daily, UniverseSelectionMethod);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date October 2016
Asset Coverage 1,300 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The Wikipedia Page Views dataset provides QuiverWikipedia and QuiverWikipediaUniverse objects.

QuiverWikipedia Attributes

QuiverWikipedia objects have the following attributes:

QuiverWikipediaUniverse Attributes

QuiverWikipediaUniverse objects have the following attributes:

Requesting Data

To add Wikipedia Page Views data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverWikipediaPageViewsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverWikipedia, self.symbol).Symbol
namespace QuantConnect
{
    public class QuiverWikipediaPageViewsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol = AddData<QuiverWikipedia>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Wikipedia Page Views data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} weekly page views percentage change at {slice.Time}: {data_point.WeekPercentChange}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} weekly page views percentage change at {slice.Time}: {dataPoint.WeekPercentChange}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(QuiverWikipedia).items():
        self.Log(f"{dataset_symbol} weekly page views percentage change at {slice.Time}: {data_point.WeekPercentChange}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverWikipedia>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} weekly page views percentage change at {slice.Time}: {dataPoint.WeekPercentChange}");
    }
}

Historical Data

To get historical Wikipedia Page Views data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[QuiverWikipedia](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverWikipedia>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Wikipedia Page Views data, call the AddUniverse method with the QuiverWikipediaUniverse class and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(QuiverWikipediaUniverse, "QuiverWikipediaUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverWikipediaUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.PageViews > 100 \
                and d.WeekPercentChange < 0.2]
public override void Initialize()
{
    AddUniverse<QuiverWikipediaUniverse>("QuiverWikipediaUniverse", Resolution.Daily, altCoarse =>
    {
        return from d in altCoarse
                where d.PageViews > 100m && d.MonthPercentChange > 0.2m
                select d.Symbol;
    });
}

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Wikipedia Page Views data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Wikipedia Page Views dataset enables you to observe patterns in the traffic of company Wikipedia pages. Examples include the following strategies:

 

6.20 RegAlytics

RegAlytics was founded by Mary Kopczynski, Aaron Heisler, Alexander Appugliese, and Werner Pauliks in 2019 with the goal of significantly reducing the time and cost required to mitigate regulatory risk. RegAlytics provides access to accurate and clean regulatory data from all global regulators in all sectors that is enriched by regulatory experts for risk and compliance teams everywhere. Please come to RegAlytics directly if you would like data on other sectors or countries!

 

6.20.1 US Regulatory Alerts - Financial Sector

Introduction

The US Regulatory Alerts dataset by RegAlytics tracks US regulatory changes within the financial services sector. The data covers 400,000 alerts, starts from January 2020, and is delivered on a daily basis. This dataset is created by sourcing information from over 5,000 regulators and using proprietary technology to gather and structure the regulatory data. Once prepared, the data is thoroughly reviewed by RegAlytics' team of regulatory experts and delivered each morning by 8AM for industry use.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the US Regulatory Alerts - Financial Sector dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

RegAlytics was founded by Mary Kopczynski, Aaron Heisler, Alexander Appugliese, and Werner Pauliks in 2019 with the goal of significantly reducing the time and cost required to mitigate regulatory risk. RegAlytics provides access to accurate and clean regulatory data from all global regulators in all sectors that is enriched by regulatory experts for risk and compliance teams everywhere. Please come to RegAlytics directly if you would like data on other sectors or countries!

Getting Started

The following snippet demonstrates how to request data from the US Regulatory Alerts - Financial Sector dataset:

from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(RegalyticsRegulatoryArticles, "REG").Symbol
using QuantConnect.DataSource;

_datasetSymbol = AddData<RegalyticsRegulatoryArticles>("REG").Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2020
Coverage 400,000 Alerts
Data Density Sparse
Resolution Daily
Timezone New York

Data Point Attributes

The US Regulatory Alerts dataset provides RegalyticsRegulatoryArticle and RegalyticsRegulatoryArticles objects.

RegalyticsRegulatoryArticle

RegalyticsRegulatoryArticle objects have the following attributes:

RegalyticsRegulatoryArticles

RegalyticsRegulatoryArticles objects have the following attributes:

Requesting Data

To add US Regulatory Alerts data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class RegalyticsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000) 
        
        self.dataset_symbol = self.AddData(RegalyticsRegulatoryArticles, "REG").Symbol
namespace QuantConnect
{
    public class RegalyticsDataAlgorithm : QCAlgorithm
    {
        private Symbol _datasetSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            _datasetSymbol = AddData<RegalyticsRegulatoryArticles>("REG").Symbol;
        }
    }
}

Accessing Data

To get the current US Regulatory Alerts data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} title at {slice.Time}: {data_point.Title}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (var dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} title at {slice.Time}: {dataPoint.Title}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    data = slice.Get(RegalyticsRegulatoryArticles)
    if data:
        for articles in data.values():
            self.Log(f"{self.Time} {articles.ToString()}")
            
            for article in articles:
                self.Log(f"{self.dataset_symbol} article title at {slice.Time}: {article.Title}")
public override void OnData(Slice slice)
{
    var data = slice.Get<RegalyticsRegulatoryArticles>();
    if (!data.IsNullOrEmpty())
    {
        foreach (var articles in data.Values)
        {
            Log($"{Time} {articles.ToString()}");
            foreach (RegalyticsRegulatoryArticle article in articles)
            {
                Log($"{_datasetSymbol} article title at {slice.Time}: {article.Title}");
            }
        }
    }
}

Historical Data

To get historical US Regulatory Alerts data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars =  self.History[RegalyticsRegulatoryArticles](self.dataset_symbol, 100, Resolution.Daily)
var history = History<RegalyticsRegulatoryArticles>(_datasetSymbol, 100, Resolution.Daily);

Remove Subscriptions

To remove your subscription to US Regulatory Alerts data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The US Regulator Alters dataset enables you to accurately design strategies while mitigating regulatory risk. Examples include the following strategies:

 

6.21 Securities and Exchange Commission

The mission of the U.S. Securities and Exchange Commission is to protect investors, maintain fair, orderly, and efficient markets, and facilitate capital formation. The SEC oversees the key participants in the securities world, including securities exchanges, securities brokers and dealers, investment advisors, and mutual funds. The SEC is concerned primarily with promoting the disclosure of important market-related information, maintaining fair dealing, and protecting against fraud.

 

6.21.1 US SEC Filings

Introduction

The US SEC Filings dataset provides the quarterly financial earning reports that the United States Securities and Exchange Commission (SEC) requires from publicly traded companies in the US. The data covers 15,000 US Equities, starts in January 1998, and is delivered on a daily frequency. The data is sourced from the SEC's Electronic Data Gathering, Analysis, and Retrieval (EDGAR) system. QuantConnect downloads and formats the Quarterly Financial Reports (10-Q) and Annual Financial Report (8-K) filings of companies into a format for easy consumption by LEAN.

For more information about the US SEC Filings dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

The mission of the U.S. Securities and Exchange Commission is to protect investors, maintain fair, orderly, and efficient markets, and facilitate capital formation. The SEC oversees the key participants in the securities world, including securities exchanges, securities brokers and dealers, investment advisors, and mutual funds. The SEC is concerned primarily with promoting the disclosure of important market-related information, maintaining fair dealing, and protecting against fraud.

Getting Started

The following snippet demonstrates how to request data from the US SEC Filings dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
self.report_8k_symbol = self.AddData(SECReport8K, self.symbol).Symbol
self.report_10k_symbol = self.AddData(SECReport10K, self.symbol).Symbol
self.report_10q_symbol = self.AddData(SECReport10Q, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_report8KSymbol = AddData<SECReport8K>(_symbol, Resolution.Daily).Symbol;
_report10KSymbol = AddData<SECReport10K>(_symbol, Resolution.Daily).Symbol;
_report10QSymbol = AddData<SECReport10Q>(_symbol, Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1998
Asset Coverage 15,000 US Equities
Data Density Sparse
Resolution Daily
Timezone UTC

Data Point Attributes

The US SEC Filings dataset provides SECReport8K , SECReport10K , and SECReport10Q objects.

Report 8K Attributes

SECReport8K objects have the following attributes:

Report 10K Attributes

SECReport10K objects have the following attributes:

Report 10Q Attributes

SECReport10Q objects have the following attributes:

Requesting Data

To add US SEC Filings data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class SECReportAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2019, 8, 21)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
        self.report_8k_symbol = self.AddData(SECReport8K, self.symbol).Symbol
        self.report_10k_symbol = self.AddData(SECReport10K, self.symbol).Symbol
        self.report_10q_symbol = self.AddData(SECReport10Q, self.symbol).Symbol
namespace QuantConnect
{
    public class SECReportAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _report8KSymbol, _report10KSymbol, _report10QSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2019, 8, 21);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _report8KSymbol = AddData<SECReport8K>(_symbol, Resolution.Daily).Symbol;
            _report10KSymbol = AddData<SECReport10K>(_symbol, Resolution.Daily).Symbol;
            _report10QSymbol = AddData<SECReport10Q>(_symbol, Resolution.Daily).Symbol;
        }
    }
}

Accessing Data

To get the current US SEC Filings data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.report_8k_symbol):
        data_point = slice[self.report_8k_symbol]
        self.Log(f"{self.report_8k_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")

    if slice.ContainsKey(self.report_10k_symbol):
        data_point = slice[self.report_10k_symbol]
        self.Log(f"{self.report_10k_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")

    if slice.ContainsKey(self.report_10q_symbol):
        data_point = slice[self.report_10q_symbol]
        self.Log(f"{self.report_10q_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_report8KSymbol))
    {
        var dataPoint = slice[_report8KSymbol];
        Log($"{_report8KSymbol} report count at {slice.Time}: {data_point.Report.Documents.Count}");
    }

    if (slice.ContainsKey(_report10KSymbol))
    {
        var dataPoint = slice[_report10KSymbol];
        Log($"{_report10KSymbol} report count at {slice.Time}: {data_point.Report.Documents.Count}");
    }

    if (slice.ContainsKey(_report10QSymbol))
    {
        var dataPoint = slice[_report10QSymbol];
        Log($"{_report10QSymbol} report count at {slice.Time}: {data_point.Report.Documents.Count}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(SECReport8K).items():
        self.Log(f"{dataset_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")

    for dataset_symbol, data_point in slice.Get(SECReport10K).items():
        self.Log(f"{dataset_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")

    for dataset_symbol, data_point in slice.Get(SECReport10Q).items():
        self.Log(f"{dataset_symbol} report count at {slice.Time}: {len(data_point.Report.Documents)}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<SECReport8K>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report count at {slice.Time}: {dataPoint.Report.Documents.Count}");
    }

    foreach (var kvp in slice.Get<SECReport10K>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report count at {slice.Time}: {dataPoint.Report.Documents.Count}");
    }

    foreach (var kvp in slice.Get<SECReport10Q>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} report count at {slice.Time}: {dataPoint.Report.Documents.Count}");
    }
}

Historical Data

To get historical US SEC Filings data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
report_8k_history_df = self.History(self.report_8k_symbol, 100, Resolution.Daily)
report_10k_history_df = self.History(self.report_10k_symbol, 100, Resolution.Daily)
report_10q_history_df = self.History(self.report_10q_symbol, 100, Resolution.Daily)
history_df = self.History([self.report_8k_symbol, 
                           self.report_10k_symbol,
                           self.report_10q_symbol], 100, Resolution.Daily)

# Dataset objects
report_8k_history_bars = self.History[SECReport8K](self.report_8k_symbol, 100, Resolution.Daily)
report_10k_history_bars = self.History[SECReport10K](self.report_10k_symbol, 100, Resolution.Daily)
report_10q_history_bars = self.History[SECReport10Q](self.report_10q_symbol, 100, Resolution.Daily)
// Dataset objects
var report8KHistory = History<SECReport8K>(_report8KSymbol, 100, Resolution.Daily);
var report10KHistory = History<SECReport10K>(_report10KSymbol, 100, Resolution.Daily);
var report10QHistory = History<SECReport10Q>(_report10QSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_report8KSymbol, _report10KSymbol, _report10QSymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.report_8k_symbol)
self.RemoveSecurity(self.report_10k_symbol)
self.RemoveSecurity(self.report_10q_symbol)
RemoveSecurity(_report8KSymbol);
RemoveSecurity(_report10KSymbol);
RemoveSecurity(_report10QSymbol);

If you subscribe to US SEC Filings data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The US SEC Filings dataset enables you to create strategies using information from SEC reports. Examples include the following strategies:

 

6.22 Smart Insider

Smart Insider was founded by Michael Tindale in 2016 with the goal of forming the most progressive insider data vendor in the field. Smart Insider provides access to buyback intention and transactions for quantitative researchers. In addition to their Corporate Buybacks dataset, Smart Insider provides data on stock trades made by US politicians and thousands of high net worth individuals around the globe.

 

6.22.1 Corporate Buybacks

Introduction

The Corporate Buybacks dataset by Smart Insider tracks US Equities share buyback programs. The data covers 3,000 US Equities, starts in May 2015, and is delivered on a second frequency. This dataset is created by analyzing daily buyback announcements and by using secondary data sources to ensure records are accurate and complete.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Corporate Buybacks dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Smart Insider was founded by Michael Tindale in 2016 with the goal of forming the most progressive insider data vendor in the field. Smart Insider provides access to buyback intention and transactions for quantitative researchers. In addition to their Corporate Buybacks dataset, Smart Insider provides data on stock trades made by US politicians and thousands of high net worth individuals around the globe.

Getting Started

The following snippet demonstrates how to request data from the Corporate Buybacks dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
self.intention_symbol = self.AddData(SmartInsiderIntention, self.symbol).Symbol
self.transaction_symbol = self.AddData(SmartInsiderTransaction, self.symbol).Symbol

self.AddUniverse(SmartInsiderIntentionUniverse, "SmartInsiderIntentionUniverse", Resolution.Daily, self.IntentionSelection)
self.AddUniverse(SmartInsiderTransactionUniverse, "SmartInsiderTransactionUniverse", Resolution.Daily, self.TransactionSelection)
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
_intentionSymbol = AddData<SmartInsiderIntention>(_symbol).Symbol;
_transactionSymbol = AddData<SmartInsiderTransaction>(_symbol).Symbol;

AddUniverse<SmartInsiderIntentionUniverse>("SmartInsiderIntentionUniverse", Resolution.Daily, IntentionSelection);
AddUniverse<SmartInsiderTransactionUniverse>("SmartInsiderTransactionUniverse", Resolution.Daily, TransactionSelection);

Data Summary

The following table describes the dataset properties:

Property Value
Start Date May 2015
Asset Coverage 3,000 US Equities
Data Density Sparse
Resolution Second
Timezone New York

Data Point Attributes

The Corporate Buybacks dataset provides SmartInsiderIntention , SmartInsiderIntentionUniverse , SmartInsiderTransaction , and SmartInsiderTransactionUniverse objects.

SmartInsiderIntention Attributes

SmartInsiderIntention objects have the following attributes:

SmartInsiderIntentionUniverse Attributes

SmartInsiderIntentionUniverse objects have the following attributes:

SmartInsiderTransaction Attributes

SmartInsiderTransaction objects have the following attributes:

SmartInsiderTransactionUniverse Attributes

SmartInsiderTransactionUniverse objects have the following attributes:

Requesting Data

To add Corporate Buybacks data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class CorporateBuybacksDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2016, 1, 1)
        self.SetEndDate(2021, 1, 1)
        self.SetCash(100000)
 
        self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
        self.intention_symbol = self.AddData(SmartInsiderIntention, self.symbol).Symbol
        self.transaction_symbol = self.AddData(SmartInsiderTransaction, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class CorporateBuybacksDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _intentionSymbol, _transactionSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2016, 1, 1);
            SetEndDate(2021, 1, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
            _intentionSymbol = AddData<SmartInsiderIntention>(_symbol).Symbol;
            _transactionSymbol = AddData<SmartInsiderTransaction>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Corporate Buybacks data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.intention_symbol):
        data_point = slice[self.intention_symbol]
        self.Log(f"{self.intention_symbol} intention amount at {slice.Time}: {data_point.Amount}")

    if slice.ContainsKey(self.transaction_symbol):
        data_point = slice[self.transaction_symbol]
        self.Log(f"{self.transaction_symbol} transaction amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_intentionSymbol))
    {
        var dataPoint = slice[_intentionSymbol];
        Log($"{_intentionSymbol} intention amount at {slice.Time}: {dataPoint.Amount}");
    }

    if (slice.ContainsKey(_transactionSymbol))
    {
        var dataPoint = slice[_transactionSymbol];
        Log($"{_transactionSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}");
    }
}

To iterate through all of the dataset objects in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.Get(SmartInsiderIntention).items():
        self.Log(f"{dataset_symbol} intention amount at {slice.Time}: {data_point.Amount}")

    for dataset_symbol, data_point in slice.Get(SmartInsiderTransaction).items():
        self.Log(f"{dataset_symbol} transaction amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<SmartInsiderIntention>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} intention amount at {slice.Time}: {dataPoint.Amount}");
    }

    foreach (var kvp in slice.Get<SmartInsiderTransaction>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}");
    }
}

Historical Data

To get historical Corporate Buybacks data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrames
intention_history_df = self.History(self.intention_symbol, 100, Resolution.Daily)
transaction_history_df = self.History(self.transaction_symbol, 100, Resolution.Daily)
history_df = self.History([self.intention_symbol, self.transaction_symbol], 100, Resolution.Daily)

# Dataset objects
intention_history_bars = self.History[SmartInsiderIntention](self.intention_symbol, 100, Resolution.Daily)
transaction_history_bars = self.History[SmartInsiderTransaction](self.transaction_symbol, 100, Resolution.Daily)
// Dataset objects
var intentionHistory = History<SmartInsiderIntention>(_intentionSymbol, 100, Resolution.Daily);
var transactionHistory = History<SmartInsiderTransaction>(_transactionSymbol, 100, Resolution.Daily);

// Slice objects
var history = History(new[] {_intentionSymbol, _transactionSymbol}, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Universe Selection

To select a dynamic universe of US Equities based on Corporate Buybacks data, call the AddUniverse method with the SmartInsiderIntentionUniverse class or the SmartInsiderTransactionUniverse and a selection function.

def Initialize(self) -> None:
    self.AddUniverse(SmartInsiderIntentionUniverse, "SmartInsiderIntentionUniverse", Resolution.Daily, self.IntentionSelection)
    self.AddUniverse(SmartInsiderTransactionUniverse, "SmartInsiderTransactionUniverse", Resolution.Daily, self.TransactionSelection)

def IntentionSelection(self, alt_coarse: List[SmartInsiderIntentionUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.Percentage > 0.005 \
                and d.USDMarketCap > 100000000]

def TransactionSelection(self, alt_coarse: List[SmartInsiderTransactionUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.BuybackPercentage > 0.005 \
                and d.USDMarketCap > 100000000]
public override void Initialize()
{
    AddUniverse("SmartInsiderIntentionUniverse", Resolution.Daily, IntentionSelection);
    AddUniverse("SmartInsiderTransactionUniverse", Resolution.Daily, TransactionSelection);
}

private IEnumerable<Symbol> IntentionSelection(IEnumerable<SmartInsiderIntentionUniverse> altCoarse)
{
    return from d in altCoarse 
        where d.Percentage > 0.005m && d.USDMarketCap > 100000000m
        select d.Symbol;
}

private IEnumerable<Symbol> TransactionSelection(IEnumerable<SmartInsiderTransactionUniverse> altCoarse)
{
    return from d in altCoarse 
        where d.BuybackPercentage > 0.005m && d.USDMarketCap > 100000000m
        select d.Symbol;
}

For more information about dynamic universes, see Universes .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.intention_symbol)
self.RemoveSecurity(self.transaction_symbol)
RemoveSecurity(_intentionSymbol);
RemoveSecurity(_transactionSymbol);

If you subscribe to Corporate Buybacks data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Corporate Buybacks dataset enables you to design strategies using information on company buyback programs. Examples include the following strategies:

 

6.23 Tiingo

Tiingo was founded by Rishi Singh in 2014. Tiingo goes beyond traditional news sources and focuses on finding rich, quality content written by knowledgeable writers. Their proprietary algorithms scan unstructured, non-traditional news and other information sources while tagging companies, topics, and assets. This refined system is backed by over ten years of research and development, and is written by former institutional quant traders. Because of this dedicated approach, Tiingo"s News API is a trusted tool used by quant funds, hedge funds, pension funds, social media companies, and tech companies around the world.

 

6.23.1 Tiingo News Feed

Introduction

The Tiingo News Feed dataset by Tiingo tracks US Equity news releases. The data covers 10,000 US Equities, starts in January 2014, and is delivered on a second frequency. This dataset is creating by Tiingo integrating over 120 different news providers into their platform.

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Tiingo News Feed dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

Tiingo was founded by Rishi Singh in 2014. Tiingo goes beyond traditional news sources and focuses on finding rich, quality content written by knowledgeable writers. Their proprietary algorithms scan unstructured, non-traditional news and other information sources while tagging companies, topics, and assets. This refined system is backed by over ten years of research and development, and is written by former institutional quant traders. Because of this dedicated approach, Tiingo's News API is a trusted tool used by quant funds, hedge funds, pension funds, social media companies, and tech companies around the world.

Getting Started

The following snippet demonstrates how to request data from the Tiingo News Feed dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
self.dataset_symbol = self.AddData(TiingoNews, self.symbol).Symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
_datasetSymbol = AddData<TiingoNews>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 2014
Asset Coverage 10,000 US Equities
Data Density Sparse
Resolution Second
Timezone UTC

Data Point Attributes

The Tiingo News Feed dataset provides TiingoNews objects, which have the following attributes:

Requesting Data

To add Tiingo News Feed data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class TiingoNewsDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Minute).Symbol
        self.dataset_symbol = self.AddData(TiingoNews, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class TiingoNewsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);

            _symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
            _datasetSymbol = AddData<TiingoNews>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Tiingo News Feed data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        article = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} article description at {slice.Time}: {article.Description}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var article = slice[_datasetSymbol];
        Log($"{_datasetSymbol} article description at {slice.Time}: {article.Description}");
    }
}

To iterate through all of the articles in the current Slice , call the Get method.

def OnData(self, slice: Slice) -> None:
    for dataset_symbol, article in slice.Get(TiingoNews).items():
        self.Log(f"{dataset_symbol} article description at {slice.Time}: {article.Description}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<TiingoNews>())
    {
        var datasetSymbol = kvp.Key;
        var article = kvp.Value;
        Log($"{datasetSymbol} article description at {slice.Time}: {article.Description}");
    }
}

Historical Data

To get historical Tiingo News Feed data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
self.History[TiingoNews](self.dataset_symbol, 100, Resolution.Daily)
var history = History<TiingoNews>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Tiingo News Feed data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes .

Example Applications

The Tiingo News Feed enables you to accurately design strategies harnessing news articles on the companies you're trading. Examples include the following strategies:

 

6.24 Treasury Department

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation"s financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

 

6.24.1 US Treasury Yield Curve

Introduction

The US Treasury Yield Curve datasets tracks the yield curve rate from the US Department of the Treasury. The data starts in January 1990 and is delivered on a daily frequency. This dataset is calculated from composites of indicative, bid-side market quotations (not actual transactions) obtained by the Federal Reserve Bank of New York at or near 3:30 PM Eastern Time (ET) each trading day.

For more information about the US Treasury Yield Curve dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

The Treasury Department is the executive agency responsible for promoting economic prosperity and ensuring the financial security of the United States. The Department is responsible for a wide range of activities such as advising the President on economic and financial issues, encouraging sustainable economic growth, and fostering improved governance in financial institutions. The Department of the Treasury operates and maintains systems that are critical to the nation's financial infrastructure, such as the production of coin and currency, the disbursement of payments to the American public, revenue collection, and the borrowing of funds necessary to run the federal government.

Getting Started

The following snippet demonstrates how to request data from the US Treasury Yield Curve dataset:

from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(USTreasuryYieldCurveRate, "USTYCR").Symbol
using QuantConnect.DataSource;

_datasetSymbol = AddData<USTreasuryYieldCurveRate>("USTYCR").Symbol;

Data Summary

The following table describes the dataset properties:

Property Value
Start Date January 1990
Coverage 1 Dataset
Data Density Sparse
Resolution Daily
Timezone New York

Data Point Attributes

The US Treasury Yield Curve dataset provides USTreasuryYieldCurveRate objects, which have the following attributes:

Requesting Data

To add US Treasury Yield Curve data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverCongressDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.dataset_symbol = self.AddData(USTreasuryYieldCurveRate, "USTYCR").Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class USTreasuryYieldCurveDataAlgorithm : QCAlgorithm
    {
        private Symbol _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);

            _datasetSymbol = AddData<USTreasuryYieldCurveRate>("USTYCR").Symbol;
        }
    }
}

Accessing Data

To get the current US Treasury Yield Curve data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} one month value at {slice.Time}: {data_point.OneMonth}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} one month value at {slice.Time}: {dataPoint.OneMonth}");
    }
}

Historical Data

To get historical US Treasury Yield Curve data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[USTreasuryYieldCurveRate](self.dataset_symbol, 100, Resolution.Daily)
var history = History<USTreasuryYieldCurveRate>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove your subscription to US Treasury Yield Curve data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The US Treasury Yield Curve dataset enables you to monitor the yields of bonds with numerous maturities in your strategies. Examples include the following strategies:

 

6.25 VIX Central

VIX Central was founded by Eli Mintz in 2012 with goal of displaying historical VIX term structures in a simple and intuitive interface. VIX Central provides access to real-time and historical VIX data for individual investors.

 

6.25.1 VIX Central Contango

Introduction

The VIX Central Contango dataset by VIX Central tracks VIX Futures (VX) contango data. The data covers 12 Futures contracts closest to expiry/maturity, starts in June 2010, and is delivered on a daily frequency. The dataset is created by QuantConnect downloading data from VIX Central website, which collects and analyses VIX and VX (VIX Futures) data.

Contango and Backwardation are terms used to describe if participants in the Futures market are overpaying or underpaying relative to the "spot" price of the underlying commodity when trading a Futures contract ("spot" price is the price of the actual commodity/asset at a given moment in time). Contango and backwardation can be used to determine forward-looking expectations of the commodity's spot price by the time the Future has expired/matured and is set to be delivered by participants of the Futures market. As Futures near their expiration/maturity date, contango and backwardation curves tend to converge on the spot price of the commodity at the time of expiration.

For more information about the VIX Central Contango dataset, including CLI commands and pricing, see the dataset listing .

About the Provider

VIX Central was founded by Eli Mintz in 2012 with goal of displaying historical VIX term structures in a simple and intuitive interface. VIX Central provides access to real-time and historical VIX data for individual investors.

Getting Started

The following snippet demonstrates how to request data from the VIX Central Contango dataset:

using QuantConnect.DataSource;

_datasetSymbol = AddData<VIXCentralContango>("VIX", Resolution.Daily).Symbol;
from QuantConnect.DataSource import *

self.dataset_symbol = self.AddData(VIXCentralContango, "VIX", Resolution.Daily).Symbol

Data Summary

The following table describes the dataset properties:

Property Value
Start Date June 2010
Asset Coverage 1 Futures Chain with 12 contracts
Data Density Regular
Resolution Daily
Timezone New York

Data Point Attributes

The VIX Central Contango dataset provides VIXCentralContango objects, which have the following attributes:

Requesting Data

To add VIX Central Contango data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class VixCentralContangoAlgorithm(QCAlgorithm):
 
    def Initialize(self) -> None:
        self.SetStartDate(2014, 1, 1)
        self.SetEndDate(2018, 1, 1)
        self.SetCash(25000)
 
        self.dataset_symbol = self.AddData(VIXCentralContango, "VX", Resolution.Daily).Symbol
namespace QuantConnect
{
    public class VixCentralContangoAlgorithm : QCAlgorithm
    {
        private Symbol _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2014, 1, 1);
            SetEndDate(2018, 1, 1);
            SetCash(25000);

            _datasetSymbol = AddData<VIXCentralContango>("VX", Resolution.Daily).Symbol;
        }
    }
}

Accessing Data

To get the current VIX Central Contango data, index the current Slice with the dataset Symbol . Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} front month at {slice.Time}: {data_point.FrontMonth}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} front month at {slice.Time}: {dataPoint.FrontMonth}");
    }
}

Historical Data

To get historical VIX Central Contango data, call the History method with the dataset Symbol . If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.dataset_symbol, 100, Resolution.Daily)

# Dataset objects
history_bars = self.History[VIXCentralContango](self.dataset_symbol, 100, Resolution.Daily)
var history = History<VIXCentralContango>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests .

Remove Subscriptions

To remove your subscription to VIX Central Contango data, call the RemoveSecurity method.

self.RemoveSecurity(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

Example Applications

The VIX Central Contango dataset enable you to explore VIX Future contracts pricing data. Examples include the following strategies:

 

7 Importing Data

7.1 Key Concepts

Introduction

Custom data is your own external data that's not from the Dataset Market. You can use custom data to inform trading decisions and to simulate trades on unsupported securities. To get custom data into your algorithms, you download the entire file at once or read it line-by-line with a custom data reader. If you use a custom data reader, LEAN sends the data to the OnData method in your algorithm.

Stream Custom Data

To receive your custom data in the OnData method, create a custom type and then create a data subscription. The custom data type tells LEAN where to get your data and how to read it.

All custom data types must extend the BaseData PythonData class and override the GetSource and Reader methods

public class MyCustomDataType : BaseData
{
    public override DateTime EndTime { get; set; }
    public decimal Property1 { get; set; } = 0;

    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLive)
    {
        return new SubscriptionDataSource("<sourceURL>", SubscriptionTransportMedium.RemoteFile);
    }

    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLive)
    {
        if (string.IsNullOrWhiteSpace(line.Trim()) || char.IsDigit(line[0]))
        {
            return null;
        }

        var data = line.Split(',');
        return new MyCustomDataType()
        {
            Time = DateTime.ParseExact(data[0], "yyyyMMdd", CultureInfo.InvariantCulture),
            EndTime = Time.AddDays(1),
            Symbol = config.Symbol,
            Value = data[1].IfNotNullOrEmpty(
                s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture)),
            Property1 = data[2].IfNotNullOrEmpty(
                s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture))
        };
    }
}
class MyCustomDataType(PythonData):
    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource("<sourceURL>", SubscriptionTransportMedium.RemoteFile)

    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLive: bool) -> BaseData:

         if not (line.strip() and line[0].isdigit()):
            return None

         data = line.split(',')

        custom = MyCustomDataType()
        custom.Time = datetime.strptime(data[0], '%Y%m%d')
        custom.EndTime = custom.Time + timedelta(1)
        custom.Value = float(data[1])
        custom["Property1"] = float(data[2])
        return custom

For more information about custom data types, see Streaming Data .

Download Bulk Data

The Download method downloads the content served from a local file or URL and then returns it as a string.

var content = Download("<filePathOrURL>");
content = self.Download("<filePathOrURL>")

For more information about bulk downloads, see Bulk Downloads .

Remote File Providers

The most common remote file providers to use are Dropbox, GitHub, and Google Sheets.

Dropbox

If you store your custom data in Dropbox, you need to create a link to the file and add ?dl=1 to the end of the file URL. To create file links, see How to share files or folders in the Dropbox documentation. The ?dl=1 parameter lets you download the direct file link, not the HTML page of the file.

GitHub

If you store your custom data in GitHub, you can use public or private repositories. When you download the data, use the raw file (for example, https://raw.githubusercontent.com/<organization>/<repo>/<path> ). For instructions on accessing the raw file, see Viewing or copying the raw file content in the GitHub documentation.

Google Sheets

If you store your custom data in Google Sheets, you need to create a link to the file. To create file links, see Make Google Docs, Sheets, Slides & Forms public in the Google Docs documentation. Choose the CSV format to find /pub?gid={SHEET_ID}&single=true&output=csv parameter on the end of the link. Google Sheets don't support exporting data in JSON format.

File Quotas

The following table shows the number of files you can download during a single backtest or Research Environment session in QuantConnect Cloud:

Organization Tier File Quota
Free 25
Quant Researcher 100
Team 250
Trading Firm 1,000
Free Unlimited

Each file can be up to 200 MB in size and have a file name up to 200 characters long.

If you need to import more files than your quota allows, save your custom data files in the Object Store and load them from there.

Rate Limits

We do not impose a rate limit on file downloads but often external providers do. Dropbox caps download speeds to 10 kb/s after 3-4 download requests. To ensure your algorithms run fast, only use a small number of small custom data files.

Timeouts

In cloud algorithms, the download methods have a 10-second timeout period. If the methods don't download the data within 10 seconds, LEAN throws an error.

 

7.2 Streaming Data

7.2.1 Key Concepts

Introduction

There are two techniques to import data into your algorithm. You can either manually import the entire file or stream the file line-by-line into your algorithm's OnData event. This page explores streaming a file's contents into your algorithm line-by-line.

Data Formats

Common data formats are CSV , JSON , and XML , but you can use any file type that can be read over the internet. Each request has a one-second overhead, so you should package your custom data to minimize requests. Bundle dates together where possible to speed up execution. Just ensure the data in the file is in chronological order.

For Excel files, please double check the raw data format for parsing in the data reader, since data will be formatted for convenient visualization in Excel application view. To avoid confusion of data format, save the spreadsheet as a CSV file and open it in a text editor to confirm the raw data format.

Set Data Sources

The GetSource method in your custom data class instructs LEAN where to find the data. This method must return a SubscriptionDataSource object, which contains the data location and format.

The following table describes the arguments the SubscriptionDataSource accepts:

Argument Data Type Description Default Value
source string str Data source location
transportMedium SubscriptionTransportMedium The transport medium to be used to retrieve data from the source
format FileFormat The format of the data within the source FileFormat.Csv
headers IEnumerable<KeyValuePair<string, string>> The headers to be used for this source. In cloud algorithms, each of the key-value pairs can consist of up to 1,000 characters. null None

The SubscriptionTransportMedium enumeration has the following members:

The FileFormat enumeration has the following members:

The following table describes the arguments the GetSource method accepts:

Argument Data Type Description
config SubscriptionDataConfig The subscription configuration
date DateTime datetime Date of this source file
isLiveMode bool true True if algorithm is running in live mode

You can use these arguments to create SubscriptionDataSource objects representing different locations and formats.

public class MyCustomDataType : BaseData
{
    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLiveMode)
    {
        if (isLiveMode)
        {
            return new SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.Rest);
        }

        var source = $"http://my-ftp-server.com/{config.Symbol.Value}/{date:yyyyMMdd}.csv";
        return new SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile);
    }
}
class MyCustomDataType(PythonData):
    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLiveMode: bool) -> SubscriptionDataSource:
        
         if isLiveMode:
            return SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.Rest)

        source = f"http://my-ftp-server.com/{config.Symbol.Value}/{date:%Y%M%d}.csv"
        return SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile)

Parse Custom Data

The Reader method of your custom data class takes one line of data from the source location and parses it into one of your custom objects. You can add as many properties to your custom data objects as you need, but the following table describes the properties you must set. When there is no useable data in a line, the method should return null None . LEAN repeatedly calls the Reader method until the date/time advances or it reaches the end of the file.

Property Description
Symbol You can set this property to config.Symbol .
Time The time when the data sample starts.
EndTime The time when the data sample ends and when LEAN should add the sample to a Slice .
Value The default data point value.

The following table describes the arguments the Reader method accepts:

Argument Data Type Description
config SubscriptionDataConfig The subscription configuration
line string str Content from the requested data source
date DateTime datetime Date of this source file
isLiveMode bool true True if algorithm is running in live mode

You can use these arguments to create BaseData objects from different sources.

public class MyCustomDataType : BaseData
{
    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLiveMode)
    {
        if (string.IsNullOrWhiteSpace(line.Trim()))
        {
            return null;
        }

        if (isLiveMode)
        {
            var custom = JsonConvert.DeserializeObject<MyCustomDataType>(line);
            custom.EndTime = DateTime.UtcNow.ConvertFromUtc(config.ExchangeTimeZone);
            return custom;
        }

        if (!char.IsDigit(line[0]))
        {
            return null;
        }

        var data = line.Split(',');
        return new MyCustomDataType()
        {
            Time = DateTime.ParseExact(data[0], "yyyyMMdd", CultureInfo.InvariantCulture),
            EndTime = Time.AddDays(1),
            Symbol = config.Symbol,
            Value = data[1].IfNotNullOrEmpty(
                s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture)),
        };
    }
}
class MyCustomDataType(PythonData):
    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLiveMode: bool) -> BaseData:

        if not line.strip():
            return None

        custom = MyCustomDataType()
        custom.Symbol = config.Symbol

        if isLiveMode:
            data = json.loads(line)
            custom.EndTime =  Extensions.ConvertFromUtc(datetime.utcnow(), config.ExchangeTimeZone)
            custom.Value = data["value"]
            return custom

        if not line[0].isdigit():
            return None

        data = line.split(',')
        custom.EndTime = datetime.strptime(data[0], '%Y%m%d') + timedelta(1)
        custom.Value = float(data[1])
        return custom

Demonstration Algorithm

The following example algorithm implements a custom data source for the Bitstamp API.

using Newtonsoft.Json;

namespace QuantConnect.Algorithm.CSharp
{
    public class CustomDataBitstampAlgorithm : QCAlgorithm
    {
        private Symbol _customDataSymbol;

        public override void Initialize()
        {
            SetStartDate(2012, 9, 13);
            SetEndDate(2021, 6, 20);

            _customDataSymbol = AddData<Bitstamp>("BTC", Resolution.Daily).Symbol;

            var history = History<Bitstamp>(_customDataSymbol, 200, Resolution.Daily);
            Debug($"We got {history.Count()} items from historical data request of {_customDataSymbol}.");
        }

        public void OnData(Bitstamp data)
        {
            Log($"{data.EndTime}: Close: {data.Close}");
            Plot(_customDataSymbol, "Price", data.Close);
        }

        public class Bitstamp : BaseData
        {
            [JsonProperty("timestamp")]
            public int Timestamp = 0;
            [JsonProperty("open")]
            public decimal Open = 0;
            [JsonProperty("high")]
            public decimal High = 0;
            [JsonProperty("low")]
            public decimal Low = 0;
            [JsonProperty("last")]
            public decimal Close = 0;
            [JsonProperty("bid")]
            public decimal Bid = 0;
            [JsonProperty("ask")]
            public decimal Ask = 0;
            [JsonProperty("vwap")]
            public decimal WeightedPrice = 0;
            [JsonProperty("volume")]
            public decimal VolumeBTC = 0;
            public decimal VolumeUSD = 0;

            public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
            {
                if (isLiveMode)
                {
                    return new SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.Rest);
                }

                var source = "https://raw.githubusercontent.com/QuantConnect/Documentation/master/Resources/datasets/custom-data/bitstampusd.csv";
                return new SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile);
            }

            public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
            {
                if (string.IsNullOrWhiteSpace(line.Trim()))
                {
                    return null;
                }

                var coin = new Bitstamp() {Symbol = config.Symbol};

                if (isLiveMode)
                {
                    //Example Line Format:
                    //{"high": "441.00", "last": "421.86", "timestamp": "1411606877", "bid": "421.96", "vwap": "428.58", "volume": "14120.40683975", "low": "418.83", "ask": "421.99"}
                    coin = JsonConvert.DeserializeObject<Bitstamp>(line);
                    coin.EndTime = DateTime.UtcNow.ConvertFromUtc(config.ExchangeTimeZone);
                    coin.Time = coin.EndTime.AddDays(-1);
                    coin.Value = coin.Close;
                    return coin;
                }

                //Example Line Format:
                //Date      Open   High    Low     Close   Volume (BTC)    Volume (Currency)   Weighted Price
                //2011-09-13 5.8    6.0     5.65    5.97    58.37138238,    346.0973893944      5.929230648356
                if (!char.IsDigit(line[0]))
                {
                    return null;
                }

                var data = line.Split(',');
                coin.Value = data[4].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                if (coin.Value == 0)
                {
                    return null;
                }

                coin.Time = DateTime.Parse(data[0], CultureInfo.InvariantCulture);
                coin.EndTime = coin.Time.AddDays(1);
                coin.Open = data[1].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.High = data[2].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.Low = data[3].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.VolumeBTC = data[5].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.VolumeUSD = data[6].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.WeightedPrice = data[7].IfNotNullOrEmpty(s => decimal.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
                coin.Close = coin.Value;
                return coin;
            }
        }
    }
}
class CustomDataBitstampAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2012, 9, 13)
        self.SetEndDate(2021, 6, 20)
        self.SetCash(100000)

        # Define the symbol and "type" of our generic data:
        self.custom_data_symbol = self.AddData(Bitstamp, "BTC").Symbol

        history = self.History(Bitstamp, self.custom_data_symbol, 200, Resolution.Daily)
        self.Debug(f"We got {len(history)} items from historical data request of {self.custom_data_symbol}.")


    def OnData(self, slice):
        if self.custom_data_symbol not in slice:
            return

        data = slice[self.custom_data_symbol]
        self.Log(f'{data.EndTime}: Close: {data.Close}')
        self.Plot(self.custom_data_symbol, 'Price', data.Close)


class Bitstamp(PythonData):

    def GetSource(self, config, date, isLiveMode):
        if isLiveMode:
            return SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.Rest)

        source = "https://raw.githubusercontent.com/QuantConnect/Documentation/master/Resources/datasets/custom-data/bitstampusd.csv"
        return SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile)

    def Reader(self, config, line, date, isLiveMode):

        if not line.strip():
            return None

        coin = Bitstamp()
        coin.Symbol = config.Symbol

        if isLiveMode:
            # Example Line Format:
            # {"high": "441.00", "last": "421.86", "timestamp": "1411606877", "bid": "421.96", "vwap": "428.58", "volume": "14120.40683975", "low": "418.83", "ask": "421.99"}
            liveBTC = json.loads(line)

            # If value is zero, return None
            coin.Value = float(liveBTC["last"])
            if coin.Value == 0:
                return None

            coin.EndTime =  Extensions.ConvertFromUtc(datetime.utcnow(), config.ExchangeTimeZone)
            coin.Time = coin.EndTime - timedelta(1)
            coin["Open"] = float(liveBTC["open"])
            coin["High"] = float(liveBTC["high"])
            coin["Low"] = float(liveBTC["low"])
            coin["Close"] = coin.Value
            coin["Ask"] = float(liveBTC["ask"])
            coin["Bid"] = float(liveBTC["bid"])
            coin["VolumeBTC"] = float(liveBTC["volume"])
            coin["WeightedPrice"] = float(liveBTC["vwap"])
            return coin

        # Example Line Format:
        # Date      Open   High    Low     Close   Volume (BTC)    Volume (Currency)   Weighted Price
        # 2011-09-13 5.8    6.0     5.65    5.97    58.37138238,    346.0973893944      5.929230648356
        if not line[0].isdigit():
            return None

        data = line.split(',')

        # If value is zero, return None
        coin.Value = float(data[4])
        if coin.Value == 0:
            return None

        coin.Time = datetime.strptime(data[0], "%Y-%m-%d")
        coin.EndTime = coin.Time + timedelta(1)
        coin["Open"] = float(data[1])
        coin["High"] = float(data[2])
        coin["Low"] = float(data[3])
        coin["Close"] = coin.Value
        coin["VolumeBTC"] = float(data[5])
        coin["VolumeUSD"] = float(data[6])
        coin["WeightedPrice"] = float(data[7])
        return coin

To save this algorithm to your cloud projects, clone it clone it .

 

7.2.2 Custom Securities

7.2.2.1 Key Concepts

Introduction

To receive your custom data in the OnData method instead of in a bulk download, create a custom type and then create a data subscription. The custom data type tells LEAN where to get your data and how to read it. All custom data types must extend from BaseData PythonData and override the Reader and GetSource methods.

Unlike custom data, native QC data gets the full benefit of security modeling like splits and dividends. Custom data is ignorant of everything about the actual market. Things like market hours, delistings, and mergers don't work with custom data.

Create Subscriptions

After you define the custom data class, in the Initialize method of your algorithm, call the AddData<T>(string ticker, Resolution resolution = Resolution.Daily) method. This method gives LEAN the T-type factory to create the objects, the name of the data, and the resolution at which to poll the data source for updates. self.AddData(Type class, string ticker, Resolution resolution = Resolution.Daily) method. This method gives LEAN the type factory to create the data objects, the name of the data, and the resolution to poll the data source for updates.

public class MyAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    public override void Initialize()
    {
        _symbol = AddData<MyCustomDataType>("<name>", Resolution.Daily).Symbol;
    }
}
class MyAlgorithm(QCAlgorithm): 
    def Initialize(self) -> None:
        self.symbol = self.AddData(MyCustomDataType, "<name>", Resolution.Daily).Symbol
    

The resolution argument should match the resolution of your custom dataset. The lowest reasonable resolution is every minute. Anything more frequent than every minute is very slow to execute. The frequency that LEAN checks the data source depends on the resolution argument. The following table shows the polling frequency of each resolution:

Resolution Update Frequency
Daily Every 30 minutes
Hour Every 30 minutes
Minute Every minute
Second Every second
Tick Constantly checks for new data

Receive Custom Data

As your data reader reads your custom data file, LEAN adds the data points in the Slice it passes to your algorithm's OnData method. To collect the custom data, use the Symbol or name of your custom data subscription. You can access the Value and custom properties of your custom data class from the Slice . To access the custom properties, use the custom attribute pass the property name to the GetProperty method .

public class MyAlgorithm : QCAlgorithm
{
    public override void OnData(Slice slice)
    {
        if (slice.ContainsKey(_symbol))
        {
            var customData = slice[_symbol];
            var value = customData.Value;
            var property1 = customData.Property1;
        }
    }

    // You can also get the data directly with OnData(<dataClass>) method
    public void OnData(MyCustomDataType slice)
    {
        var value = slice.Value;
        var property1 = slice.Property1;
    }
}
class MyAlgorithm(QCAlgorithm):
    def OnData(self, slice: Slice) -> None:
        if slice.ContainsKey(self.symbol):
            custom_data = slice[self.symbol]
            value = custom_data.Value
            property1 = custom_data.Property1

Set the Benchmark

To set your custom data source as the benchmark, in the Initialize method, call the SetBenchmark method with the Symbol of your custom data subscription.

var symbol = AddData<MyCustomDataType>("<name>", Resolution.Daily).Symbol;
SetBenchmark(symbol);
self.symbol = self.AddData(MyCustomDataType, "<name>", Resolution.Daily).Symbol
self.SetBenchmark(self.symbol)

Avoid Look-Ahead Bias

Look-ahead bias occurs when you make decisions with information that wouldn't be available until some time in the future. In backtesting, look-ahead bias occurs when you receive data earlier than it would actually be available in reality. If look-ahead bias seeps into your algorithm, it will perform differently between live trading and backtesting.

To avoid look-ahead bias, set the timestamp of data points to the time when the data would actually be available. A lot of external sources apply timestamps to data differently than we do. For instance, on some platforms, daily bars are displayed with the date that they opened. We display daily bars with the date they closed. If you set the EndTime to the start of the bar, you'll receive the bar earlier in backtests than you would in live trading.

Time Modeling

Data types classes in LEAN inherit from the BaseData class that defines the Time and EndTime properties. These properties represent the time period of which the data was built. If the data type occurs in a singular point in time, they have no period, so Time and EndTime are the same. Regardless of the period, LEAN uses the time when the data sample ends, EndTime , to add the sample to a Slice .

 

7.2.2.2 CSV Format Example

Introduction

This page explains how to import custom data of a single security sourced in CSV format.

Data Format

The following snippet shows an example CSV file:

Date,Open,High,Low,Close,SharesTraded,Tur11er(Rs.Cr)
1997-01-01,905.2,941.4,905.2,939.55,38948210,978.21
1997-01-02,941.95,944,925.05,927.05,49118380,1150.42
1997-01-03,924.3,932.6,919.55,931.65,35263845,866.74
...
2014-07-24,7796.25,7835.65,7771.65,7830.6,117608370,6271.45
2014-07-25,7828.2,7840.95,7748.6,7790.45,153936037,7827.61
2014-07-28,7792.9,7799.9,7722.65,7748.7,116534670,6107.78

The data in the file must be in chronological order.

Define Custom Types

To define a custom data type, inherit the BaseData PythonData class and override the GetSource and Reader methods.

public class MyCustomDataType : BaseData
{
    public decimal Open;
    public decimal High;
    public decimal Low;
    public decimal Close;

    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLiveMode)
    {
        return new SubscriptionDataSource("https://www.dropbox.com/s/rsmg44jr6wexn2h/CNXNIFTY.csv?dl=1", SubscriptionTransportMedium.RemoteFile);
    }

    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLiveMode)
    {
        if (string.IsNullOrWhiteSpace(line.Trim()))
        {
            return null;
        }

        var index = new MyCustomDataType();

        try
        {
            var data = line.Split(',');
            index.Symbol = config.Symbol;
            index.Time = DateTime.Parse(data[0], CultureInfo.InvariantCulture);
            index.EndTime = index.Time.AddDays(1);
            index.Open = Convert.ToDecimal(data[1], CultureInfo.InvariantCulture);
            index.High = Convert.ToDecimal(data[2], CultureInfo.InvariantCulture);
            index.Low = Convert.ToDecimal(data[3], CultureInfo.InvariantCulture);
            index.Close = Convert.ToDecimal(data[4], CultureInfo.InvariantCulture);
            index.Value = index.Close;
        }
        catch
        {
        }
        return index;
    }
}
class MyCustomDataType(PythonData):

    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource("https://www.dropbox.com/s/rsmg44jr6wexn2h/CNXNIFTY.csv?dl=1", SubscriptionTransportMedium.RemoteFile)

    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLive: bool) -> BaseData:

        if not (line.strip()):
            return None

        index = MyCustomDataType()
        index.Symbol = config.Symbol

        try:
            data = line.split(',')
            index.Time = datetime.strptime(data[0], "%Y-%m-%d")
            index.EndTime = index.Time + timedelta(days=1)
            index.Value = data[4]
            index["open"] = float(data[1])
            index["high"] = float(data[2])
            index["low"] = float(data[3])
            index["close"] = float(data[4])

        except ValueError:
            # Do nothing
            return None

        return index

Create Subscriptions

To create a subscription for the custom type, in the Initialize method, call the AddData method. The AddData method returns a Security object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

public class MyAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    public override void Initialize()
    {
        _symbol = AddData<MyCustomDataType>("MyCustomDataType", Resolution.Daily).Symbol;
    }
}
class MyAlgorithm(QCAlgorithm): 
    def Initialize(self) -> None:
        self.symbol = self.AddData(MyCustomDataType, "MyCustomDataType", Resolution.Daily).Symbol
    

The AddData method creates a subscription for a single custom data asset and adds it to your user-defined universe.

Receive Custom Data

As your data reader reads your custom data file, LEAN adds the data points in the Slice it passes to your algorithm's OnData method. To collect the custom data, use the Symbol or name of your custom data subscription. You can access the Value and custom properties of your custom data class from the Slice . To access the custom properties, use the custom attribute pass the property name to the GetProperty method .

public class MyAlgorithm : QCAlgorithm
{
    public override void OnData(Slice slice)
    {
        if (slice.ContainsKey(_symbol))
        {
            var customData = slice[_symbol];
            var close = customData.Close;
        }
    }

    // You can also get the data directly with OnData(<dataClass>) method
    public void OnData(MyCustomDataType customData)
    {
        var close = customData.Close;
    }
}
class MyAlgorithm(QCAlgorithm):
    def OnData(self, slice: Slice) -> None:
        if slice.ContainsKey(self.symbol):
            custom_data = slice[self.symbol]
            close = custom_data.Close

If you add custom properties to your data object in the Reader method, LEAN adds them as members to the data object in the Slice . To ensure the property names you add in the Reader method follow the convention of member names, LEAN applies the following changes to the property names you provide in the Reader method:

  1. - and . characters are replaced with whitespace.
  2. The first letter is capitalized.
  3. Whitespace characters are removed.

For example, if you set a property name in the Reader method to ['some-property.name'] , you can access it in the OnData method through the Somepropertyname member of your data object.

Demonstration Algorithms

BubbleAlgorithm.py Python CustomDataNIFTYAlgorithm.py Python BubbleAlgorithm.cs C# CustomDataNIFTYAlgorithm.cs C#

 

7.2.2.3 JSON Format Example

Introduction

This page explains how to import custom data of a single security sourced in JSON format.

Data Format

The following code snippet shows an example JSON file

[
    {
      "Date": "1997-01-01",
      "Open": 905.2,
      "High": 941.4,
      "Low": 905.2,
      "Close": 939.55,
      "SharesTraded": 38948210,
      "Tur11er(Rs.Cr)": 978.21
    },
    {
      "Date": "1997-01-02",
      "Open": 941.95,
      "High": 944,
      "Low": 925.05,
      "Close": 927.05,
      "SharesTraded": 49118380,
      "Tur11er(Rs.Cr)": 1150.42
    },
    ...
    {
      "Date": "2014-07-25",
      "Open": 7828.2,
      "High": 7840.95,
      "Low": 7748.6,
      "Close": 7790.45,
      "SharesTraded": 153936037,
      "Tur11er(Rs.Cr)": 7827.61
    },
    {
      "Date": "2014-07-28",
      "Open": 7792.9,
      "High": 7799.9,
      "Low": 7722.65,
      "Close": 7748.7,
      "SharesTraded": 116534670,
      "Tur11er(Rs.Cr)": 6107.78
    }
]

The data in the file must be in chronological order.

Define Custom Types

To define a custom data type, inherit the BaseData PythonData class and override the GetSource and Reader methods.

If you need to create multiple objects in your Reader method from a single line , follow these steps:

  1. In the GetSource method, pass FileFormat.UnfoldingCollection as the third argument to the SubscriptionDataSource constructor.
  2. In the Reader method, order the objects by their timestamp and then return a BaseDataCollection(endTime, config.Symbol, objects) where objects is a list of your custom data objects.
using Newtonsoft.Json;
        
public class MyCustomDataType : BaseData
{
    [JsonProperty("Date")]
    public string Date;
    [JsonProperty("Open")]
    public decimal Open = 0;
    [JsonProperty("High")]
    public decimal High = 0;
    [JsonProperty("Low")]
    public decimal Low = 0;
    [JsonProperty("Close")]
    public decimal Close = 0;

    public override DateTime EndTime => Time.AddDays(1);

    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLiveMode)
    {
        return new SubscriptionDataSource("https://raw.githubusercontent.com/QuantConnect/Documentation/master/Resources/datasets/custom-data/unfolding-collection-example.json", SubscriptionTransportMedium.RemoteFile, FileFormat.UnfoldingCollection);
    }

    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLiveMode)
    {
        if (string.IsNullOrWhiteSpace(line.Trim()))
        {
            return null;
        }

        var objects = JsonConvert.DeserializeObject<List<MyCustomDataType>>(line).Select(index =>
        {
            index.Symbol = config.Symbol;
            index.Time = DateTime.Parse(x.Date, CultureInfo.InvariantCulture);
            index.Value = x.Close;
            return index;
        }).ToList();

        return new BaseDataCollection(objects.Last().EndTime, config.Symbol, objects);
    }
}
class MyCustomDataType(PythonData):
    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource("https://raw.githubusercontent.com/QuantConnect/Documentation/master/Resources/datasets/custom-data/unfolding-collection-example.json", SubscriptionTransportMedium.RemoteFile, FileFormat.UnfoldingCollection)

    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLive: bool) -> BaseData:

        if not (line.strip()):
            return None

        objects = []
        data = json.loads(line)

        for datum in data:
            index = MyCustomDataType()
            index.Symbol = config.Symbol
            index.Time = datetime.strptime(datum["Date"], "%Y-%m-%d")
            index.EndTime = index.Time + timedelta(1)
            index["Open"] = float(datum["Open"])
            index["High"] = float(datum["High"])
            index["Low"] = float(datum["Low"])
            index["Close"] = float(datum["Close"])
            index.Value = index["Close"]
            objects.append(index)

        return BaseDataCollection(objects[-1].EndTime, config.Symbol, objects)

Create Subscriptions

To create a subscription for the custom type, in the Initialize method, call the AddData method. The AddData method returns a Security object, which contains a Symbol . Save a reference to the Symbol so you can use it in OnData to access the security data in the Slice .

public class MyAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    public override void Initialize()
    {
        _symbol = AddData<MyCustomDataType>("MyCustomDataType", Resolution.Daily).Symbol;
    }
}
class MyAlgorithm(QCAlgorithm): 
    def Initialize(self) -> None:
        self.symbol = self.AddData(MyCustomDataType, "MyCustomDataType", Resolution.Daily).Symbol
    

The AddData method creates a subscription for a single custom data asset and adds it to your user-defined universe.

Receive Custom Data

As your data reader reads your custom data file, LEAN adds the data points in the Slice it passes to your algorithm's OnData method. To collect the custom data, use the Symbol or name of your custom data subscription. You can access the Value and custom properties of your custom data class from the Slice . To access the custom properties, use the custom attribute pass the property name to the GetProperty method .

public class MyAlgorithm : QCAlgorithm
{
    public override void OnData(Slice slice)
    {
        if (slice.ContainsKey(_symbol))
        {
            var customData = slice[_symbol];
            var close = customData.Close;
        }
    }

    // You can also get the data directly with OnData(<dataClass>) method
    public void OnData(MyCustomDataType customData)
    {
        var close = customData.Close;
    }
}
class MyAlgorithm(QCAlgorithm):
    def OnData(self, slice: Slice) -> None:
        if slice.ContainsKey(self.symbol):
            custom_data = slice[self.symbol]
            close = custom_data.Close

If you add custom properties to your data object in the Reader method, LEAN adds them as members to the data object in the Slice . To ensure the property names you add in the Reader method follow the convention of member names, LEAN applies the following changes to the property names you provide in the Reader method:

  1. - and . characters are replaced with whitespace.
  2. The first letter is capitalized.
  3. Whitespace characters are removed.

For example, if you set a property name in the Reader method to ['some-property.name'] , you can access it in the OnData method through the Somepropertyname member of your data object.

Demonstration Algorithms

CustomDataBitcoinAlgorithm.py Python CustomDataBitcoinAlgorithm.cs C#

 

7.2.3 Custom Universes

7.2.3.1 Key Concepts

Introduction

A custom universe lets you select a basket of assets from a custom dataset.

Initialize Universes

To add a custom universe to your algorithm, in the Initialize method, pass your universe type and a selector function to the AddUniverse method.

AddUniverse<MyCustomUniverseDataClass>("myCustomUniverse", Resolution.Daily, SelectorFunction)
self.AddUniverse(MyCustomUniverseDataClass, "myCustomUniverse", Resolution.Daily, self.selector_function)

Receive Custom Data

The universe selector function receives a list of your custom objects and must return a list of Symbol objects. In the selector function definition, you can use any of the properties of your custom data type. The Symbol objects that you return from the selector function set the constituents of the universe.

public class MyCustomUniverseAlgorithm : QCAlgorithm
{
	private IEnumerable<Symbol> SelectorFunction(IEnumerable<MyCustomUniverseDataClass> data)
	{
        return (from singleStockData in data
               where singleStockData.CustomAttribute1 > 0
               orderby singleStockData.CustomAttribute2 descending
               select singleStockData.Symbol).Take(5);
    }
}
class MyCustomUniverseAlgorithm(QCAlgorithm):
	def selector_function(self, data: List[MyCustomUniverseDataClass]) -> List[Symbol]:
    	sorted_data = sorted([ x for x in data if x["CustomAttribute1"] > 0 ],
                         	key=lambda x: x["CustomAttribute2"],
                         	reverse=True)
    	return [x.Symbol for x in sorted_data[:5]]

 

7.2.3.2 CSV Format Example

Introduction

This page explains how to import custom data for universe selection sourced in CSV format.

Data Format

You must create a file with data in CSV format. Ensure the data in the file is in chronological order.

20170704,SPY,QQQ,FB,AAPL,IWM
20170706,QQQ,AAPL,IWM,FB,GOOGL
20170707,IWM,AAPL,FB,BAC,GOOGL
...
20170729,SPY,QQQ,FB,AAPL,IWM
20170801,QQQ,FB,AAPL,IWM,GOOGL
20170802,QQQ,IWM,FB,BAC,GOOGL

Define Custom Types

To define a custom data type, inherit the BaseData PythonData class and override the GetSource and Reader methods.

public class StockDataSource : BaseData
{
    public List<string> Symbols { get; set; } = new();
    public override DateTime EndTime => Time.AddDays(1);

    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLiveMode)
    {
        return new SubscriptionDataSource("https://www.dropbox.com/s/ae1couew5ir3z9y/daily-stock-picker-backtest.csv?dl=1", SubscriptionTransportMedium.RemoteFile);
    }

    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLiveMode)
    {
        var stocks = new StockDataSource();

        try
        {
            var csv = line.Split(',');
            stocks.Time = DateTime.ParseExact(csv[0], "yyyyMMdd", null);
            stocks.Symbols.AddRange(csv.Skip(1));
        }
        catch { return null; }

        return stocks;
    }
}
class StockDataSource(PythonData):

    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource("https://www.dropbox.com/s/ae1couew5ir3z9y/daily-stock-picker-backtest.csv?dl=1", SubscriptionTransportMedium.RemoteFile)

    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLive: bool) -> BaseData:

        if not (line.strip() and line[0].isdigit()): return None
        
        stocks = StockDataSource()
        stocks.Symbol = config.Symbol

        try:
            csv = line.split(',')
            stocks.Time = datetime.strptime(csv[0], "%Y%m%d")
            stocks.EndTime = stocks.Time + timedelta(days=1)
            stocks["Symbols"] = csv[1:]

        except ValueError:
            # Do nothing
            return None

        return stocks

Initialize Universe

To perform a universe selection with custom data, in the Initialize method, call the AddUniverse method.

public class MyAlgorithm : QCAlgorithm
{
    public override void Initialize()
    {
        AddUniverse<StockDataSource>("myStockDataSource", Resolution.Daily, FilterFunction);
    }
}
class MyAlgorithm(QCAlgorithm): 
    def Initialize(self) -> None:
        self.AddUniverse(StockDataSource, "my-stock-data-source", Resolution.Daily, self.FilterFunction)
    

Receive Custom Data

As your data reader reads your custom data file, LEAN adds the data points into a List[StockDataSource]) IEnumerable<StockDataSource> object it passes to your algorithm's filter function. Your filter function needs to return a list of Symbol or str string object. LEAN automatically subscribes to these new assets and adds them to your algorithm.

public class MyAlgorithm : QCAlgorithm
{
    private IEnumerable<string> FilterFunction(IEnumerable<StockDataSource> stockDataSource)
    {
        return stockDataSource.SelectMany(x => x.Symbols);
    }
}
class MyAlgorithm(QCAlgorithm):
    def FilterFunction(self, data: List[StockDataSource]) -> List[str]:
        list = []
        for item in data:
            for symbol in item["Symbols"]:
                list.append(symbol)
        return list
    

If you add custom properties to your data object in the Reader method, LEAN adds them as members to the data object in your filter method. To ensure the property names you add in the Reader method follow the convention of member names, LEAN applies the following changes to the property names you provide in the Reader method:

  1. - and . characters are replaced with whitespace.
  2. The first letter is capitalized.
  3. Whitespace characters are removed.

For example, if you set a property name in the Reader method to ['some-property.name'] , you can access it in your filter method through the Somepropertyname member of your data object.

Demonstration Algorithms

DropboxBaseDataUniverseSelectionAlgorithm.py Python DropboxBaseDataUniverseSelectionAlgorithm.cs C#

 

7.2.3.3 JSON Format Example

Introduction

This page explains how to import custom data for universe selection sourced in JSON format.

Data Format

You must create a file with data in JSON format. Ensure the data in the file is in chronological order.

[
    {
      "Date": "20170704",
      "Symbols": ["SPY", "QQQ", "FB", "AAPL", "IWM"]
    },
    {
      "Date": "20170706",
      "Symbols": ["QQQ", "AAPL", "IWM", "FB", "GOOGL"]
    },
    ...
    {
      "Date": "20170801",
      "Symbols": ["QQQ", "FB", "AAPL", "IWM", "GOOGL"]
    },
    {
      "Date": "20170802",
      "Symbols": ["QQQ", "IWM", "FB", "BAC", "GOOGL"]
    }
]

Define Custom Types

To define a custom data type, inherit the BaseData PythonData class and override the GetSource and Reader methods.

If you need to create multiple objects in your Reader method from a single line , follow these steps:

  1. In the GetSource method, pass FileFormat.UnfoldingCollection as the third argument to the SubscriptionDataSource constructor.
  2. In the Reader method, order the objects by their timestamp and then return a BaseDataCollection(endTime, config.Symbol, objects) where objects is a list of your custom data objects.
using Newtonsoft.Json;

public class StockDataSource : BaseData
{
    [JsonProperty("Symbols")]
    public List<string> Symbols { get; set; }
    [JsonProperty("Date")]
    public string Date;
    public override DateTime EndTime => Time.AddDays(1);

    public override SubscriptionDataSource GetSource(
        SubscriptionDataConfig config,
        DateTime date,
        bool isLiveMode)
    {
        return new SubscriptionDataSource("https://www.dropbox.com/s/7xe7lfac52mdfpe/custom-universe.json?dl=1", 
                                          SubscriptionTransportMedium.RemoteFile,
                                          FileFormat.UnfoldingCollection);
    }

    public override BaseData Reader(
        SubscriptionDataConfig config,
        string line,
        DateTime date,
        bool isLiveMode)
    {
        var objects = JsonConvert.DeserializeObject<List<StockDataSource>>(line).Select(stocks =>
        {
            stocks.Time = DateTime.ParseExact(stocks.Date, "yyyyMMdd", null);
            return stocks;
        }).ToList();

        return new BaseDataCollection(objects.Last().EndTime, config.Symbol, objects);
    }
}
class StockDataSource(PythonData):

    def GetSource(self,
         config: SubscriptionDataConfig,
         date: datetime,
         isLive: bool) -> SubscriptionDataSource:
        return SubscriptionDataSource("https://www.dropbox.com/s/7xe7lfac52mdfpe/custom-universe.json?dl=1", 
                                      SubscriptionTransportMedium.RemoteFile,
                                      FileFormat.UnfoldingCollection)

    def Reader(self,
         config: SubscriptionDataConfig,
         line: str,
         date: datetime,
         isLive: bool) -> BaseData:
        
        objects = []
        data = json.loads(line)

        for datum in data:
            stocks = StockDataSource()
            stocks.Symbol = config.Symbol

            stocks.Time = datetime.strptime(datum["Date"], "%Y%m%d")
            stocks.EndTime = stocks.Time + timedelta(1)
            stocks["Symbols"] = datum["Symbols"]
            objects.append(stocks)

        return BaseDataCollection(objects[-1].EndTime, config.Symbol, objects)

Initialize Universe

To perform a universe selection with custom data, in the Initialize method, call the AddUniverse method.

public class MyAlgorithm : QCAlgorithm
{
    public override void Initialize()
    {
        AddUniverse<StockDataSource>("myStockDataSource", Resolution.Daily, FilterFunction);
    }
}
class MyAlgorithm(QCAlgorithm): 
    def Initialize(self) -> None:
        self.AddUniverse(StockDataSource, "my-stock-data-source", Resolution.Daily, self.FilterFunction)
    

Receive Custom Data

As your data reader reads your custom data file, LEAN adds the data points into a List[StockDataSource]) IEnumerable<StockDataSource> object it passes to your algorithm's filter function. Your filter function needs to return a list of Symbol or str string object. LEAN automatically subscribes to these new assets and adds them to your algorithm.

public class MyAlgorithm : QCAlgorithm
{
    private IEnumerable<string> FilterFunction(IEnumerable<StockDataSource> stockDataSource)
    {
        return stockDataSource.SelectMany(x => x.Symbols);
    }
}
class MyAlgorithm(QCAlgorithm):
    def FilterFunction(self, data: List[StockDataSource]) -> List[str]:
        list = []
        for item in data:
            for symbol in item["Symbols"]:
                list.append(symbol)
        return list
    

If you add custom properties to your data object in the Reader method, LEAN adds them as members to the data object in your filter method. To ensure the property names you add in the Reader method follow the convention of member names, LEAN applies the following changes to the property names you provide in the Reader method:

  1. - and . characters are replaced with whitespace.
  2. The first letter is capitalized.
  3. Whitespace characters are removed.

For example, if you set a property name in the Reader method to ['some-property.name'] , you can access it in your filter method through the Somepropertyname member of your data object.

Demonstration Algorithms

DropboxBaseDataUniverseSelectionAlgorithm.py Python DropboxBaseDataUniverseSelectionAlgorithm.cs C#

 

7.3 Bulk Downloads

Introduction

There are two techniques to import data into your algorithm. You can either manually import the entire file or stream the file line-by-line into your algorithm's OnData event. This page explores importing an entire file for manual use.

Recommended Use Cases

The batch import technique is outside of the LEAN's awareness or control, so it can't enforce good practices. However, the batch import technique is good for the loading the following datasets:

Download Files

The Download method downloads the content served from a local file or URL and then returns it as a string.

Basic Usage

var file = Download("<filePathOrURL>");
file = self.Download("<filePathOrURL>")

# If your file is in CSV format, convert it to a DataFrame with the `read_csv` method.
from io import StringIO
import pandas as pd
df = pd.read_csv(StringIO(file))

# If your file is in JSON format, parse it with the `loads` method.
import json
data = json.loads(file)

# If your file is in XML format, parse it with the `fromstring` method.
import xml.etree.ElementTree as ET
root = ET.fromstring(file)

Download Method Arguments

The Download method can accept header settings, a username, and a password for authentication.

Argument Data Type Description Default Value
address string str A string containing the URI to download
headers IEnumerable<KeyValuePair<string, string>> Dict[str,str] Defines header values to add to the request Enumerable.Empty<KeyValuePair<string, string>>() dict()
userName string str The user name associated with the credentials null None
password string str The password for the user name associated with the credentials null None

Download Request Headers

var headers = new Dictionary { { "1", "1" } };
Download(address, headers);
Download(address, headers, userName, password);
header = { "1": "1" }
self.Download(address, headers)
self.Download(address, headers, user_name, password)

Transport Binary Data

Follow these steps to transport binary files:

  1. Add the following imports to your program:
  2. import pickle
    import base64
  3. Serialize your object.
  4. pickle_bytes = pickle.dumps(my_object)
    base64_str = base64.b64encode(pickle_bytes).decode('ascii')
  5. Save the string representation of your object into the ObjectStore or one of the supported external sources .
  6. Load the string representation of your object into your trading algorithm.
  7. Restore the object.
  8. base64_bytes = base64_str.encode('ascii')
    model = base64.b64decode(base64_bytes)
    restored_model = pickle.loads(model)

Examples

Demonstration Algorithms
DropboxUniverseSelectionAlgorithm.cs Python DropboxCoarseFineAlgorithm.py Python NLTKSentimentTradingAlgorithm.py Python

 

8 Consolidating Data

8.1 Getting Started

Introduction

Consolidating data allows you to create bars of any length from smaller bars. Consolidation is commonly used to combine one-minute price bars into longer bars such as 10-20 minute bars. Consolidated bars are helpful because price movement over a longer period can sometimes contain less noise and bars of exotic length are less researched than standard bars, so they may present more opportunities to capture alpha.

To consolidate data, create a Consolidator object and register it for data. The built-in consolidators make it easy to create consolidated bars without introducing bugs. In the following sections, we will introduce the different types of consolidators and show you how to shape data into any form.

Basic Usage

The following code snippet demonstrates a simple consolidator that aggregates 1-minute bars into 10-minutes bars:

// Add some class members
private Symbol _symbol;
private TradeBarConsolidator _consolidator;

// In Initialize, subscribe to a security, create the consolidator, and register it for automatic updates
_symbol = AddEquity("SPY", Resolution.Minute).Symbol;
_consolidator = Consolidate(_symbol, TimeSpan.FromMinutes(10), ConsolidationHandler);

// Define the consolidation handler
void ConsolidationHandler(TradeBar consolidatedBar)
{
    
}
# In Initialize, subscribe to a security, create the consolidator, and register it for automatic updates
self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol
self.consolidator = self.Consolidate(self.symbol, timedelta(minutes=10), self.consolidation_handler)

# Define the consolidation handler
def consolidation_handler(self, consolidated_bar: TradeBar) -> None:
    pass

Data Shapes and Sizes

Consolidators usually produce output data that is the same format as the input data. They aggregate small TradeBar objects into a large TradeBar , small QuoteBar objects into a large QuoteBar , and Tick objects into either a TradeBar or QuoteBar .

Constructing a consolidated bar

Many asset classes in QuantConnect have data for both trades and quotes. By default, consolidators aggregate data into TradeBar objects. Forex data is the only exception, which consolidators aggregate into QuoteBar objects since Forex data doesn't have TradeBar objects.

Consolidator Types

There are many different types of consolidators you can create. The process to create and update the consolidator depends on the input data format, output data format, and the consolidation technique.

Time Period Consolidators

Time period consolidators aggregate data based on a period of time like a number of seconds, minutes, or days. If a time period consolidator aggregates data over multiple days, the multi-day aggregation cycle starts and repeats based on the time stamp of the first data point you use to update the consolidator.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar TradeBarConsolidator
QuoteBar QuoteBar QuoteBarConsolidator
Tick TradeBar TickConsolidator
Tick QuoteBar TickQuoteBarConsolidator

Calendar Consolidators

Calendar consolidators aggregate data based on specific periods of time like a weekly basis, quarterly basis, or any schedule with specific start and end times. In contrast to time period consolidators, the bars that calendar consolidators produce always end on the same schedule, regardless of the first data point the consolidator receives.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar TradeBarConsolidator
QuoteBar QuoteBar QuoteBarConsolidator
Tick TradeBar TickConsolidator
Tick QuoteBar TickQuoteBarConsolidator

Count Consolidators

Count consolidators aggregate data based on a number of bars or ticks. This type of consolidator aggregates n samples together, regardless of the time period the samples cover. Managing count consolidators is similiar to managing time period consolidators , except you create count consolidators with an integer argument instead of a time-based argument.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar TradeBarConsolidator
QuoteBar QuoteBar QuoteBarConsolidator
Tick TradeBar TickConsolidator
Tick QuoteBar TickQuoteBarConsolidator

Mixed-Mode Consolidators

Mixed-mode consolidators are a combination of count consolidators and time period consolidators. This type of consolidator aggregates n samples together or aggregates samples over a specific time period, whichever happens first.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar TradeBarConsolidator
QuoteBar QuoteBar QuoteBarConsolidator
Tick TradeBar TickConsolidator
Tick QuoteBar TickQuoteBarConsolidator

Renko Consolidators

Most Renko consolidators aggregate bars based on a fixed price movement. The RenkoConsolidator produces Renko bars by their traditional definition. A RenkoConsolidator with a bar size of $1 produces a new bar that spans $1 every time an asset closes $1 above the high of the previous bar or $1 below the low of the previous bar. If the price jumps multiple dollars in a single tick, the RenkoConsolidator produces multiple $1 bars in a single time step.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar RenkoConsolidator
QuoteBar QuoteBar RenkoConsolidator
Tick TradeBar RenkoConsolidator
Tick QuoteBar RenkoConsolidator

Classic Renko Consolidators

Most Renko consolidators aggregate bars based on a fixed price movement. The ClassicRenkoConsolidator produces a different type of Renko bars than the RenkoConsolidator . A ClassicRenkoConsolidator with a bar size of $1 produces a new bar that spans $1 every time an asset closes $1 away from the close of the previous bar. If the price jumps multiple dollars in a single tick, the ClassicRenkoConsolidator only produces one bar per time step where the open of each bar matches the close of the previous bar.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar ClassicRenkoConsolidator
QuoteBar QuoteBar ClassicRenkoConsolidator
Tick TradeBar ClassicRenkoConsolidator
Tick QuoteBar ClassicRenkoConsolidator

Volume Renko Consolidators

Volume Renko consolidators aggregate bars based on a fixed trading volume. These types of bars are commonly known as volume bars. A VolumeRenkoConsolidator with a bar size of 10,000 produces a new bar every time 10,000 units of the security trades in the market. If the trading volume of a single time step exceeds two step sizes (i.e. >20,000), the VolumeRenkoConsolidator produces multiple bars in a single time step.

The following table shows which consolidator type to use based on the data format of the input and output:

Input Output Class Type
TradeBar TradeBar VolumeRenkoConsolidator
Tick TradeBar VolumeRenkoConsolidator

Sequential Consolidators

Sequential consolidators wire two internal consolidators together such that the output of the first consolidator is the input to the second consolidator and the output of the second consolidator is the output of the sequential consolidator.

For more information about sequential consolidators, see Combining Consolidators .

Execution Sequence

The algorithm manager calls events in the following order:

  1. Scheduled Events
  2. Consolidation event handlers
  3. OnData event handler

This event flow is important to note. For instance, if your consolidation handlers or OnData event handler appends data to a RollingWindow and you use that RollingWindow in your Scheduled Event, when the Scheduled Event executes, the RollingWindow won't contain the most recent data.

The consolidators are called in the order that they are updated. If you register them for automatic updates, they are updated in the order that you register them.

Examples

Demonstration Algorithms
BasicTemplateFuturesConsolidationAlgorithm.py Python BasicTemplateOptionsConsolidationAlgorithm.py Python DataConsolidationAlgorithm.py Python MultipleSymbolConsolidationAlgorithm.py Python BasicTemplateFuturesConsolidationAlgorithm.cs C# BasicTemplateOptionsConsolidationAlgorithm.cs C# DataConsolidationAlgorithm.cs C# MultipleSymbolConsolidationAlgorithm.cs C#
Video Tutorials
Quick Start Lesson 4: How do I use Consolidators? C# Opening Range Breakout - Time Period Consolidation Python

 

8.2 Consolidator Types

8.2.1 Time Period Consolidators

Introduction

Time period consolidators aggregate data based on a period of time like a number of seconds, minutes, or days. If a time period consolidator aggregates data over multiple days, the multi-day aggregation cycle starts and repeats based on the time stamp of the first data point you use to update the consolidator.

Consolidate Trade Bars

TradeBar consolidators aggregate TradeBar objects into TradeBar objects of the same size or larger. Follow these steps to create and manage a TradeBar consolidator based on a period of time:

  1. Create the consolidator.
  2. To set the time period for the consolidator, you can use either a timedelta TimeSpan or Resolution object. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

If the security subscription in your algorithm provides TradeBar and QuoteBar data, ResolveConsolidator returns a TradeBarConsolidator .

If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
        pass

    The consolidation event handler receives bars when the consolidated bar closes based on the data time zone . If you subscribe to minute resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to minute resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars at 9:31 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until 9:31 AM ET.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create period consolidators and register them for automatic updates. With just one line of code, you can create data in any time period based on a timedelta TimeSpan or Resolution object:

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: TradeBar) -> None:
        pass

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into QuoteBar objects of the same size or larger. Follow these steps to create and manage a QuoteBar consolidator based on a period of time:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use either a timedelta TimeSpan or Resolution object. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

    If the security subscription in your algorithm provides TradeBar and QuoteBar data, ResolveConsolidator returns a TradeBarConsolidator .

    If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
        pass

    The consolidation event handler receives bars when the consolidated bar closes based on the data time zone . If you subscribe to minute resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to minute resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars at 9:31 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until 9:31 AM ET.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create period consolidators and register them for automatic updates. With just one line of code, you can create data in any time period based on a timedelta TimeSpan or Resolution object:

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: QuoteBar) -> None:
        pass

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into TradeBar objects. Follow these steps to create and manage a Tick consolidator based on a period of time:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use either a timedelta TimeSpan or Resolution object. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

    If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
        pass

    The consolidation event handler receives bars when the consolidated bar closes based on the data time zone . If you subscribe to tick resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to tick resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars milliseconds after 9:30 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until milliseconds after 9:30 AM ET.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create period consolidators and register them for automatic updates. With just one line of code, you can create data in any time period based on a timedelta TimeSpan or Resolution object:

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: TradeBar) -> None:
        pass

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into QuoteBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on a period of time:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use either a timedelta TimeSpan or Resolution object. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

    If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
        pass

    The consolidation event handler receives bars when the consolidated bar closes based on the data time zone . If you subscribe to tick resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to tick resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars milliseconds after 9:30 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until milliseconds after 9:30 AM ET.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create period consolidators and register them for automatic updates. With just one line of code, you can create data in any time period based on a timedelta TimeSpan or Resolution object:

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: QuoteBar) -> None:
        pass

    Consolidate Other Data

    <dataType> consolidators aggregate various types of data objects into <dataType> objects of the same size or larger. If you consolidate custom data or alternative datasets, check the definition of the data class to see its data type. Follow these steps to create and manage a <dataType> consolidator based on a period of time:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use either a timedelta TimeSpan or Resolution object. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

    If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, <dataType> consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: <dataType>) -> None:
        pass

    The consolidation event handler receives bars when the consolidated bar closes based on the data time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create period consolidators and register them for automatic updates. With just one line of code, you can create data in any time period based on a timedelta TimeSpan or Resolution object:

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(<dataType> consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: <dataType>) -> None:
        pass

    Examples

    Demonstration Algorithms
    BasicTemplateOptionsConsolidationAlgorithm.py Python DataConsolidationAlgorithm.py Python MultipleSymbolConsolidationAlgorithm.py Python BasicTemplateOptionsConsolidationAlgorithm.cs C# BasicTemplateFuturesConsolidationAlgorithm.cs C# DataConsolidationAlgorithm.cs C# MultipleSymbolConsolidationAlgorithm.cs C#

     

    8.2.2 Calendar Consolidators

    Introduction

    Calendar consolidators aggregate data based on specific periods of time like a weekly basis, quarterly basis, or any schedule with specific start and end times. In contrast to time period consolidators, the bars that calendar consolidators produce always end on the same schedule, regardless of the first data point the consolidator receives.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into TradeBar objects of the same size or larger. Follow these steps to create and manage a TradeBar consolidator based on custom start and end periods:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use the built-in CalendarInfo objects or create your own. The following list describes each technique:

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
        pass

    If you use a custom consolidation period method, LEAN passes the consolidated bar to the consolidation handler when the consolidation period ends. The Time and EndTime properties of the consolidated bar reflect the data time zone, but the Time property of the algorithm still reflects the algorithm time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create calendar consolidators and register them for automatic updates.

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: TradeBar) -> None:
        pass

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into QuoteBar objects of the same size or larger. Follow these steps to create and manage a QuoteBar consolidator based on custom start and end periods:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use the built-in CalendarInfo objects or create your own. The following list describes each technique:

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
        pass

    If you use a custom consolidation period method, LEAN passes the consolidated bar to the consolidation handler when the consolidation period ends. The Time and EndTime properties of the consolidated bar reflect the data time zone, but the Time property of the algorithm still reflects the algorithm time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create calendar consolidators and register them for automatic updates.

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: QuoteBar) -> None:
        pass

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into TradeBar objects. Follow these steps to create and manage a Tick consolidator based on custom start and end periods:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use the built-in CalendarInfo objects or create your own. The following list describes each technique:

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
        pass

    If you use a custom consolidation period method, LEAN passes the consolidated bar to the consolidation handler when the consolidation period ends. The Time and EndTime properties of the consolidated bar reflect the data time zone, but the Time property of the algorithm still reflects the algorithm time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create calendar consolidators and register them for automatic updates.

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(TradeBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: TradeBar) -> None:
        pass

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into QuoteBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on custom start and end periods:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use the built-in CalendarInfo objects or create your own. The following list describes each technique:

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
        pass

    If you use a custom consolidation period method, LEAN passes the consolidated bar to the consolidation handler when the consolidation period ends. The Time and EndTime properties of the consolidated bar reflect the data time zone, but the Time property of the algorithm still reflects the algorithm time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create calendar consolidators and register them for automatic updates.

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(QuoteBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: QuoteBar) -> None:
        pass

    Consolidate Other Data

    <dataType> consolidators aggregate various types of data objects into <dataType> objects of the same size or larger. If you consolidate custom data or alternative datasets, check the definition of the data class to see its data type. Follow these steps to create and manage a <dataType> consolidator based on custom start and end periods:

    1. Create the consolidator.
    2. To set the time period for the consolidator, you can use the built-in CalendarInfo objects or create your own. The following list describes each technique:

  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, <dataType> consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: <dataType>) -> None:
        pass

    If you use a custom consolidation period method, LEAN passes the consolidated bar to the consolidation handler when the consolidation period ends. The Time and EndTime properties of the consolidated bar reflect the data time zone, but the Time property of the algorithm still reflects the algorithm time zone .

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    You can also use the Consolidate helper method to create calendar consolidators and register them for automatic updates.

    If you use the Consolidate helper method, the consolidation handler doesn't receive an object argument.

    void ConsolidationHandler(<dataType> consolidatedBar)
    {
    
    }
    def consolidation_handler(self, consolidated_bar: <dataType>) -> None:
        pass

    Examples

    The following examples are typical calendar functions you may want.

    The function should receive a datetime DateTime object that's based in the algorithm time zone and should return a CalendarInfo object, which contains the start time of the bar in the data time zone and the duration of the consolidation period. This function is evaluated when the duration of the consolidation period has passed and at the following time step.

    The preceding sections of this page provide a typical calendar function that consolidates data weekly, starting at 5:00 PM. If you consolidate US Equity and Crypto data, the event handler triggers at different times since the data time zone of US Equity is America/New York and Crypto is UTC.

    Example 1: Consolidate data into 20-minute TradeBar objects that start at 9:30 AM

    This is a typical case for the US markets because they open every business day at 9:30 PM Eastern Time (ET).

    public CalendarInfo EveryTwentyMinuteAfterEquityMarketOpen(DateTime datetime)
    {
        var period = TimeSpan.FromMinutes(20);
        var openTime = datetime.Date + new TimeSpan(9, 30, 0);
        var start = openTime + (int)((datetime - openTime) / period) * period;            
        return new CalendarInfo(start, period);
    }
    def every_twenty_minute_after_equity_market_open(self, dt: datetime) -> CalendarInfo:
        period = timedelta(minutes=20)
        open_time = dt.replace(hour=9, minute=30, second=0, microsecond=0)
        start = open_time + int((dt - open_time) / period) * period
        return CalendarInfo(start, period)

    To consolidate data into another period, change the period variable. For example, to consolidate into 4-hour bars, replace timedelta(minutes=20) TimeSpan.FromMinutes(20) with timedelta(hours=4) TimeSpan.FromHours(4).

    Example 2: Consolidate data in daily QuoteBar objects that start at 5 PM:

    This is a typical Forex case because the Forex market opens on Sunday at 5 PM ET.

    public CalendarInfo CustomDailyForex(DateTime datetime)
    {
        var start = datetime.Date
            .AddHours(datetime.Hour < 17 ? -7 : 17);
        return new CalendarInfo(start, TimeSpan.FromDays(1));
    }
    def custom_daily_forex(self, dt: datetime) -> CalendarInfo:
    start = dt.replace(hour=17, minute=0, second=0)
    if dt.hour < 17:
        start -= timedelta(1)
    return CalendarInfo(start, timedelta(1))

    Example 3: Consolidate data into monthly TradeBar objects that start at midnight:

    public CalendarInfo CustomMonthly(DateTime datetime)
    {
        var start = dt.AddDays(1 - dt.Day).Date;
        var end = dt.AddMonths(1);
        end = new DateTime(end.Year, end.Month, 1);
        return new CalendarInfo(start, (end - start));
    }
    def custom_monthly(self, dt: datetime) -> CalendarInfo:
        start = dt.replace(day=1).date()
        end = dt.replace(day=28) + timedelta(4)
        end = (end - timedelta(end.day - 1)).date()
        return CalendarInfo(start, end - start)
    Demonstration Algorithms
    DataConsolidationAlgorithm.py Python DataConsolidationAlgorithm.cs C#

     

    8.2.3 Count Consolidators

    Introduction

    Count consolidators aggregate data based on a number of bars or ticks. This type of consolidator aggregates n samples together, regardless of the time period the samples cover. Managing count consolidators is similiar to managing time period consolidators , except you create count consolidators with an integer argument instead of a time-based argument.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into TradeBar objects of the same size or larger. Follow these steps to create and manage a TradeBar consolidator based on a number of samples:

    1. Create the consolidator.
    2. To create a count consolidator, pass the number of samples to the consolidator constructor.

      _consolidator = new TradeBarConsolidator(10);
      self.consolidator = TradeBarConsolidator(10)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, TradeBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
          pass

      When the consolidator receives the n -th data point, it passes the consolidated bar to the event handler.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into QuoteBar objects of the same size or larger. Follow these steps to create and manage a QuoteBar consolidator based on a number of samples:

    1. Create the consolidator.
    2. To create a count consolidator, pass the number of samples to the consolidator constructor.

      _consolidator = new QuoteBarConsolidator(10);
      self.consolidator = QuoteBarConsolidator(10)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
          pass

      When the consolidator receives the n -th data point, it passes the consolidated bar to the event handler.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into TradeBar objects. Follow these steps to create and manage a Tick consolidator based on a number of samples:

    1. Create the consolidator.
    2. To create a count consolidator, pass the number of samples to the consolidator constructor.

      _consolidator = new TickConsolidator(10);
      self.consolidator = TickConsolidator(10)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, TradeBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
          pass

      When the consolidator receives the n -th data point, it passes the consolidated bar to the event handler.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into QuoteBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on a number of samples:

    1. Create the consolidator.
    2. To create a count consolidator, pass the number of samples to the consolidator constructor.

      _consolidator = new TickQuoteBarConsolidator(10);
      self.consolidator = TickQuoteBarConsolidator(10)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
          pass

      When the consolidator receives the n -th data point, it passes the consolidated bar to the event handler.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Other Data

    <dataType> consolidators aggregate various types of data objects into <dataType> objects of the same size or larger. If you consolidate custom data or alternative datasets, check the definition of the data class to see its data type. Follow these steps to create and manage a <dataType> consolidator based on a number of samples:

    1. Create the consolidator.
    2. To create a count consolidator, pass the number of samples to the consolidator constructor.

      _consolidator = new DynamicDataConsolidator(10);
      self.consolidator = DynamicDataConsolidator(10)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, <dataType> consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: <dataType>) -> None:
          pass

      When the consolidator receives the n -th data point, it passes the consolidated bar to the event handler.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Examples

    Demonstration Algorithms
    DataConsolidationAlgorithm.py Python DataConsolidationAlgorithm.cs C#

     

    8.2.4 Mixed-Mode Consolidators

    Introduction

    Mixed-mode consolidators are a combination of count consolidators and time period consolidators. This type of consolidator aggregates n samples together or aggregates samples over a specific time period, whichever happens first.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into TradeBar objects of the same size or larger. Follow these steps to create and manage a TradeBar consolidator based on a period of time or a number of samples, whichever occurs first:

    1. Create the consolidator.
    2. To create a mixed-mode consolidator, pass a timedelta TimeSpan object and an integer to the consolidator constructor. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

      _consolidator = new TradeBarConsolidator(10, TimeSpan.FromDays(1));
      self.consolidator = TradeBarConsolidator(10, timedelta(days=1))

      The time period is relative to the data time zone , not the algorithm time zone . If you consolidate Crypto data into daily bars, the event handler receives the consolidated bars at midnight 12:00 AM Coordinated Universal Time (UTC), regardless of the algorithm time zone.

      If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, TradeBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
          pass

      The consolidation event handler receives bars when the consolidated bar closes based on the data time zone or the number of samples, whichever occurs first. If you subscribe to minute resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to minute resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars at 9:31 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until 9:31 AM ET.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into QuoteBar objects of the same size or larger. Follow these steps to create and manage a QuoteBar consolidator based on a period of time or a number of samples, whichever occurs first:

    1. Create the consolidator.
    2. To create a mixed-mode consolidator, pass a timedelta TimeSpan object and an integer to the consolidator constructor. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

      _consolidator = new QuoteBarConsolidator(10, TimeSpan.FromDays(1));
      self.consolidator = QuoteBarConsolidator(10, timedelta(days=1))

      The time period is relative to the data time zone , not the algorithm time zone . If you consolidate Crypto data into daily bars, the event handler receives the consolidated bars at midnight 12:00 AM Coordinated Universal Time (UTC), regardless of the algorithm time zone.

      If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
          pass

      The consolidation event handler receives bars when the consolidated bar closes based on the data time zone or the number of samples, whichever occurs first. If you subscribe to minute resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to minute resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars at 9:31 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until 9:31 AM ET.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into TradeBar objects. Follow these steps to create and manage a Tick consolidator based on a period of time or a number of samples, whichever occurs first:

    1. Create the consolidator.
    2. To create a mixed-mode consolidator, pass a timedelta TimeSpan object and an integer to the consolidator constructor. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

      _consolidator = new TickConsolidator(10, TimeSpan.FromMilliseconds(100));
      self.consolidator = TickConsolidator(10, timedelta(milliseconds=100))

      The time period is relative to the data time zone , not the algorithm time zone . If you consolidate Crypto data into daily bars, the event handler receives the consolidated bars at midnight 12:00 AM Coordinated Universal Time (UTC), regardless of the algorithm time zone.

      If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, TradeBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
          pass

      The consolidation event handler receives bars when the consolidated bar closes based on the data time zone or the number of samples, whichever occurs first. If you subscribe to tick resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to tick resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars milliseconds after 9:30 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until milliseconds after 9:30 AM ET.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into QuoteBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on a period of time or a number of samples, whichever occurs first:

    1. Create the consolidator.
    2. To create a mixed-mode consolidator, pass a timedelta TimeSpan object and an integer to the consolidator constructor. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

      _consolidator = new TickQuoteBarConsolidator(10, TimeSpan.FromMilliseconds(100));
      self.consolidator = TickQuoteBarConsolidator(10, timedelta(milliseconds=100))

      The time period is relative to the data time zone , not the algorithm time zone . If you consolidate Crypto data into daily bars, the event handler receives the consolidated bars at midnight 12:00 AM Coordinated Universal Time (UTC), regardless of the algorithm time zone.

      If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, QuoteBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: QuoteBar) -> None:
          pass

      The consolidation event handler receives bars when the consolidated bar closes based on the data time zone or the number of samples, whichever occurs first. If you subscribe to tick resolution data for Bitcoin and create an hourly consolidator, you receive consolidated bars at the top of each hour. However, if you subscribe to tick resolution data for the regular trading hours of US Equities and create a daily consolidator, you receive consolidated bars milliseconds after 9:30 AM Eastern Time (ET). The consolidated bar for US Equities doesn't close at 4:00 PM ET because the day isn't over. The consolidated bar for US Equities also doesn't close at midnight because your algorithm doesn't receive minute resolution data after 4:00 PM ET until milliseconds after 9:30 AM ET.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Other Data

    <dataType> consolidators aggregate various types of data objects into <dataType> objects of the same size or larger. If you consolidate custom data or alternative datasets, check the definition of the data class to see its data type. Follow these steps to create and manage a <dataType> consolidator based on a period of time or a number of samples, whichever occurs first:

    1. Create the consolidator.
    2. To create a mixed-mode consolidator, pass a timedelta TimeSpan object and an integer to the consolidator constructor. The consolidator time period must be greater than or equal to the resolution of the security subscription. For instance, you can aggregate minute bars into 10-minute bars, but you can't aggregate hour bars into 10-minute bars.

      _consolidator = new DynamicDataConsolidator(10, TimeSpan.FromDays(1));
      self.consolidator = DynamicDataConsolidator(10, timedelta(days=1))

      The time period is relative to the data time zone , not the algorithm time zone . If you consolidate Crypto data into daily bars, the event handler receives the consolidated bars at midnight 12:00 AM Coordinated Universal Time (UTC), regardless of the algorithm time zone.

      If you consolidate on an hourly basis, the consolidator ends at the top of the hour, not every hour after the market open. For US Equities, that's 10 AM Eastern Time (ET), not 10:30 AM ET.

    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, <dataType> consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: <dataType>) -> None:
          pass

      The consolidation event handler receives bars when the consolidated bar closes based on the data time zone or the number of samples, whichever occurs first.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

     

    8.2.5 Renko Consolidators

    8.2.5.1 Renko Consolidators

    Introduction

    Most Renko consolidators aggregate bars based on a fixed price movement. The RenkoConsolidator produces Renko bars by their traditional definition. A RenkoConsolidator with a bar size of $1 produces a new bar that spans $1 every time an asset closes $1 above the high of the previous bar or $1 below the low of the previous bar. If the price jumps multiple dollars in a single tick, the RenkoConsolidator produces multiple $1 bars in a single time step.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into RenkoBar objects. Follow these steps to create and manage a TradeBar consolidator based on the traditional Renko bar rules:

    1. Create the consolidator.
    2. To create a Renko consolidator, pass the bar size to the RenkoConsolidator constructor.

      // Create a Renko consolidator that emits a bar when the price moves $1
      _consolidator = new RenkoConsolidator(1m);
      # Create a Renko consolidator that emits a bar when the price moves $1
      self.consolidator = RenkoConsolidator(1)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the price movement forms a new Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into RenkoBar objects. Follow these steps to create and manage a QuoteBar consolidator based on the traditional Renko bar rules:

    1. Create the consolidator.
    2. To create a Renko consolidator, pass the bar size to the RenkoConsolidator constructor.

      // Create a Renko consolidator that emits a bar when the price moves $1
      _consolidator = new RenkoConsolidator(1m);
      # Create a Renko consolidator that emits a bar when the price moves $1
      self.consolidator = RenkoConsolidator(1)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the price movement forms a new Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into RenkoBar objects. Follow these steps to create and manage a Tick consolidator based on the traditional Renko bar rules:

    1. Create the consolidator.
    2. To create a Renko consolidator, pass the bar size to the RenkoConsolidator constructor.

      // Create a Renko consolidator that emits a bar when the price moves $1
      _consolidator = new RenkoConsolidator(1m);
      # Create a Renko consolidator that emits a bar when the price moves $1
      self.consolidator = RenkoConsolidator(1)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the price movement forms a new Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into RenkoBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on the traditional Renko bar rules:

    1. Create the consolidator.
    2. To create a Renko consolidator, pass the bar size to the RenkoConsolidator constructor.

      // Create a Renko consolidator that emits a bar when the price moves $1
      _consolidator = new RenkoConsolidator(1m);
      # Create a Renko consolidator that emits a bar when the price moves $1
      self.consolidator = RenkoConsolidator(1)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the price movement forms a new Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

     

    8.2.5.2 Classic Renko Consolidators

    Introduction

    Most Renko consolidators aggregate bars based on a fixed price movement. The ClassicRenkoConsolidator produces a different type of Renko bars than the RenkoConsolidator . A ClassicRenkoConsolidator with a bar size of $1 produces a new bar that spans $1 every time an asset closes $1 away from the close of the previous bar. If the price jumps multiple dollars in a single tick, the ClassicRenkoConsolidator only produces one bar per time step where the open of each bar matches the close of the previous bar.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into RenkoBar objects. Follow these steps to create and manage a TradeBar consolidator based on the preceding Renko bar rules:

    1. Create the consolidator.
    2. To create a classic Renko consolidator, pass the bar size to the ClassicRenkoConsolidator constructor.

      // Create a Classic Renko consolidator that emits a bar when the price moves $1
      _consolidator = new ClassicRenkoConsolidator(1m);
      # Create a Classic Renko consolidator that emits a bar when the price moves $1
      self.consolidator = ClassicRenkoConsolidator(1)

      The ClassicRenkoConsolidator has the following default behavior:

    To build the Renko bars with a different property than the Value of the IBaseData object, provide a selector argument. The selector should be a function that receives the IBaseData object and returns a decimal value.

    self.consolidator = ClassicRenkoConsolidator(1, selector = lambda data: data.High)
    _consolidator = new ClassicRenkoConsolidator(1m, data => (data as TradeBar).High);

    To add a non-zero Volume property to the Renko bars, provide a volumeSelector argument. The volumeSelector should be a function that receives the IBaseData object and returns a decimal value.

    self.consolidator = ClassicRenkoConsolidator(1, volumeSelector = lambda data: data.Volume)
    _consolidator = new ClassicRenkoConsolidator(1m, null, data => (data as TradeBar).Volume);

    To relax the requirement that the open and close of the Renko bars must be a multiple of bar size, disable the evenBars argument. If you disable evenBars , the open value of the first Renko bar is set to the first value from the selector . The following opening and closing Renko bar values are all multiples of the first value from the selector

    self.consolidator = ClassicRenkoConsolidator(1, evenBars = False)
    _consolidator = new ClassicRenkoConsolidator(1m, evenBars: false);
  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
        pass

    The consolidation event handler receives bars when the price movement forms a new classic Renko bar.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Bars

    QuoteBar consolidators aggregate QuoteBar objects into RenkoBar objects. Follow these steps to create and manage a QuoteBar consolidator based on the preceding Renko bar rules:

    1. Create the consolidator.
    2. To create a classic Renko consolidator, pass the bar size to the ClassicRenkoConsolidator constructor.

      // Create a Classic Renko consolidator that emits a bar when the price moves $1
      _consolidator = new ClassicRenkoConsolidator(1m);
      # Create a Classic Renko consolidator that emits a bar when the price moves $1
      self.consolidator = ClassicRenkoConsolidator(1)

      The ClassicRenkoConsolidator has the following default behavior:

    The following arguments enable you to create Renko bars that aggregate the excess liquidity on the bid.

    self.consolidator = ClassicRenkoConsolidator(10, lambda data: data.Value, lambda data: data.LastBidSize - data.LastAskSize)
    _consolidator = new ClassicRenkoConsolidator(10, null, 
        data => (data as QuoteBar).LastBidSize - (data as QuoteBar).LastAskSize);

    To relax the requirement that the open and close of the Renko bars must be a multiple of bar size, disable the evenBars argument. If you disable evenBars , the open value of the first Renko bar is set to the first value from the selector . The following opening and closing Renko bar values are all multiples of the first value from the selector

    self.consolidator = ClassicRenkoConsolidator(1, evenBars = False)
    _consolidator = new ClassicRenkoConsolidator(1m, evenBars: false);
  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
        pass

    The consolidation event handler receives bars when the price movement forms a new classic Renko bar.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into RenkoBar objects. Follow these steps to create and manage a Tick consolidator based on the preceding Renko bar rules:

    1. Create the consolidator.
    2. To create a classic Renko consolidator, pass the bar size to the ClassicRenkoConsolidator constructor.

      // Create a Classic Renko consolidator that emits a bar when the price moves $1
      _consolidator = new ClassicRenkoConsolidator(1m);
      # Create a Classic Renko consolidator that emits a bar when the price moves $1
      self.consolidator = ClassicRenkoConsolidator(1)

      The ClassicRenkoConsolidator has the following default behavior:

    To relax the requirement that the open and close of the Renko bars must be a multiple of bar size, disable the evenBars argument. If you disable evenBars , the open value of the first Renko bar is set to the first value from the selector . The following opening and closing Renko bar values are all multiples of the first value from the selector

    self.consolidator = ClassicRenkoConsolidator(1, evenBars = False)
    _consolidator = new ClassicRenkoConsolidator(1m, evenBars: false);
  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
        pass

    The consolidation event handler receives bars when the price movement forms a new classic Renko bar.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Quote Ticks

    Tick quote bar consolidators aggregate Tick objects that represent quotes into RenkoBar objects. Follow these steps to create and manage a Tick quote bar consolidator based on the preceding Renko bar rules:

    1. Create the consolidator.
    2. To create a classic Renko consolidator, pass the bar size to the ClassicRenkoConsolidator constructor.

      // Create a Classic Renko consolidator that emits a bar when the price moves $1
      _consolidator = new ClassicRenkoConsolidator(1m);
      # Create a Classic Renko consolidator that emits a bar when the price moves $1
      self.consolidator = ClassicRenkoConsolidator(1)

      The ClassicRenkoConsolidator has the following default behavior:

    To relax the requirement that the open and close of the Renko bars must be a multiple of bar size, disable the evenBars argument. If you disable evenBars , the open value of the first Renko bar is set to the first value from the selector . The following opening and closing Renko bar values are all multiples of the first value from the selector

    self.consolidator = ClassicRenkoConsolidator(1, evenBars = False)
    _consolidator = new ClassicRenkoConsolidator(1m, evenBars: false);
  • Add an event handler to the consolidator.
  • _consolidator.DataConsolidated += ConsolidationHandler;
    self.consolidator.DataConsolidated += self.consolidation_handler

    LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

  • Define the consolidation handler.
  • void ConsolidationHandler(object sender, RenkoBar consolidatedBar)
    {
    
    }
    def consolidation_handler(self, sender: object, consolidated_bar: RenkoBar) -> None:
        pass

    The consolidation event handler receives bars when the price movement forms a new classic Renko bar.

  • Update the consolidator.
  • You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Examples

    Demonstration Algorithms
    ClassicRenkoConsolidatorAlgorithm.py Python ClassicRenkoConsolidatorAlgorithm.cs C#

     

    8.2.5.3 Volume Renko Consolidators

    Introduction

    Volume Renko consolidators aggregate bars based on a fixed trading volume. These types of bars are commonly known as volume bars. A VolumeRenkoConsolidator with a bar size of 10,000 produces a new bar every time 10,000 units of the security trades in the market. If the trading volume of a single time step exceeds two step sizes (i.e. >20,000), the VolumeRenkoConsolidator produces multiple bars in a single time step.

    Consolidate Trade Bars

    TradeBar consolidators aggregate TradeBar objects into VolumeRenkoBar objects. Follow these steps to create and manage a TradeBar consolidator based on custom set volume traded:

    1. Create the consolidator.
    2. To create a Volume Renko consolidator, pass the bar size to the VolumeRenkoConsolidator constructor.

      // Create a Volume Renko consolidator that emits a bar every time 10,000 units trade
      _consolidator = new VolumeRenkoConsolidator(10000m);
      # Create a Volume Renko consolidator that emits a bar every time 10,000 units trade
      self.consolidator = VolumeRenkoConsolidator(10000)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, VolumeRenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: VolumeRenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the trading volume forms a new Volume Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Consolidate Trade Ticks

    Tick consolidators aggregate Tick objects into VolumeRenkoBar objects. Follow these steps to create and manage a Tick consolidator based on custom set volume traded:

    1. Create the consolidator.
    2. To create a Volume Renko consolidator, pass the bar size to the VolumeRenkoConsolidator constructor.

      // Create a Volume Renko consolidator that emits a bar every time 10,000 units trade
      _consolidator = new VolumeRenkoConsolidator(10000m);
      # Create a Volume Renko consolidator that emits a bar every time 10,000 units trade
      self.consolidator = VolumeRenkoConsolidator(10000)
    3. Add an event handler to the consolidator.
    4. _consolidator.DataConsolidated += ConsolidationHandler;
      self.consolidator.DataConsolidated += self.consolidation_handler

      LEAN passes consolidated bars to the consolidator event handler in your algorithm. The most common error when creating consolidators is to put parenthesis () at the end of your method name when setting the event handler of the consolidator. If you use parenthesis, the method executes and the result is passed as the event handler instead of the method itself. Remember to pass the name of your method to the event system. Specifically, it should be ConsolidationHandler self.consolidation_handler , not ConsolidationHandler() self.consolidation_handler() .

    5. Define the consolidation handler.
    6. void ConsolidationHandler(object sender, VolumeRenkoBar consolidatedBar)
      {
      
      }
      def consolidation_handler(self, sender: object, consolidated_bar: VolumeRenkoBar) -> None:
          pass

      The consolidation event handler receives bars when the trading volume forms a new Volume Renko bar.

    7. Update the consolidator.
    8. You can automatically or manually update the consolidator.

  • If you create consolidators for securities in a dynamic universe and register them for automatic updates, remove the consolidator when the security leaves the universe.
  • SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
    self.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    If you have a dynamic universe and don't remove consolidators, they compound internally, causing your algorithm to slow down and eventually die once it runs out of RAM. For an example of removing consolidators from universe subscriptions, see the GasAndCrudeOilEnergyCorrelationAlpha GasAndCrudeOilEnergyCorrelationAlpha in the LEAN GitHub repository.

    Examples

    Demonstration Algorithms
    VolumeRenkoConsolidatorAlgorithm.py Python VolumeRenkoConsolidatorAlgorithm.cs C#

     

    8.2.6 Combining Consolidators

    Introduction

    Sequential consolidators wire two internal consolidators together such that the output of the first consolidator is the input to the second consolidator and the output of the second consolidator is the output of the sequential consolidator.

    Create Consolidators

    To create a sequential consolidator, create two consolidators and then pass them to the SequentialConsolidator constructor.

    # This first consolidator produces a consolidated bar after a day passes
    one_day_consolidator = TradeBarConsolidator(timedelta(days=1))
    
    # This second consolidators produces a consolidated bar after it sees 3 samples
    three_count_consolidator = TradeBarConsolidator(3)
    
    # This sequential consolidator aggregates three 1-day bars together
    self.consolidator = SequentialConsolidator(one_day_consolidator, three_count_consolidator)
    // This first consolidator produces a consolidated bar after a day passes
    var oneDayConsolidator = new TradeBarConsolidator(TimeSpan.FromDays(1));
    
    // This second consolidators produces a consolidated bar after it sees 3 samples
    var threeCountConsolidator = new TradeBarConsolidator(3);
    
    // This sequential consolidator aggregates three 1-day bars together
    _consolidator = new SequentialConsolidator(oneDayConsolidator, threeCountConsolidator);

    For more information about each type of consolidator, see Consolidator Types .

    Examples

    Demonstration Algorithms
    DataConsolidationAlgorithm.py Python DataConsolidationAlgorithm.cs C#

     

    8.3 Consolidator History

    Introduction

    This page explains how to save and access historical consolidated bars.

    Save Consolidated Bars

    To access historical bars that were passed to your consolidation handler, save the bars as you receive them. You can use a RollingWindow to save the consolidated bars and easily access them later on in your algorithm.

    // Create a class member to store the RollingWindow
    _window = new RollingWindow<TradeBar>(2);
    
    // In the consolidation handler, add consolidated bars to the RollingWindow
    private void ConsolidationHandler(object sender, TradeBar consolidatedBar)
    {
        _window.Add(consolidatedBar);
    }
    # Create a class member to store the RollingWindow
    self.window = RollingWindow[TradeBar](2)
    
    # In the consolidation handler, add consolidated bars to the RollingWindow
    def consolidation_handler(self, sender: object, consolidated_bar: TradeBar) -> None:
        self.window.Add(consolidated_bar)

    Get Historical Bars

    If you save consolidated bars in a RollingWindow , you can access them by indexing the RollingWindow . RollingWindow objects operate on a first-in, first-out process to allow for reverse list access semantics. Index 0 refers to the most recent item in the window and the largest index refers to the last item in the window.

    var mostRecentBar = _window[0];
    var previousBar = _window[1];
    var oldestBar = _window[_window.Count-1];
    most_recent_bar = self.window[0]
    previous_bar = self.window[1]
    oldest_bar = self.window[self.window.Count-1]

    To get the consolidated bar that was most recently removed from the RollingWindow , use the MostRecentlyRemoved property.

    var removedBar = _window.MostRecentlyRemoved;
    removed_bar = self.window.MostRecentlyRemoved

     

    8.4 Updating Indicators

    Introduction

    You can use consolidators to automatically update indicators in your algorithms. The consolidators can update your indicators at each time step or with aggregated bars. By default, LEAN updates data point indicators with the close price of the consolidated bars, but you can change it to a custom data field.

    Standard Indicator Periods

    If your algorithm has a static universe, you can create automatic indicators in just one line of code. When you create an automatic indicator, LEAN creates a consolidator, hooks it up for automatic updates, and then updates the indicator with the consolidated bars.

    // Consolidate minute SPY data into 14-bar daily indicators
    var ema = EMA("SPY", 14, Resolution.Daily);
    var sma = SMA("SPY", 14, Resolution.Daily);
     # Consolidate minute SPY data into 14-bar daily indicators
    ema = self.EMA("SPY", 14, Resolution.Daily)
    sma = self.SMA("SPY", 14, Resolution.Daily)

    If your algorithm has a dynamic universe, create a manual indicator and then create a time period consolidator that updates the indicator at each time step. Keep a reference to the consolidator so you can remove it when your algorithm removes the security from the universe.

    _ema = new ExponentialMovingAverage(14);
    _consolidator = new TradeBarConsolidator(1);
    _consolidator.DataConsolidated += (_, bar) => ema.Update(bar.EndTime, bar.Close);
    SubscriptionManager.AddConsolidator(_symbol, _consolidator);
    
    self.ema = ExponentialMovingAverage(14)
    self.consolidator = TradeBarConsolidator(1)
    self.consolidator.DataConsolidated += lambda _, bar: self.ema.Update(bar.EndTime, bar.Close)
    self.SubscriptionManager.AddConsolidator(self.symbol, self.consolidator)
    

    Custom Indicator Periods

    It's common to update indicators with price data that spans a normal time period like one minute or one day. It's less common to update an indicator with exotic time periods (for example, a 7-minute consolidated bar), so these types of indicators may provide more opportunities for alpha. To update indicators with exotic data, create a manual indicator and then call the RegisterIndicator method. The RegisterIndicator method wires up the indicator for automatic updates at the time interval you provide.

    // Calculate the SMA with 10 7-minute bars
    var symbol = AddEquity("SPY", Resolution.Minute).Symbol;
    var indicator = new SimpleMovingAverage(10);
    RegisterIndicator(symbol, indicator, TimeSpan.FromMinutes(7));
    
    # Calculate the SMA with 10 7-minute bars
    self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol
    self.indicator = SimpleMovingAverage(10)
    self.RegisterIndicator(self.symbol, self.indicator, timedelta(minutes=7))
    

    The RegisterIndicator method can accept a timedelta TimeSpan , Resolution , or an unregistered consolidator. If you apply the indicator to a security in a dynamic universe, provide a consolidator so that you can remove it when your algorithm removes the security from the universe.

    // TimeSpan
    RegisterIndicator(symbol, indicator, TimeSpan.FromMinutes(7));
    
    // Resolution
    RegisterIndicator(symbol, indicator, Resolution.Hour);
    
    // Consolidator
    _consolidator = new TradeBarConsolidator(35);
    RegisterIndicator(symbol, indicator, _consolidator);
    
    # timedelta
    self.RegisterIndicator(self.symbol, self.indicator, timedelta(minutes=7))
    
    # Resolution
    self.RegisterIndicator(self.symbol, self.indicator, Resolution.Hour)
    
    # Consolidator
    self.consolidator = TradeBarConsolidator(35)
    self.RegisterIndicator(self.symbol, self.indicator, self.consolidator)
    

    Custom Indicator Values

    Data point indicators use only a single price data in their calculations. By default, those indicators use the closing price. For assets with TradeBar data, that price is the TradeBar close price. For assets with QuoteBar data, that price is the mid-price of the bid closing price and the ask closing price. To create an indicator with the other fields like the Open , High , Low , or Close , provide a selector argument to the RegisterIndicator method.

    // Define a 10-period RSI with indicator the constructor
    _rsi = new RelativeStrengthIndex(10, MovingAverageType.Simple);
    
    // Register the daily High price data to automatically update the indicator
    RegisterIndicator(symbol, _rsi, Resolution.Daily, Field.High);
    # Define a 10-period RSI with indicator constructor
    self.rsi = RelativeStrengthIndex(10, MovingAverageType.Simple)
    
    # Register the daily High price data to automatically update the indicator
    self.RegisterIndicator(self.symbol, self.rsi, Resolution.Daily, Field.High)

    The RegisterIndicator method can accept a timedelta TimeSpan , Resolution , or an unregistered consolidator. If you apply the indicator to a security in a dynamic universe, provide a consolidator so that you can remove it when your algorithm removes the security from the universe.

    The Field class has the following selector properties:

    To create a custom selector , define a function that calculates the value.

    RegisterIndicator(_symbol, _rsi,  Resolution.Daily, x =>
    {
        var bar = x as IBaseDataBar;
        return (bar.Low + bar.High) / 2;
    });

     

    9 Historical Data

    9.1 History Requests

    Introduction

    There are two ways to request historical data in your algorithms: direct historical data requests and indirect algorithm warm up . You can use a direct historical data request at any time throughout your algorithm. It returns all of the data you request as a single object.

    Key History Concepts

    The historical data API has many different options to give you the greatest flexibility in how to apply it to your algorithm.

    Time Period Options

    You can request historical data based on a trailing number of bars, a trailing period of time, or a defined period of time. If you request data in a defined period of time, the DateTime datetime objects you provide are based in the algorithm time zone .

    Return Formats

    Each asset class supports slightly different data formats. When you make a history request, consider what data returns. Depending on how you request the data, history requests return a specific data type. For example, if you don't provide Symbol objects, you get Slice objects that contain the entire universe.

    The most popular return type is a DataFrame . If you request a DataFrame , LEAN unpacks the data from Slice objects to populate the DataFrame . If you intend to use the data in the DataFrame to create TradeBar or QuoteBar objects, request that the history request returns the data type you need. Otherwise, LEAN will waste computational resources populating the DataFrame .

    Time Index

    When your history request returns a DataFrame , the timestamps in the DataFrame are based on the data time zone . When your history request returns a TradeBars , QuoteBars , Ticks , or Slice object, the Time properties of these objects are based on the algorithm time zone, but the EndTime properties of the individual TradeBar , QuoteBar , and Tick objects are based on the data time zone data time zone . The EndTime is the end of the sampling period and when the data is actually available. For daily US Equity data, this results in data points appearing on Saturday and skipping Monday.

    Request Data

    The simplest form of history request is for a known set of Symbol objects. This is common for fixed universes of securities or when you need to prepare new securities added to your algorithm. History requests return slightly different data depending on the overload you call. The data that returns is in ascending order from oldest to newest. This order is necessary to use the data to warm up indicators.

    Single Symbol History Requests

    To request history for a single asset, pass the asset Symbol to the History method. The return type of the method call depends on the history request [Type] <Type> . The following table describes the return type of each request [Type] <Type> :

    Request Type Return Data Type
    No argument DataFrame List<TradeBar>
    TradeBar List[TradeBars] List<TradeBar>
    QuoteBar List[QuoteBars] List<QuoteBar>
    Tick List[Ticks] List<Tick>
    alternativeDataClass
    (ex: CBOE )
    List[ alternativeDataClass ]
    (ex: List[CBOE] )
    List< alternativeDataClass >
    (ex: List<CBOE> )

    Each row of the DataFrame represents the prices at a point in time. Each column of the DataFrame is a property of that price data (for example, open, high, low, and close (OHLC)). If you request a DataFrame object and pass TradeBar as the first argument, the DataFrame that returns only contains the OHLC and volume columns. If you request a DataFrame object and pass QuoteBar as the first argument, the DataFrame that returns contains the OHLC of the bid and ask and it contains OHLC columns, which are the respective means of the bid and ask OHLC values. If you request a DataFrame and don't pass TradeBar or QuoteBar as the first arugment, the DataFrame that returns contains columns for all of the data that's available for the given resolution.

    # EXAMPLE 1: Requesting By Bar Count: 5 bars at the security resolution:
    vix_symbol = self.AddData(CBOE, "VIX", Resolution.Daily).Symbol
    cboe_data = self.History[CBOE](vix_symbol, 5)
    
    btc_symbol = self.AddCrypto("BTCUSD", Resolution.Minute).Symbol
    trade_bars = self.History[TradeBar](btc_symbol, 5)
    quote_bars = self.History[QuoteBar](btc_symbol, 5)
    trade_bars_df = self.History(TradeBar, btc_symbol, 5)
    quote_bars_df = self.History(QuoteBar, btc_symbol, 5)
    df = self.History(btc_symbol, 5)   # Includes trade and quote data
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 1: Requesting By Bar Count: 5 bars at the security resolution:
    var vixSymbol = AddData<CBOE>("VIX", Resolution.Daily).Symbol;
    var cboeData = History<CBOE>(vixSymbol, 5);
    
    var btcSymbol = AddCrypto("BTCUSD", Resolution.Minute).Symbol;
    var tradeBars = History<TradeBar>(btcSymbol, 5);
    var quoteBars = History<QuoteBar>(btcSymbol, 5);
    var tradeBars2 = History(btcSymbol, 5);
    # EXAMPLE 2: Requesting By Bar Count: 5 bars with a specific resolution:
    trade_bars = self.History[TradeBar](btc_symbol, 5, Resolution.Daily)
    quote_bars = self.History[QuoteBar](btc_symbol, 5, Resolution.Minute)
    trade_bars_df = self.History(TradeBar, btc_symbol, 5, Resolution.Minute)
    quote_bars_df = self.History(QuoteBar, btc_symbol, 5, Resolution.Minute)
    df = self.History(btc_symbol, 5, Resolution.Minute)  # Includes trade and quote data
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 2: Requesting By Bar Count: 5 bars with a specific resolution:
    var tradeBars = History<TradeBar>(btcSymbol, 5, Resolution.Daily);
    var quoteBars = History<QuoteBar>(btcSymbol, 5, Resolution.Minute);
    var tradeBars2 = History(btcSymbol, 5, Resolution.Minute);
    # EXAMPLE 3: Requesting By a Trailing Period: 3 days of data at the security resolution: 
    eth_symbol = self.AddCrypto('ETHUSD', Resolution.Tick).Symbol
    ticks = self.History[Tick](eth_symbol, timedelta(days=3))
    ticks_df = self.History(eth_symbol, timedelta(days=3))
    
    vix_data = self.History[CBOE](vix_symbol, timedelta(days=3)) 
    trade_bars = self.History[TradeBar](btc_symbol, timedelta(days=3)) 
    quote_bars = self.History[QuoteBar](btc_symbol, timedelta(days=3))
    trade_bars_df = self.History(TradeBar, btc_symbol, timedelta(days=3))
    quote_bars_df = self.History(QuoteBar, btc_symbol, timedelta(days=3))
    df = self.History(btc_symbol, timedelta(days=3))  # Includes trade and quote data
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 3: Requesting By a Trailing Period: 3 days of data at the security resolution:
    var ethSymbol = AddCrypto("ETHUSD", Resolution.Tick).Symbol;
    var ticks = History<Tick>(ethSymbol, TimeSpan.FromDays(3));
    
    var cboeData = History<CBOE>(vixSymbol, TimeSpan.FromDays(3));
    var tradeBars = History<TradeBar>(btcSymbol, TimeSpan.FromDays(3));
    var quoteBars = History<QuoteBar>(btcSymbol, TimeSpan.FromDays(3));
    var tradeBars2 = History(btcSymbol, TimeSpan.FromDays(3));
    # EXAMPLE 4: Requesting By a Trailing Period: 3 days of data with a specific resolution: 
    trade_bars = self.History[TradeBar](btc_symbol, timedelta(days=3), Resolution.Daily) 
    quote_bars = self.History[QuoteBar](btc_symbol, timedelta(days=3), Resolution.Minute)
    ticks = self.History[Tick](eth_symbol, timedelta(days=3), Resolution.Tick)
    
    trade_bars_df = self.History(TradeBar, btc_symbol, timedelta(days=3), Resolution.Daily)
    quote_bars_df = self.History(QuoteBar, btc_symbol, timedelta(days=3), Resolution.Minute)
    ticks_df = self.History(eth_symbol, timedelta(days=3), Resolution.Tick)
    df = self.History(btc_symbol, timedelta(days=3), Resolution.Hour)  # Includes trade and quote data
    Historical hourly data dataframe of BTCUSD
    # Important Note: Period history requests are relative to "now" algorithm time.
    // EXAMPLE 4: Requesting By a Trailing Period: 3 days of data with a specific resolution:
    var tradeBars = History<TradeBar>(btcSymbol, TimeSpan.FromDays(3), Resolution.Daily);
    var quoteBars = History<QuoteBar>(btcSymbol, TimeSpan.FromDays(3), Resolution.Minute);
    var ticks = History<Tick>(ethSymbol, TimeSpan.FromDays(3), Resolution.Tick);
    var tradeBars2 = History(btcSymbol, TimeSpan.FromDays(3), Resolution.Minute);
    # EXAMPLE 5: Requesting By a Defined Period: 3 days of data at the security resolution: 
    start_time = datetime(2022, 1, 1)
    end_time = datetime(2022, 1, 4)
    
    vix_data = self.History[CBOE](vix_symbol, start_time, end_time) 
    trade_bars = self.History[TradeBar](btc_symbol, start_time, end_time) 
    quote_bars = self.History[QuoteBar](btc_symbol, start_time, end_time)
    ticks = self.History[Tick](eth_symbol, start_time, end_time)
    
    trade_bars_df = self.History(TradeBar, btc_symbol, start_time, end_time)
    quote_bars_df = self.History(QuoteBar, btc_symbol, start_time, end_time)
    ticks_df = self.History(Tick, eth_symbol, start_time, end_time)
    df = self.History(btc_symbol, start_time, end_time)  # Includes trade and quote data
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 5: Requesting By a Defined Period: 3 specific days of data at the security resolution:
    var startTime = new DateTime(2022, 1, 1);
    var endTime = new DateTime(2022, 1, 4);
    
    var cboeData = History<CBOE>(vixSymbol, startTime, endTime);
    var tradeBars = History<TradeBar>(btcSymbol, startTime, endTime);
    var quoteBars = History<QuoteBar>(btcSymbol, startTime, endTime);
    var ticks = History<Tick>(ethSymbol, startTime, endTime);
    var tradeBars2 = History(btcSymbol, startTime, endTime);
    # EXAMPLE 6: Requesting By a Defined Period: 3 days of data with a specific resolution: 
    trade_bars = self.History[TradeBar](btc_symbol, start_time, end_time, Resolution.Daily) 
    quote_bars = self.History[QuoteBar](btc_symbol, start_time, end_time, Resolution.Minute)
    ticks = self.History[Tick](eth_symbol, start_time, end_time, Resolution.Tick)
    
    trade_bars_df = self.History(TradeBar, btc_symbol, start_time, end_time, Resolution.Daily)
    quote_bars_df = self.History(QuoteBar, btc_symbol, start_time, end_time, Resolution.Minute)
    ticks_df = self.History(eth_symbol, start_time, end_time, Resolution.Tick)
    df = self.History(btc_symbol, start_time, end_time, Resolution.Hour)  # Includes trade and quote data
    Historical hourly data dataframe of BTCUSD
    
    // EXAMPLE 6: Requesting By a Defined Period: 3 days of data with a specific resolution:
    var tradeBars = History<TradeBar>(btcSymbol, startTime, endTime, Resolution.Daily);
    var quoteBars = History<QuoteBar>(btcSymbol, startTime, endTime, Resolution.Minute);
    var ticks = History<Tick>(ethSymbol, startTime, endTime, Resolution.Tick);
    var tradeBars2 = History(btcSymbol, startTime, endTime, Resolution.Minute);

    Multiple Symbol History Requests

    To request history for multiple symbols at a time, pass an array of Symbol objects to the same API methods shown in the preceding section. The return type of the method call depends on the history request [Type] <Type> . The following table describes the return type of each request [Type] <Type> :

    Request Type Return Data Type
    No argument DataFrame List<Slice>
    TradeBar List[TradeBars] List<TradeBars>
    QuoteBar List[QuoteBars] List<QuoteBars>
    Tick List[Ticks] List<Ticks>
    alternativeDataClass
    (ex: CBOE )
    List[Dict[Symbol, alternativeDataClass ]]
    (ex: List[Dict[Symbol, CBOE]] )
    List<Dictionary<Symbol, alternativeDataClass >>
    (ex: List<Dictionary<Symbol, CBOE>> )

    The Slice return type provides a container that supports all data types. For example, a history request for Forex QuoteBars and Equity TradeBars has the Forex data under slices.QuoteBars and the Equity data under slices.Bars .

    # EXAMPLE 7: Requesting By Bar Count for Multiple Symbols: 2 bars at the security resolution:
    vix = self.AddData[CBOE]("VIX", Resolution.Daily).Symbol
    v3m = self.AddData[CBOE]("VIX3M", Resolution.Daily).Symbol
    cboe_data = self.History[CBOE]([vix, v3m], 2)
    
    ibm = self.AddEquity("IBM", Resolution.Minute).Symbol
    aapl = self.AddEquity("AAPL", Resolution.Minute).Symbol
    trade_bars_list = self.History[TradeBar]([ibm, aapl], 2)
    quote_bars_list = self.History[QuoteBar]([ibm, aapl], 2)
    
    trade_bars_df = self.History(TradeBar, [ibm, aapl], 2)
    quote_bars_df = self.History(QuoteBar, [ibm, aapl], 2)
    df = self.History([ibm, aapl], 2)  # Includes trade and quote data
    Historical minute data dataframe of IBM & AAPL
    
    // EXAMPLE 7: Requesting By Bar Count for Multiple Symbols: 2 bars at the security resolution:
    var vixSymbol = AddData<CBOE>("VIX", Resolution.Daily).Symbol;
    var v3mSymbol = AddData<CBOE>("VIX3m", Resolution.Daily).Symbol;
    var cboeData = History<CBOE>(new[] { vix, v3m }, 2);
    
    var ibm = AddEquity("IBM", Resolution.Minute).Symbol;
    var aapl = AddEquity("AAPL", Resolution.Minute).Symbol;
    var tradeBarsList = History<TradeBar>(new[] { ibm, aapl }, 2);
    var quoteBarsList = History<QuoteBar>(new[] { ibm, aapl }, 2);
    
    # EXAMPLE 8: Requesting By Bar Count for Multiple Symbols: 5 bars with a specific resolution:
    trade_bars_list = self.History[TradeBar]([ibm, aapl], 5, Resolution.Daily)
    quote_bars_list = self.History[QuoteBar]([ibm, aapl], 5, Resolution.Minute)
    
    trade_bars_df = self.History(TradeBar, [ibm, aapl], 5, Resolution.Daily)
    quote_bars_df = self.History(QuoteBar, [ibm, aapl], 5, Resolution.Minute)
    df = self.History([ibm, aapl], 5, Resolution.Daily)  # Includes trade data only. No quote for daily equity data
    Historical daily data dataframe of IBM & AAPL
    
    // EXAMPLE 8: Requesting By Bar Count for Multiple Symbols: 5 bars with a specific resolution:
    var tradeBarsList = History<TradeBar>(new[] { ibm, aapl }, 5, Resolution.Minute);
    var quoteBarsList = History<QuoteBar>(new[] { ibm, aapl }, 5, Resolution.Minute);
    
    # EXAMPLE 9: Requesting By Trailing Period: 3 days of data at the security resolution: 
    ticks = self.History[Tick]([eth_symbol], timedelta(days=3))
    
    trade_bars = self.History[TradeBar]([btc_symbol], timedelta(days=3)) 
    quote_bars = self.History[QuoteBar]([btc_symbol], timedelta(days=3))
    trade_bars_df = self.History(TradeBar, [btc_symbol], timedelta(days=3))
    quote_bars_df = self.History(QuoteBar, [btc_symbol], timedelta(days=3))
    df = self.History([btc_symbol], timedelta(days=3))  # Includes trade and quote data 
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 9: Requesting By Trailing Period: 3 days of data at the security resolution:
    var ticks = History<Tick>(new[] {ethSymbol}, TimeSpan.FromDays(3));
    
    var tradeBars = History<TradeBar>(new[] {btcSymbol}, TimeSpan.FromDays(3));
    var quoteBars = History<QuoteBar>(new[] {btcSymbol}, TimeSpan.FromDays(3));
    var tradeBars2 = History(new[] {btcSymbol}, TimeSpan.FromDays(3));
    # EXAMPLE 10: Requesting By Defined Period: 3 days of data at the security resolution: 
    trade_bars = self.History[TradeBar]([btc_symbol], start_time, end_time) 
    quote_bars = self.History[QuoteBar]([btc_symbol], start_time, end_time)
    ticks = self.History[Tick]([eth_symbol], start_time, end_time)
    trade_bars_df = self.History(TradeBar, btc_symbol, start_time, end_time)
    quote_bars_df = self.History(QuoteBar, btc_symbol, start_time, end_time)
    ticks_df = self.History(Tick, eth_symbol, start_time, end_time)
    df = self.History([btc_symbol], start_time, end_time)  # Includes trade and quote data
    Historical minute data dataframe of BTCUSD
    
    // EXAMPLE 10: Requesting By Defined Period: 3 days of data at the security resolution:
    var tradeBars = History<TradeBar>(new[] {btcSymbol}, startTime, endTime);
    var quoteBars = History<QuoteBar>(new[] {btcSymbol}, startTime, endTime);
    var ticks = History<Tick>(new[] {ethSymbol}, startTime, endTime);
    var tradeBars2 = History(new[] {btcSymbol}, startTime, endTime);

    All Symbol History Requests

    You can request history for all active securities in your universe. The parameters are very similar to other history method calls, but the return type is an array of Slice objects. The Slice object holds all of the results in a sorted enumerable collection that you can iterate over with a loop.

    # EXAMPLE 11: Requesting 5 bars for all securities at their respective resolution:
    
    # Create subscriptions
    self.AddEquity("IBM", Resolution.Daily)
    self.AddEquity("AAPL", Resolution.Daily)
    
    # Request history data and enumerate results
    slices = self.History(5)
    for s in slices:
        self.Log(str(s.Time) + " AAPL:" + str(s.Bars["AAPL"].Close) + " IBM:" + str(s.Bars["IBM"].Close))
    Historical daily close price output of IBM & AAPL
    
    // EXAMPLE 11: Requesting 5 bars for all securities at their respective resolution:
    
    // Set up the universe
    AddEquity("IBM", Resolution.Daily);
    AddEquity("AAPL", Resolution.Daily);
    
    // Request history data and enumerate results:
    var slices = History(5);
    foreach (var s in slices) {
        var aaplClose = s.Bars["AAPL"].Close;
        var ibmClose = s.Bars["IBM"].Close;
        Log($"{s.Time} AAPL: {aaplClose} IBM: {ibmClose}");
    }
    Historical daily close price output of IBM & AAPL
    
    # EXAMPLE 12: Requesting 5 minutes for all securities:
    
    slices = self.History(timedelta(minutes=5), Resolution.Minute)
    for s in slices:
        self.Log(str(s.Time) + " AAPL:" + str(s.Bars["AAPL"].Close) + " IBM:" + str(s.Bars["IBM"].Close))
    Historical minute close price output of IBM & AAPL
    # timedelta history requests are relative to "now" in algorithm Time. If you request this data at 16:05, it returns an empty array because the market is closed.
    // EXAMPLE 12: Requesting 24 hours of hourly data for all securities:
    
    var slices = History(TimeSpan.FromHours(24), Resolution.Hour);
    foreach (var s in slices) {
        var aaplClose = s.Bars["AAPL"].Close;
        var ibmClose = s.Bars["IBM"].Close;
        Log($"{s.Time} AAPL: {aaplClose} IBM: {ibmClose}");
    }
    Historical hourly close price output of IBM & AAPL
    // TimeSpan history requests are relative to "now" in algorithm Time.

    Assumed Default Values

    The following table describes the assumptions of the History API:

    Argument Assumption
    Resolution LEAN guesses the resolution you request by looking at the securities you already have in your algorithm. If you have a security subscription in your algorithm with a matching Symbol , the history request uses the same resolution as the subscription. If you don't have a security subscription in your algorithm with a matching Symbol , Resolution.Minute is the default.
    Bar type If you don't specify a type for the history request, TradeBar is the default. If the asset you request data for doesn't have TradeBar data, specify the QuoteBar type to receive history.

    Additional Options

    The History method accepts the following additional arguments:

    Argument Data Type Description Default Value
    fillForward bool? bool/NoneType True to fill forward missing data. Otherwise, false. null None
    extendedMarketHours bool? bool/NoneType True to include extended market hours data. Otherwise, false. null None
    dataMappingMode DataMappingMode? DataMappingMode/NoneType The contract mapping mode to use for the security history request. null None
    dataNormalizationMode DataNormalizationMode? DataNormalizationMode/NoneType The price scaling mode to use for US Equities or continuous Futures contracts . If you don't provide a value, it uses the data normalization mode of the security subscription. null None
    contractDepthOffset int? int/NoneType The desired offset from the current front month for continuous Futures contracts . null None
    self.future = self.AddFuture(Futures.Currencies.BTC)
    history = self.History(
        tickers=[self.future.Symbol], 
        start=self.Time - timedelta(days=15), 
        end=self.Time, 
        resolution=Resolution.Minute, 
        fillForward=False, 
        extendedMarketHours=False, 
        dataMappingMode=DataMappingMode.OpenInterest, 
        dataNormalizationMode=DataNormalizationMode.Raw, 
        contractDepthOffset=0)
    var future = AddFuture(Futures.Currencies.BTC);
    var history = History(
        symbols: new[] {future.Symbol}, 
        start: Time - TimeSpan.FromDays(15),
        end: Time,
        resolution: Resolution.Minute,
        fillForward: false,
        extendedMarketHours: false,
        dataMappingMode: DataMappingMode.OpenInterest,
        dataNormalizationMode: DataNormalizationMode.Raw,
        contractDepthOffset: 0);

    Analyze Results

    The History method returns a multi-index DataFrame where the first index is the Symbol . The data is then sorted in rows according to the second index, the EndTime of the bar. By learning a few helpful shortcuts, you can directly access the history values you need for your algorithm.

    # Setup the universe:
    eurusd = self.AddForex("EURUSD", Resolution.Daily).Symbol
    nzdusd = self.AddForex("NZDUSD", Resolution.Daily).Symbol
    
    # STEP 1:  Request a DataFrame:
    self.df = self.History([eurusd, nzdusd], 3)
    Historical data of EURUSD, & NZDUSD
    
    
    # STEP 2: Check if the DataFrame is empty and lock onto a Symbol index with the `loc[]` method.
    #  You can access a security’s data in a DataFrame by using the Symbol or the string representation of the Symbol
    if not self.df.empty:
        eurusd_quotebars = self.df.loc[eurusd] # or just "EURUSD" instead of Symbol
    Historical data of EURUSD
    
    
    # STEP 3: Extract and manipulate a single column with the string column name
    spread = eurusd_quotebars["askclose"] - eurusd_quotebars["bidclose"]
    Historical close price spreads of EURUSD
    # Make sure to use the lowercase string column name.

    To perform analysis between assets, you can unstack the DataFrame . The unstack method transforms each column into the Symbol values for one of the price-columns you select.

    # UNSTACKING: Transform into columns
    
    # Fetch multi-indexed history:
    self.dataframe = self.History([self.Symbol("IBM"), self.Symbol("AAPL")], 3)
    Historical data of IBM, & AAPL
    
    # Transform using unstack:
    self.dataframe["close"].unstack(level=0)
    Historical close price of IBM, & AAPL
    # Make sure to use the lowercase string column name.

    The History method returns an array of TradeBar , QuoteBar , or Slice objects, depending on how you call the method. To access the members of each of these objects, iterate over the objects in a for loop.

    // Set up the universe
    var spy = AddEquity("SPY").Symbol;
    var aapl = AddEquity("AAPL").Symbol;
    
    // Example 1: Iterate over TradeBar objects
    var tradeBars = History(spy, 10);
    foreach (var tradeBar in tradeBars)
    {
        Debug($"{tradeBar.Time}: {tradeBar.Close}");
    }
    
    // Example 2: Iterate over QuoteBar objects
    var quoteBars = History(aapl, 10);
    foreach (var quoteBar in quoteBars)
    {
         Debug($"{s.Time}: {quoteBar.Bid.Close} / {quoteBar.Ask.Close}");
    }
    
    // Example 3: Iterate over Slice objects
    var slices = History(new[] {spy, aapl}, 10);
    foreach (var slice in slices)
    {
        Debug($"{slice.Time}: AAPL {slice.QuoteBars[aapl].Bid.Close}, SPY {slice[spy].Close}");
    }
    

    Data Formats

    We provide a specific data formats for each asset class. To view the available data formats, see the Resolutions documentation of the following asset classes:

    Common Errors

    Errors can occur when you request historical data.

    Empty Data Errors

    If the history request returns an empty DataFrame and you try to slice it, it throws an exception. To avoid issues, check if the DataFrame contains data before slicing it.

    df = self.History(symbol, 10).close    # raises exception if the request is empty
    
    def GetSafeHistoryCloses(self, symbols):
        if not symbols:
            self.Log(f'No symbols')
            return  False, None
        df = self.History(symbols, 100, Resolution.Daily)
        if df.empty:
            self.Log(f'Empy history for {symbols}')
            return  False, None
         return True, df.close.unstack(0)

    If you run algorithms on your local machine and history requests return no data, check if your data directory contains the data you request. To download datasets, see Download .

    Numerical Precision Errors

    Some factor files have INF split values, which indicate that the stock has so many splits that prices can't be calculated with correct numerical precision. To allow history requests with these symbols, we need to move the starting date forward when reading the data. If there are numerical precision errors in the factor files for a security in your history request, LEAN throws the following error:

    "Warning: when performing history requests, the start date will be adjusted if there are numerical precision errors in the factor files."

    Live Trading Considerations

    In live trading, if you make a history request for minute data at noon and the history period covers the start of the previous day to the present moment, the data from the previous day will be backtest data. The data of the current day will be live data that we collected throughout the morning. If you make this history request in a backtest, you might get slightly different data for the current day because of post-processing from the data vendor.

    Examples

    Demonstration Algorithm
    HistoryAlgorithm.py Python WarmupHistoryAlgorithm.py Python HistoryAlgorithm.cs C# WarmupHistoryAlgorithm.cs C#

     

    9.2 Warm Up Periods

    Introduction

    LEAN supports an automated fast-forward system called "Warm Up". It simulates winding back the clock from the time you deploy the algorithm. In a backest, this is the StartDate of your algorithm. In live trading, it's the current date. Warm Up is a great way to prepare your algorithm and its indicators for trading.

    Set Warm Up Periods

    You can set a warm-up period based on a period of time or a number of bars. To set a warm-up, in your algorithm's Initialize method, call the SetWarmUp method.

    // Wind time back 7 days from start
    SetWarmUp(TimeSpan.FromDays(7));
    
    // Feed in 100 bars before start date
    SetWarmUp(100);
    
    # Wind time back 7 days from start
    self.SetWarmUp(timedelta(7))
    
    # Feed in 100 bars before start date
    self.SetWarmUp(100)
    

    If you pass a timedelta TimeSpan argument, the warm-up period consists of that timedelta TimeSpan before the start date and pipes in data that matches the resolution of your data subscriptions.

    If you pass just an integer argument, LEAN calculates the start of the warm-up period for each of your security subscriptions by using the number of bars you specify, the resolution of each security, and the trading calendar of each security. After it calculates the start time of the warm-up period for each security, it sets the earliest start time as the start of the algorithm warm-up period. For instance, in the following example, the warm-up period consists of 100 minute resolution bars for SPY and as many second resolution bars for BTCUSD that occur from the start of the SPY warm-up period to the algorithm StartDate .

    AddEquity("SPY", Resolution.Minute, fillForward: false);
    AddCrypto("BTCUSD", Resolution.Second, fillForward: false);
    SetWarmUp(100);
    
    self.AddEquity("SPY", Resolution.Minute, fillForward=False)
    self.AddCrypto("BTCUSD", Resolution.Second, fillForward=False)
    self.SetWarmUp(100)
    

    To use a specific resolution of data for the warm-up period, pass a resolution argument to the SetWarmUp method.

    // Feed in 100 days of daily data before the start date
    SetWarmUp(TimeSpan.FromDays(100), Resolution.Daily);
    
    // Feed in data for 100 trading days of daily data before the start date
    SetWarmUp(100, Resolution.Daily);
    # Feed in 100 days of daily data before the start date
    self.SetWarmUp(timedelta(days=100), Resolution.Daily)
    
    # Feed in data for 100 trading days before the start date
    self.SetWarmUp(100, Resolution.Daily)

    If you pass a timedelta TimeSpan and a resolution, the warm-up period consists of the time period and resolution you set, regardless of the resolution of your data subscriptions.

    If you pass an integer and a resolution, the warm-up period consists of the number of bars and resolution you set, regardless of the resolution of your data subscriptions. In this case, LEAN calculates the start of the warm-up period for each of your security subscriptions just like it does when you only pass an integer argument. After it calculates the start time of the warm-up period for each security, it sets the earliest start time as the start of the algorithm warm-up period.

    If you pass a resolution argument and you registered indicators or consolidators for automatic updates, the warm-up period resolution must be less than or equal to the lowest resolution of your automatic indicators and consolidators. For instance, in the following example, the indicators use minute resolution data, so you can set the warm-up period to use tick, second, or minute resolution data.

    _spy = AddEquity("SPY", Resolution.Minute, fillForward: false).Symbol;
    _btc = AddCrypto("BTCUSD", Resolution.Second, fillForward: false).Symbol;
    
    _spySma = SMA(_spy, 10);
    _btcSMA = SMA(_btc, 10, Resolution.Minute);
    
    SetWarmUp(100, Resolution.Minute);
    
    self.spy = self.AddEquity("SPY", Resolution.Minute, fillForward=False).Symbol
    self.btc = self.AddCrypto("BTCUSD", Resolution.Second, fillForward=False).Symbol
    
    self.spy_sma = self.SMA(self.spy, 10)
    self.btc_sma = self.SMA(self.btc, 10, Resolution.Minute)
    
    self.SetWarmUp(100, Resolution.Minute)
    

    Warm Up Vs Reality

    You may need to distinguish warm-up data from real data. To check if the algorithm is currently in a warm up period, use the IsWarmingUp property.

    // In Initialize
    var emaFast = EMA("IBM", 50);
    var emaSlow = EMA("IBM", 100);
    SetWarmup(100);
    
    // In OnData: Don't run if the indicators aren't ready
    if (IsWarmingUp) return;
    
    # In Initialize
    self.emaFast = self.EMA("IBM", 50);
    self.emaSlow = self.EMA("IBM", 100);
    self.SetWarmup(100);
    
    // In OnData: Don't run if the indicators aren't ready
    if self.IsWarmingUp: return
    

    Event Handler

    The OnWarmupFinished event handler executes when the warm up period ends, even if you don't set a warm up period.

    public override void OnWarmupFinished()
    {
        // Done warming up
    }
    
    def OnWarmupFinished(self) -> None:
        pass # Done warming up

    Limitations

    You can't place trades during the warm-up period because they would be operating on fictional fast-forwarded data.

    Examples

    Demonstration Algorithms
    WarmupAlgorithm.py Python WarmupAlgorithm.cs C#

     

    9.3 Rolling Window

    Introduction

    A RollingWindow is an array of a fixed-size that holds trailing data. It's more efficient to use RollingWindow objects to hold periods of data than to make multiple historical data requests . With a RollingWindow , you just update the latest data point while a History call fetches all of the data over the period you request. RollingWindow objects operate on a first-in, first-out process to allow for reverse list access semantics. Index 0 refers to the most recent item in the window and the largest index refers to the last item in the window.

    Supported Types

    RollingWindow objects can store any native or C# types.

    closeWindow = new RollingWindow<decimal>(4);
    tradeBarWindow = new RollingWindow<TradeBar>(2);
    quoteBarWindow = new RollingWindow<QuoteBar>(2);
    self.close_window = RollingWindow[float](4)
    self.trade_bar_window = RollingWindow[TradeBar](2)
    self.quote_bar_window = RollingWindow[QuoteBar](2)

    To be notified when RollingWindow objects support additional types, subscribe to GitHub Issue #6199 .

    Add Data

    To add data to a RollingWindow , call the Add method.

    closeWindow.Add(data["SPY"].Close);
    tradeBarWindow.Add(data["SPY"]);
    quoteBarWindow.Add(data["EURUSD"]);
    self.close_window.Add(data["SPY"].Close)
    self.trade_bar_window.Add(data["SPY"])
    self.quote_bar_window.Add(data["EURUSD"])

    Warm Up

    To warm up a RollingWindow , make a history request and then iterate through the result to add the data to the RollingWindow .

    var spy = AddEquity("SPY", Resolution.Daily).Symbol;
    var historyTradeBar = History<TradeBar>(spy, 10, Resolution.Daily);
    var historyQuoteBar = History<QuoteBar>(spy, 10, Resolution.Minute);
    
    // Warm up the close price and trade bar rolling windows with the previous 10-day trade bar data
    var closePriceWindow = new RollingWindow<decimal>(10);
    var tradeBarWindow = new RollingWindow<TradeBar>(10);
    foreach (var tradeBar in historyTradeBar)
    {
        closePriceWindow.Add(tradeBar.Close);
        tradeBarWindow.Add(tradeBar);
    }
    
    // Warm up the quote bar rolling window with the previous 10-minute quote bar data
    var quoteBarWindow = new RollingWindow<QuoteBar>(10);
    foreach (var quoteBar in historyQuoteBar)
    {
        quoteBarWindow.Add(quoteBar);
    }
    spy = self.AddEquity("SPY", Resolution.Daily).Symbol
    history_trade_bar = self.History[TradeBar](spy, 10, Resolution.Daily)
    history_quote_bar = self.History[QuoteBar](spy, 10, Resolution.Minute)
    
    # Warm up the close price and trade bar rolling windows with the previous 10-day trade bar data
    close_price_window = RollingWindow[float](10)
    trade_bar_window = RollingWindow[TradeBar](10)
    for trade_bar in history_trade_bar:
        close_price_window.Add(trade_bar.Close)
        trade_bar_window.Add(trade_bar)
    
    # Warm up the quote bar rolling window with the previous 10-minute quote bar data
    quote_bar_window = RollingWindow[QuoteBar](10)
    for quote_bar in history_quote_bar:
        quote_bar_window.Add(quote_bar)

    Check Readiness

    To check if a RollingWindow is full, use its IsReady flag.

    if (!closeWindow.IsReady) 
    {
        return;
    }
    if not self.close_window.IsReady:
        return

    Access Data

    RollingWindow objects operate on a first-in, first-out process to allow for reverse list access semantics. Index 0 refers to the most recent item in the window and the largest index refers to the last item in the window.

    var currentClose = closeWindow[0];
    var previousClose = closeWindow[1];
    var oldestClose = closeWindow[closeWindow.Count-1];
    current_close = self.close_window[0]
    previous_close = self.close_window[1]
    oldest_close = self.close_window[self.close_window.Count-1]

    To get the item that was most recently removed from the RollingWindow , use the MostRecentlyRemoved property.

    var removedClose = closeWindow.MostRecentlyRemoved;
    removed_close = self.close_window.MostRecentlyRemoved

    Combine with Indicators

    To track historical indicator values, use a RollingWindow . Indicators emit an Updated event when they update. To create a RollingWindow of indicator points, attach an event handler function to the Updated member that adds the last value of the indicator to the RollingWindow . The value is an IndicatorDataPoint object that represents a piece of data at a specific time.

    public override void Initialize()
    {
       // Create an indicator and adds to a RollingWindow when it is updated
       smaWindow = new RollingWindow<IndicatorDataPoint>(5);
       SMA("SPY", 5).Updated += (sender, updated) => smaWindow.Add(updated);
    }
    
    def Initialize(self) -> None:
        # Creates an indicator and adds to a RollingWindow when it is updated
        self.sma_window = RollingWindow[IndicatorDataPoint](5)
        self.SMA("SPY", 5).Updated += (lambda sender, updated: self.sma_window.Add(updated))

    To view how to access individual members in an indicator, see Get Indicator Values .

    var currentSma = smaWin[0];
    var previousSma = smaWin[1];
    var oldestSma = smaWin[smaWin.Count - 1];
    current_sma = self.sma_window[0]
    previous_sma = self.sma_window[1]
    oldest_sma = self.sma_window[sma_window.Count - 1]

    Combine with Consolidators

    To store a history of consolidated bars , in the consolidation handler, add the consolidated bar to the RollingWindow .

    _consolidator.DataConsolidated += (sender, consolidatedBar) => tradeBarWindow.Add(consolidatedBar);
    self.consolidator.DataConsolidated += lambda sender, consolidated_bar: self.trade_bar_window.Add(consolidated_bar)

    Cast to Other Types

    You can cast a RollingWindow to a list or a DataFrame. If you cast it to a list, reverse the list so the most recent element is at the last index of the list. This is the order the elements would be in if you added the elements to the list with the Add method. To cast a RollingWindow to a DataFrame, the RollingWindow must contain Slice , Tick , QuoteBar , or TradeBar objects. If the RollingWindow contains ticks, the ticks must have unique timestamps.

    You can cast a RollingWindow to a list. If you cast it to a list, reverse the list so the most recent element is at the last index of the list. This is the order the elements would be in if you added the elements to the list with the Add method.

    var closes = closeWindow.Reverse().ToList();
    closes = list(self.close_window)[::-1]
    
    tick_df = self.PandasConverter.GetDataFrame[Tick](list(self.tick_window)[::-1])
    trade_bar_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.trade_bar_window)[::-1])
    quote_bar_df = self.PandasConverter.GetDataFrame[QuoteBar](list(self.quote_bar_window)[::-1])

    Delete Data

    To remove all of the elements from a RollingWindow , call the Reset method.

    closeWindow.Reset();
    self.close_window.Reset()

    Examples

    Demonstration Algorithm
    RollingWindowAlgorithm.py Python CustomVolatilityModelAlgorithm.py Python MultipleSymbolConsolidationAlgorithm.py Python RollingWindowAlgorithm.cs C# MultipleSymbolConsolidationAlgorithm.cs C#

     

    10 Trading and Orders

    10.1 Key Concepts

    Introduction

    LEAN has dozens of methods to create, update, and cancel orders. You can place orders automatically with helper methods or manually through methods on the algorithm API. You can fetch, update, and cancel manual orders with order tickets . As the state of your orders change, LEAN creates events that notify your algorithm.

    In backtesting, LEAN simulates order fills with historical data, but you can create your own fill, fee, slippage, and margin models via plugin points. You control how optimistic or pessimistic order fills are with transaction model classes. For more information about these types of models, see Reality Modeling .

    Orders and Tickets

    When you create an order with one of the order methods, LEAN creates Order and OrderTicket objects. The order ticket is sent to your brokerage. As the brokerage processes your order, it returns another order ticket and it's compared against the order to see if the order is satisfied. Orders are asynchronous in live trading, so if you want to change an order, you must request it with the order ticket. Order changes are not guaranteed since your order may fill by the time brokerage receives the request.

    Flow of ordering and filling between algorithm and brokerage

    Order Types

    LEAN supports the following order types:

    Symbol Properties

    The SymbolProperties are a property of the Security object. LEAN uses some of the SymbolProperties to prevent invalid orders, and to calculate order quantities for a given target.

    SymbolProperties objects have the following properties:

    To get the SymbolProperties , use the property on the Security object.

    var symbolProperties = Securities["BTCUSD"].SymbolProperties;
    var lotSize = symbolProperties.LotSize;
    var minimumOrderSize = symbolProperties.MinimumOrderSize;
    var minimumPriceVariation = symbolProperties.MinimumPriceVariation;
    symbol_properties = self.Securities["BTCUSD"].SymbolProperties
    lot_size = symbol_properties.LotSize
    minimum_order_size = symbol_properties.MinimumOrderSize
    minimum_price_variation = symbol_properties.MinimumPriceVariation

    LEAN uses the MinimumPriceVariation to round the LimitPrice , StopPrice , and the TriggerPrice .

    Quote Currency

    The quote currency is the currency you must give the seller to buy an asset. For currency trades, the quote currency is the currency ticker on the right side of the currency pair. For other types of assets, the quote currency is usually USD, but the quote currency for India Equities is INR. To get the quote currency of a Security , use the QuoteCurrency property.

    var aaplQuoteCurrency = Securities["AAPL"].QuoteCurrency; // USD
    var btcusdtQuoteCurrency = Securities["BTCUSDT"].QuoteCurrency; // USDT
    aapl_quote_currency = self.Securities["AAPL"].QuoteCurrency # USD
    btcusdt_quote_currency = self.Securities["BTCUSDT"].QuoteCurrency # USDT

    The QuoteCurrency is a Cash object, which have the following properties:

    You can use the ConversionRate property to calculate the value of the minimum price movement in the account currency

    var cfd = Securities["SG30SGD"];
    var quoteCurrency = cfd.QuoteCurrency; // SGD
    var contractMutiplier = cfd.SymbolProperties.ContractMultiplier;
    var minimumPriceVariation = cfd.SymbolProperties.MinimumPriceVariation;
    
    // Value of a pip in account currency
    var pip = minimumPriceVariation * contractMutiplier * quoteCurrency.ConversionRate;
    cfd = self.Securities["SG30SGD"]
    quote_currency = cfd.QuoteCurrency # SGD
    contract_mutiplier = cfd.SymbolProperties.ContractMultiplier
    minimum_price_variation = cfd.SymbolProperties.MinimumPriceVariation
    
    # Value of a pip in account currency
    pip = minimum_price_variation * contract_mutiplier * quote_currency.ConversionRate

    Trade Models

    Reality models make backtests as realistic as possible to how the strategy would perform in live trading.

    Split Adjustment

    If a split event occurred before an order is filled, the unfilled portion of the order will be adjusted automatically, where its quantity will be multiplied by the split factor and the limit/stop price (if any) will be divided by the split factor.

    Live Trading Considerations

    In live trading, orders fill asynchronously. We send your order to the API of your brokerage and wait for their response to update the state of your algorithm and portfolio. The timing of live order fills doesn't depend on the resolution of your security subscriptions. When your order fills, the fill price and fee is set by your brokerage. You can add event handlers to your algorithm to monitor the brokerage connection and brokerage messages .

    In backtesting, the trade fill timing depends on the resolution of your security subscription. For example, if you subscribe to a security with minute resolution data, the algorithm only receives data in one-minute time slices . As a result, the fill model can only evaluate if the order should fill on a minute-by-minute frequency.

     

    10.2 Order Management

    10.2.1 Order Tickets

    Introduction

    When you create an order, you get an OrderTicket object to manage your order.

    Properties

    OrderTicket objects have the following attributes:

    Track Orders

    As the state of your order updates over time, your order ticket automatically updates. To track an order, you can check any of the preceding order ticket properties.

    To get an order field, call the Get method with an OrderField .

    var limitPrice = ticket.Get(OrderField.LimitPrice);
    limit_price = ticket.Get(OrderField.LimitPrice)

    The OrderField enumeration has the following members:

    In addition to using order tickets to track orders, you can receive order events through the OnOrderEvent event handler.

    Update Orders

    To update an order, use its OrderTicket . You can update other orders until they are filled or the brokerage prevents modifications. You just can't update orders during warm up and initialization .

    Updatable Properties

    The specific properties you can update depends on the order type. The following table shows the properties you can update for each order type.

    Order Type Updatable Properties
    Tag Quantity LimitPrice TriggerPrice StopPrice
    Market Order
    Limit Order green check green check green check
    Limit If Touched Order green check green check green check green check
    Stop Market Order green check green check green check
    Stop Limit Order green check green check green check green check
    Market On Open Order green check green check
    Market On Close Order green check green check

    Update Methods

    To update an order, pass an UpdateOrderFields object to the Update method. The method returns an OrderResponse to signal the success or failure of the update request.

    // Create an order 
    var ticket = LimitOrder("SPY", 100, 221.05, tag: "New SPY trade");
    
    // Update the order tag and limit price
    var response = ticket.Update(new UpdateOrderFields()
    { 
        Tag = "Our New Tag for SPY Trade",
        LimitPrice = 222.00
    });
    
    // Check the OrderResponse
    if (response.IsSuccess)
    { 
        Debug("Order updated successfully");
    }
     # Create an order 
    ticket = self.LimitOrder("SPY", 100, 221.05, False, "New SPY trade")
    
    # Update the order tag and limit price
    updateSettings = UpdateOrderFields()
    updateSettings.LimitPrice = 222.00
    updateSettings.Tag = "Limit Price Updated for SPY Trade"
    response = ticket.Update(updateSettings)
    
    # Check the OrderResponse
    if response.IsSuccess:
        self.Debug("Order updated successfully")

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var stopResponse = ticket.UpdateStopPrice(stopPrice, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateStopPrice(stopPrice, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    Update Order Requests

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Workaround for Brokerages That Don’t Support Updates

    Not all brokerages fully support order updates. To check what functionality your brokerage supports for order updates, see the Orders section of the documentation for your brokerage model . If your brokerage doesn't support order updates and you want to update an order, cancel the order . When you get an order event that confirms the order is no longer active, place a new order.

    public override void OnData(Slice slice)
    {
        // Cancel the order
        _ticket.Cancel();
    }
    
    public override void OnOrderEvent(OrderEvent orderEvent)
    {
        if (_ticket != null 
            && orderEvent.OrderId == _ticket.OrderId 
            && orderEvent.Status == OrderStatus.Canceled)
        {
            // Place a new order
            var quantity = _ticket.Quantity - _ticket.QuantityFilled;
            var limitPrice = Securities[_ticket.Symbol].Price + 1;
            _ticket = LimitOrder(_ticket.Symbol, quantity, limitPrice);
        }
    }
    def OnData(self, slice: Slice) -> None:
        # Cancel the order
        self.ticket.Cancel()
    
    def OnOrderEvent(self, orderEvent: OrderEvent) -> None:
        if self.ticket is not None \
            and orderEvent.OrderId == self.ticket.OrderId \
            and orderEvent.Status == OrderStatus.Canceled:
            # Place a new order
            quantity = self.ticket.Quantity - self.ticket.QuantityFilled
            limit_price = self.Securities[self.ticket.Symbol].Price + 1
            self.ticket = self.LimitOrder(self.ticket.Symbol, quantity, limit_price)

    Cancel Orders

    To cancel an order, call the Cancel method on the OrderTicket . The method returns an OrderResponse object to signal the success or failure of the cancel request.

    // Create an order and save its ticket
    var ticket = LimitOrder("SPY", 100, 221.05, tag: "SPY Trade to Cancel");
    
    // Cancel the order
    var response = ticket.Cancel("Canceled SPY trade");
    
    // Use the order response object to read the status
    if (response.IsSuccess)
    {
        Debug("Order successfully canceled");
    }
     # Create an order and save its ticket
    ticket = self.LimitOrder("SPY", 100, 221.05, False, "SPY Trade to Cancel")
    
    # Cancel the order
    response = ticket.Cancel("Canceled SPY Trade")
    
    # Use the order response object to read the status
    if response.IsSuccess:
        self.Debug("Order successfully canceled")

    You can't cancel market orders because they are immediately transmitted to the brokerage. You also can't cancel any orders during warm up and initialization .

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Order Response

    When you update or cancel an order, LEAN returns an OrderReponse object, which have the following attributes:

    If your order changes fail, check the ErrorCode or ErrorMessage . For more information about specific order errors, see the Order Response Error Reference .

    To get most recent order response, call the GetMostRecentOrderResponse method.

    var response = ticket.GetMostRecentOrderResponse();
    response = ticket.GetMostRecentOrderResponse()

    Examples

    Demonstration Algorithms
    OrderTicketDemoAlgorithm.py Python OrderTicketDemoAlgorithm.cs C#

     

    10.2.2 Transaction Manager

    Introduction

    The algorithm transactions manager ( SecurityTransactionManager ) contains a collection of helper methods to quickly access all your orders. To access the transaction manager, use the Transactions property of your algorithm. If you save a reference to your order tickets , you shouldn't need to use the transaction manager. LEAN updates the order tickets as the brokerage processes your orders.

    Get a Single Order Ticket

    If you didn't save a reference to the order ticket when you created an order, you can call the GetOrderTicket method to get it. You need to pass the order ID to the method. If you don't have the order ID, you can use the LastOrderID property to get the order ID of the most recent order.

    var orderId = Transactions.LastOrderID;
    var ticket = Transactions.GetOrderTicket(orderId);
    order_id = self.Transactions.LastOrderID
    ticket = self.Transactions.GetOrderTicket(order_id)

    Get Order Tickets

    To get order tickets, call the GetOrderTickets or GetOpenOrderTickets method. You can pass in a filter function to filter all of the order tickets or pass a Symbol to get the order tickets for a specific asset.

    // Get all order tickets
    var orderTickets = Transactions.GetOrderTickets();
    
    // Get order tickets that pass a filter
    var filteredOrderTickets = Transactions.GetOrderTickets(orderTicket => orderTicket.Symbol == symbol);
    
    // Get all open order tickets
    var openOrderTickets = Transactions.GetOpenOrderTickets();
    
    // Get all open order tickets for a symbol
    var symbolOpenOrderTickets = Transactions.GetOpenOrderTickets(symbol);
    
    // Get open order tickets that pass a filter
    var filteredOpenOrderTickets = Transactions.GetOpenOrderTickets(orderTicket => orderTicket.Quantity > 10);
    
    # Get all order tickets
    order_tickets = self.Transactions.GetOrderTickets()
    
    # Get order tickets that pass a filter
    filtered_order_tickets = self.Transactions.GetOrderTickets(lambda order_ticket: order_ticket.Symbol == symbol)
    
    # Get all open order tickets
    open_order_tickets = self.Transactions.GetOpenOrderTickets()
    
    # Get all open order tickets for a symbol
    symbol_open_order_tickets = self.Transactions.GetOpenOrderTickets(symbol)
    
    # Get open order tickets that pass a filter
    filtered_open_order_tickets = self.Transactions.GetOpenOrderTickets(lambda order_ticket: order_ticket.Quantity > 10)
    

    Get a Single Order

    To get a clone of a specific order, call the GetOrderById method with the order Id. To get the order Id, use the OrderId property of the order ticket or use the LastOrderID property if you want the most recent order.

    var orderId = Transactions.LastOrderID;
    var order = Transactions.GetOrderById(orderId);
    order_id = self.Transactions.LastOrderID
    order = self.Transactions.GetOrderById(order_id)

    Order objects are immutable and changes to the order object will not impact the trade. To make an update to an order you must use Order Tickets . Order objects have the following attributes:

    Get Orders

    To get a list of orders, call the GetOrders , GetOpenOrders , or GetOrdersByBrokerageId method. These method returns a list of Order objects.

    // Get all completed orders
    var completedOrders = Transactions.GetOrders();
    
    // Get all completed orders that pass a filter
    var filteredCompletedOrders = Transactions.GetOrders(x => x.Quantity > 10);
    
    // Get a list of all completed orders for a symbol
    var symbolCompletedOrders = Transactions.GetOrders(x => x.Symbol == symbol);
    
    // Get all open orders
    var openOrders = Transactions.GetOpenOrders();
    
    // Get all open orders that pass a filter
    var filteredOpenOrders = Transactions.GetOpenOrders(x => x.Quantity > 10);
    
    // Get a list of all open orders for a symbol
    var symbolOpenOrders = Transactions.GetOpenOrders(symbol);
    
    // Get all open and completed orders that correspond to an Id that the brokerage assigned in live trading
    var ordersByBrokerageId = Transactions.GetOrdersByBrokerageId(brokerageId);
    # Get all completed orders
    completed_Orders = self.Transactions.GetOrders()
    
    # Get all completed orders that pass a filter
    filtered_completed_orders = self.Transactions.GetOrders(lambda x: x.Quantity > 10)
    
    # Retrieve a list of all completed orders for a symbol
    symbol_completed_orders = self.Transactions.GetOrders(lambda x: x.Symbol == symbol)
    
    # Get all open orders
    open_orders = self.Transactions.GetOpenOrders()
    
    # Get all open orders that pass a filter
    filtered_open_orders = self.Transactions.GetOpenOrders(lambda x: x.Quantity > 10)
    
    # Retrieve a list of all open orders for a symbol
    symbol_open_orders = self.Transactions.GetOpenOrders(symbol)
    
    # Get all open and completed orders that correspond to an Id that the brokerage assigned in live trading
    orders_by_brokerage_id = self.Transactions.GetOrdersByBrokerageId(brokerageId)

    Order objects have the following attributes:

    The OrdersCount property gets the current number of orders that have been processed.

    Get Remaining Order Quantity

    To get the unfilled quantity of open orders, call the GetOpenOrdersRemainingQuantity method.

    // Get the quantity of all open orders
    var allOpenQuantity = Transactions.GetOpenOrdersRemainingQuantity();
    
    // Get the quantity of open orders that pass a filter
    var filteredOpenQuantity = Transactions.GetOpenOrdersRemainingQuantity(
        orderTicket => orderTicket.Quantity > 10
    );
    
    // Get the quantity of open orders for a symbol
    var symbolOpenQuantity = Transactions.GetOpenOrdersRemainingQuantity(symbol);
    
    # Get the quantity of all open orders
    all_open_quantity = self.Transactions.GetOpenOrdersRemainingQuantity()
    
    # Get the quantity of open orders that pass a filter
    filtered_open_quantity = self.Transactions.GetOpenOrdersRemainingQuantity(
        lambda order_ticket: order_ticket.Quantity > 10
    )
    
    # Get the quantity of open orders for a symbol
    symbol_open_quantity = self.Transactions.GetOpenOrdersRemainingQuantity(symbol)

    Cancel Orders

    To cancel open orders, call the CancelOpenOrders method. This method returns a list of OrderTicket objects that correspond to the canceled orders.

    // Cancel all open orders
    var allCancelledOrders = Transactions.CancelOpenOrders();
    
    // Cancel orders related to IBM and apply a tag
    var ibmCancelledOrders = Transactions.CancelOpenOrders("IBM", "Hit stop price");
    
     # Cancel all open orders
    all_cancelled_orders = self.Transactions.CancelOpenOrders()
    
    # Cancel orders related to IBM and apply a tag
    ibm_cancelled_orders = self.Transactions.CancelOpenOrders("IBM", "Hit stop price")
    

     

    10.3 Order Types

    You can place any of the following order types that your brokerage supports. Click one to learn more.

    See Also

    Brokerages

     

    10.3.1 Market Orders

    Introduction

    Market orders are instructions to trade a specific number of units, regardless of the fill price. If your highest priority is to fill an order as fast as possible, use market orders. If the order book of the security you're trading has sufficient liquidity when the brokerage receives your order, it immediately fills. However, if there is not enough liquidity by the brokerage, you get partial fills and may incur additional costs from market impact.

    Place Orders

    To send a market order, call the MarketOrder , Buy , or Order method and provide a Symbol and quantity. If you don't have sufficient capital for the order, it's rejected. By default, market orders are synchronous and fill immediately.

    // Buy orders
    MarketOrder("IBM", 100);
    Buy("AAPL", 10);
    Order("SPY", 20);
    
    // Sell orders
    MarketOrder("AMZN", -15);
    Sell("TSLA", 25);
    Order("SPY", -20);
    
    # Buy orders
    self.MarketOrder("IBM", 100)
    self.Buy("AAPL", 10)
    self.Order("SPY", 20)
    
    # Sell orders
    self.MarketOrder("AMZN", -15)
    self.Sell("TSLA", 25)
    self.Order("SPY", -20)
    

    You can also provide a tag and order properties to the Order and MarketOrder methods.

    MarketOrder(symbol, quantity, tag: tag, orderProperties: orderProperties);
    self.MarketOrder(symbol, quantity, tag=tag, orderProperties=order_properties)

    If you place a market order during pre-market or post-market hours, LEAN converts your order to market on open order. To override this behavior, create a custom fill model . To be notified when the default fill model allows you to submit market orders outside of regular trading hours, subscribe to GitHub Issue #3947 .

    Monitor Order Fills

    If the brokerage has sufficient liquidity in their order book, market orders fill immediately. Otherwise, you get partial fills. To monitor the fills of your order, save a reference to the order ticket .

    var ticket = MarketOrder("XLK", 10);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    ticket = self.MarketOrder("XLK", 10)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Synchronous Timeouts

    Market orders are synchronous by default, so your algorithm waits for the order to fill before moving to the next line of code. If your order takes longer than five seconds to fill, your algorithm continues executing even if the trade isn't filled. To adjust the timeout period, set the Transactions.MarketOrderFillTimeout property.

    // Adjust the market fill-timeout to 30 seconds.
    Transactions.MarketOrderFillTimeout = TimeSpan.FromSeconds(30);
    
     # Adjust the market fill-timeout to 30 seconds.
    self.Transactions.MarketOrderFillTimeout = timedelta(seconds=30)

    Place Asynchronous Orders

    When you trade a large portfolio of assets, you may want to send orders in batches and not wait for the response of each one. To send asynchronous orders, set the asynchronous argument to true.

    MarketOrder("IBM", 100, asynchronous: true);
    
    self.MarketOrder("IBM", 100, True)
    

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with market orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for market orders, see the Orders section of the brokerage model documentation .

    Requirements

    Market orders must be submitted during market hours for all security types.

    If your algorithm place market orders at or after the last minute of regular market hours, they will be converted into market-on-open orders and will have to observe their for the following asset types:

    1. Equities
    2. Equity Options
    3. Forex
    4. CFDs
    5. Index Options

    Market orders for Futures and Future Options can be submitted during extended market hours, or they will be invalid.

    Example

    The following backtest verifies the MarketOrder behavior. The algorithm buys SPY on the first day and liquidates the position on the second day. The following table shows the first two trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2021-07-01T09:31:00Z SPY 429.11 10 Market Filled 4291.10
    2021-07-02T09:31:00Z SPY 431.54 -10 Market Filled -4315.40

    On July 1, 2021, the algorithm buys SPY at $429.11. The fill model fills this order at the ask close price.

    On July 2, 2021, the algorithm sells the SPY holdings at $431.54. The fill model fills this order at the bid close price.

    To reproduce these results, backtest the following algorithm:

     

    10.3.2 Limit Orders

    Introduction

    Limit orders are instructions to trade a quantity of an asset at a specific price or a better price. A marketable limit order has a limit price that crosses the spread. An unmarketable limit order has a limit price that doesn't cross the spread. For example, if an asset has an ask price of $100 and you place a limit order to buy at $100 or higher, that's a marketable limit order that should immediately fill. If you place a limit order to buy at $99.99 or lower, that's an unmarketable limit order that should go on the order book. Unmarketable limit orders save you from paying spread costs. Some brokerages even charge you a lower transaction fee if you use unmarketable limit orders rather than marketable limit orders.

    Limit orders are helpful in illiquid markets. You can use them to get a good entry price or to set a take-profit level on an existing holding. However, if the market trades away from your limit price, you may have to adjust your limit price or wait for the market to trade back to your limit price to fill the order.

    Place Orders

    To send a limit order, call the LimitOrder method with a Symbol , quantity, and limit price. You can also provide a tag and order properties to the LimitOrder method. If you do not have sufficient capital for the order, it's rejected.

    LimitOrder(symbol, quantity, limitPrice, tag, orderProperties);
    self.LimitOrder(symbol, quantity, limitPrice, tag, orderProperties)

    To buy an asset with a marketable limit order, set the limit price to the current ask price or higher.

    To sell an asset with a marketable limit order, set the limit price to the current bid price or lower.

    To buy an asset with an unmarketable limit order, set the limit price below the current ask price.

    // Buy 1 Bitcoin when the price drops to $34,000
    LimitOrder("BTCUSD", 1, 34000);
    # Buy 1 Bitcoin when the price drops to $34,000
    self.LimitOrder("BTCUSD", 1, 34000)
    When the asset currently trades at 55,000, the limit price is set at 34,000. The limit order is filled when the price drops to 34,000.

    To sell an asset with an unmarketable limit order, set the limit price above the current bid price.

    // Sell 1 Bitcoin when the price moves up to $60,000
    LimitOrder("BTCUSD", -1, 60000);
    # Sell 1 Bitcoin when the price moves up to $60,000
    self.LimitOrder("BTCUSD", -1, 60000)
    When the asset currently trades at 45,000, the limit price is set at 60,000. The limit order is filled when the price move up to 60,000.

    Monitor Order Fills

    Limit orders fill when the security price passes the limit price. To monitor the fills of your order, save a reference to the order ticket .

    // Buy 10 shares of XLK at $140
    var ticket = LimitOrder("XLK", 10, 140); Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # Buy 10 shares of XLK at $140
    ticket = self.LimitOrder("XLK", 10, 140)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, limit price, and tag of limit orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var ticket = LimitOrder("SPY", 100, 221.05m, tag: "original tag");
    
    // Update the order
    var response = ticket.Update(new UpdateOrderFields() 
    {
        Quantity = 80,
        LimitPrice = 222.00m,
        Tag = "new tag"
    });
    
    // Check if the update was successful
    if (response.IsSuccess) 
    {
        Debug("Order updated successfully");
    }
    # Create a new order and save the order ticket
    ticket = self.LimitOrder("SPY", 100, 221.05, tag="original tag")
    
    # Update the order
    update_settings = UpdateOrderFields()
    update_settings.Quantity = 80
    update_settings.LimitPrice = 222.00
    update_settings.Tag = "new tag"
    response = ticket.Update(update_settings)
    
    # Check if the update was successful
    if response.IsSuccess:
        self.Debug("Order updated successfully")

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a limit order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with limit orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for limit orders, see the Orders section of the brokerage model documentation .

    Requirements

    Limit orders can be submitted at any time for all security types.

    If your algorithm subscribes to extended market hours, they can be filled outside regular trading hours.

    Example

    The following backtest verifies the LimitOrder behavior. On the first day, the algorithm buys SPY with an unmarketable limit order. On the second day, the algorithm sells SPY with an unmarketable limit order and places another unmarketable limit order to buy SPY, which doesn't fill. The following table shows the first three trades in the backtest:

    Submitted Time Filled Time Symbol Limit Price Filled Price Quantity Type Status Value Tag
    2021-07-01T09:31:00Z 2021-07-01T09:32:00Z SPY 429.00 429.00 10 Limit Filled 4290.00 Limit Price: ¤429.00
    2021-07-02T09:31:00Z 2021-07-02T09:35:00Z SPY 431.70 431.70 -10 Limit Filled -4317.00 Limit Price: ¤431.70
    2021-07-02T09:31:00Z / SPY 400.00 / 10 Limit Submitted / Limit Price: ¤400.00

    On July 1, 2021 at 9:31 AM Eastern Time (ET), the algorithm places a buy limit order with a limit price of $429 when the ask low price is $428.81 and the ask high price is $429.15. The order fills at 9:32 AM ET at a price of $429. The fill model fills buy limit orders when the ask low price is less than the limit price. It sets the fill price of the order to the minimum of ask high price and the limit price.

    On July 2, 2021 at 9:31 AM ET, the algorithm places a sell limit order at $431.70 and a buy limit order at $400. At the time of the order, the bid high price is $431.65, the bid low price is $431.49, and the ask low price is $431.50. The sell limit order fills at 9:35 AM ET at a price of $431.70 and the buy limit order doesn't fill. The fill model fills sell limit order when the bid high price is greater than the limit price. It sets the fill price of the order to the maximum of the bid low price and the limit price. The buy limit order doesn't fill because the ask low price is above the limit price for the remainder of the backtest period.

    To reproduce these results, backtest the following algorithm:

     

    10.3.3 Limit if Touched Orders

    Introduction

    Limit if touched (LIT) orders are instructions to place a limit order once an asset touches a specific price level. A buy LIT order has a trigger price below the current market price and a sell LIT order has a trigger price above the current market price. In effect, LIT orders are the opposite of stop limit orders .

    Place Orders

    To send a LIT order, call the LimitIfTouchedOrder method and provide a Symbol , quantity, trigger price, and limit price. You can also provide a tag and order properties to the LimitIfTouchedOrder method. If you do not have sufficient capital for the order, it's rejected.

    LimitIfTouchedOrder(symbol, quantity, triggerPrice, limitPrice, tag, orderProperties);
    self.LimitIfTouchedOrder(symbol, quantity, trigger_price, limit_price, tag, order_properties)

    To buy an asset with a LIT order that has a marketable limit price, set the trigger price below the current market price and set the limit price above the trigger price.

    // Once Bitcoin trades down to $36,000, place a limit order to buy 1 Bitcoin at $38,000
    LimitIfTouchedOrder("BTCUSD", 1, 33000, 36000);
    
    # Once Bitcoin trades down to $36,000, place a limit order to buy 1 Bitcoin at $38,000
    self.LimitIfTouchedOrder("BTCUSD", 1, 33000, 36000)
    When the market price is at $55,000, a marketable buy limit if touched order is set with a trigger price at $33,000 and a limit price at $36,000. The trigger is hit, the limit is set, and the LIT order is filled when the price break below the trigger price.

    To sell an asset with a LIT order that has a marketable limit price, set the trigger price above the current market price and set the limit price below the trigger price.

    // Once Bitcoin trades up to $62,000, place a limit order to sell 1 Bitcoin at $59,000
    LimitIfTouchedOrder("BTCUSD", -1, 62000, 59000);
    # Once Bitcoin trades up to $62,000, place a limit order to sell 1 Bitcoin at $59,000
    self.LimitIfTouchedOrder("BTCUSD", -1, 62000, 59000)
    When the asset is trading at $47,000, place a marketable sell limit-if-touched order with a trigger price at $62,000 and a limit price at $59,000. The trigger is hit, the limit is set, and the limit-if-touched order fills when the asset trades up to $62,000.

    To buy an asset with a LIT order that has an unmarketable limit price, set the trigger price below the current market price and set the limit price below the trigger price.

    // Once Bitcoin trades down to $46,000, place a limit order to buy 1 Bitcoin at $36,000
    LimitIfTouchedOrder("BTCUSD", 1, 46000, 36000);
    # Once Bitcoin trades down to $46,000, place a limit order to buy 1 Bitcoin at $36,000
    self.LimitIfTouchedOrder("BTCUSD", 1, 46000, 36000)
    When the market price is at $56,000, set an unmarketable buy limit if touched order with a trigger price at $46,000 and a limit price at $36,000. The trigger is hit and the the limit is set when the asset trades down to $46,000. Then the limit-if-touched order fills when the asset trades down to $36,000.

    To sell an asset with a LIT order that has an unmarketable limit price, set the trigger price above the current market price and set the limit price above the trigger price.

    // Once Bitcoin trades up to $54,000, place a limit order to sell 1 Bitcoin at $62,000
    LimitIfTouchedOrder("BTCUSD", -1, 54000, 62000);
    # Once Bitcoin trades up to $54,000, place a limit order to sell 1 Bitcoin at $62,000
    self.LimitIfTouchedOrder("BTCUSD", -1, 54000, 62000)
    When the market price is at $42,000, set a marketable sell limit if touched order with a trigger price at $54,000 and a limit price at $62,000. The trigger is hit and the the limit is set when the asset trades up to $54,000. The limit-if-touched order fills when the asset trades up to $62,000.

    Monitor Order Fills

    LIT orders fill when the security price touches the trigger price and is at least as favorable as the limit price. To monitor the fills of your order, save a reference to the order ticket .

    // Once SPY trades down to $425, place a limit order to buy 10 shares at $415
    var ticket = LimitIfTouchedOrder("SPY", 10, 425, 415);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # Once SPY trades down to $425, place a limit order to buy 10 shares at $415
    ticket = self.LimitIfTouchedOrder("SPY", 10, 425, 415)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, trigger price, limit price, and tag of LIT orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var ticket = LimitIfTouchedOrder("SPY", 100, 350, 340, tag: "Original tag");
    
    // Update the order
    var updateOrderFields = new UpdateOrderFields()
    {
        Quantity = 80,
        TriggerPrice = 380,
        LimitPrice = 370,
        Tag = "New tag"
    }
    var response = ticket.Update(updateOrderFields);
    
    // Check the OrderResponse
    if (response.IsSuccess)
    { 
        Debug("Order updated successfully");
    }
    # Create a new order and save the order ticket
    ticket = self.LimitIfTouchedOrder("SPY", 100, 350, 340, tag="Original tag")
    
    # Update the order
    update_order_fields = UpdateOrderFields()
    update_order_fields.Quantity = 80
    update_order_fields.TriggerPrice = 380
    update_order_fields.LimitPrice = 370
    update_order_fields.Tag = "New tag"
    response = ticket.Update(update_settings)
    
    # Check the OrderResponse
    if response.IsSuccess:
        self.Debug("Order updated successfully")

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var triggerResponse = ticket.UpdateTriggerPrice(triggerPrice, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTriggerPrice(triggerPrice, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a LIT order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with LIT orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for LIT orders, see the Orders section of the brokerage model documentation .

    Requirements

    LIT orders can be submitted at any time for all security types.

    If your algorithm subscribes to extended market hours, they can be filled outside regular trading hours.

    Example

    The following backtest verifies the LimitIfTouchedOrder behavior. The following table shows the trades in the backtest:

    Submitted Time Filled Time Symbol Trigger Price Limit Price Filled Price Quantity Type Status Value Tag
    2021-07-01T09:31:00Z 2021-07-01T09:38:00Z SPY 429.00 428.95 428.95 10 Limit if touched Filled 4285.00 Trigger Price: ¤429.00
    Limit Price: ¤428.95
    2021-07-02T09:31:00Z 2021-07-02T09:49:00Z SPY 431.70 431.75 431.84 -10 Limit if touched Filled -4318.40 Trigger Price: ¤431.70
    Limit Price: ¤431.75
    2021-07-02T09:31:00Z / SPY 431.70 400.00 / 10 Limit if touched Submitted / Trigger Price: ¤431.70
    Limit Price: ¤400.00
    / / SPY 400.00 400.00 / 10 Limit if touched Submitted / Trigger Price: ¤400.00
    Limit Price: ¤400.00

    On July 1, 2021 at 9:31 AM Eastern Time (ET), the algorithm places a LIT order to buy SPY with a trigger price of $429 and a limit price of $428.95. At the time of the order submission, the low price was $428.80 and the bid close price was $429.10. The order fills at 9:38 AM ET at a price of $428.95. The fill model sets the limit price for buy orders when the low price is less than or equal to the trigger price, fills the order when the bid close price is less than or equal to the limit price, and sets the fill price to the minimum of the ask price and the limit price.

    On July 2, 2021 at 9:31 AM ET, the algorithm places a LIT order to sell SPY with a trigger price of $431.70 and a limit price of $431.75. At the time of the order submission, the high price was $431.78 and the ask close price was $431.55. The order fills at 9:49 AM ET at a price of $431.84. The fill model sets the limit price for sell orders when the high price is greater than or equal to the trigger price, fills the order when the ask close price is greater than or equal to the limit price, and sets the fill price to the maximum of the bid price and the limit price.

    On July 2, 2021, the algorithm places a third LIT order to buy SPY with a trigger price of $431.70 and a limit price of $400. The fill model sets the fill price, but it doesn't fill the order because the limit price is too low. On the same day, the algorithm places a fourth LIT order to buy SPY with a trigger price of $400 and a limit price of $400. The fill model doesn't set the limit price for this order because SPY doesn't touch the trigger price before the backtest ends.

    To reproduce these results, backtest the following algorithm:

     

    10.3.4 Stop Market Orders

    Introduction

    Stop market orders fill as a market order when the asset reaches a specific price. A buy stop market order triggers when the asset price is greater than or equal to the stop price. A sell stop market order triggers when the asset price is less than or equal to the stop price. You can use stop market orders to buy breakouts or to mitigate the risk of large losses. However, if the market gaps past your stop price, the order may fill at a worse price than the stop price you set. There is no guarantee that a stop market order fills at the stop price.

    Place Orders

    To send a stop market order, call the StopMarketOrder method and provide a Symbol , quantity, and stop price. You can also provide a tag and order properties to the StopMarketOrder method. If you do not have sufficient capital for the order, it is rejected.

    StopMarketOrder(symbol, quantity, stopPrice, tag, orderProperties);
    self.StopMarketOrder(symbol, quantity, stopPrice, tag, orderProperties)

    To buy an asset with a stop market order, set the stop price above the current ask price.

    // When Bitcoin trades up to $60,000, buy 1 Bitcoin
    StopMarketOrder("BTCUSD", 1, 60000);
    # When Bitcoin trades up to $60,000, buy 1 Bitcoin
    self.StopMarketOrder("BTCUSD", 1, 60000)
    When the asset currently trades at $45,000, the stop price of the buy stop market order is set at $60,000. The order fills when the price trades up to $60,000.

    To sell an asset with a stop market order, set the stop price below the current bid price.

    // When Bitcoin trades down to $43,000, sell 1 Bitcoin
    StopMarketOrder("BTCUSD", -1, 43000);
    # When Bitcoin trades down to $43,000, sell 1 Bitcoin
    self.StopMarketOrder("BTCUSD", -1, 43000)
    When the asset currently trades at $56,000, the stop price of the sell stop market order is set at $43,000. The order fills when the price trades down to $43,000.

    Monitor Order Fills

    Stop market orders fill as a market order when the security price passes the stop price. To monitor the fills of your order, save a reference to the order ticket .

    // When XLK trades down to $130, sell 10 shares
    var ticket = StopMarketOrder("XLK", -10, 130);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # When XLK trades down to $130, sell 10 shares
    ticket = self.StopMarketOrder("XLK", -10, 130)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, stop price, and tag of stop market orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var ticket = StopMarketOrder("SPY", -100, 415, tag: "original tag");
    
    // Update the order
    var response = ticket.Update(new UpdateOrderFields() { 
      Quantity = -80,
      StopPrice = 400,
      Tag = "new tag"
    });
    
    // Check if the update was successful
    if (response.IsSuccess) { 
         Debug("Order updated successfully");
    }
    
    # Create a new order and save the order ticket
    ticket = self.StopMarketOrder("SPY", -100, 415, tag="original tag")
    
    # Update the order
    update_settings = UpdateOrderFields()
    update_settings.Quantity = -80
    update_settings.StopPrice = 400
    update_settings.Tag = "new tag"
    response = ticket.Update(update_settings)
    
    # Check if the update was successful
    if response.IsSuccess:
         self.Debug("Order updated successfully")
    

    To update individual fields of an order, call any of the following methods:

    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var stopResponse = ticket.UpdateStopPrice(stopPrice, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateStopPrice(stopPrice, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a stop market order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with stop market orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for stop market orders, see the Orders section of the brokerage model documentation .

    Requirements

    Stop market orders can be submitted at any time for all security types.

    Example

    The following backtest verifies the StopMarketOrder behavior. On even days, the algorithm buys SPY at the current market price and sells when the price drops 1%. On odd days, the algorithm shorts SPY and buys when the price rises 1%. The following table shows the first four trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2021-07-01T13:31:00Z SPY 429.10 -1 Market Filled -429.10
    2021-07-01T13:31:00Z SPY 433.44 1 Stop Market Filled 433.44 Stop Price: 433.43
    2021-07-02T17:04:00Z SPY 433.44 1 Market Filled 433.44
    2021-07-02T17:04:00Z SPY 429.00 -1 Stop Market Filled -429.00 Stop Price: 429.10

    On July 1, 2021, the algorithm shorts SPY at $429.10 and then buys it back at $433.44 when the stop price is $433.43. The stop price is 1% above the market price. Note that $429.10 is not the market price when the algorithm places the first two orders. $429.10 is the fill price at the bid, but it's not far from the market price because 429.1 * 1.01 = 433.39. The fill price of the stop market order is $433.44, which, as expected, is higher than $433.43. The fill model assumes the worst-case scenario between the market price and the stop price. In this case, the worst-case scenario is the maximum of the market price and stop price.

    On July 2, 2021, the algorithm buys SPY at $433.44 and sells it at $429 when the stop price is $429.10. The stop price is 1% below the market price. Note that $433.44 is not the market price when the algorithm places the second two orders. $433.44 is the fill price at the ask, but it's not far off from the market price because 433.44 * 0.99 = 429.11. The fill price of the stop market order is $429, which, as expected, is lower than $429.10. The fill model assumes the worst-case scenario between the market price and the stop price. In this case, the worst-case scenario is the minimum of the market price and stop price.

    To reproduce these results, backtest the following algorithm:

     

    10.3.5 Stop Limit Orders

    Introduction

    Stop limit orders are instructions to place a limit order once an asset passes a specific price level. They are similar to stop market orders , but use limit orders instead of market orders to give you more control over the fill price. A buy stop limit order has a stop price above the current market price and a sell stop limit order has a stop price below the current market price. In effect, they are the opposite of limit if touched orders .

    Place Orders

    To send a stop limit order, call the StopLimitOrder method and provide a Symbol , quantity, stop price, and limit price. You can also provide a tag and order properties to the StopLimitOrder method. If you do not have sufficient capital for the order, it is rejected.

    StopLimitOrder(symbol, quantity, stopPrice, limitPrice, tag, orderProperties);
    self.StopLimitOrder(symbol, quantity, stop_rice, limit_price, tag, order_properties)

    To buy an asset with a stop limit order that has a marketable limit price, set the stop price above the current market price and set the limit price above the stop price.

    // When Bitcoin trades up to $59,000, buy 1 Bitcoin with a limit order at $62,000
    StopLimitOrder("BTCUSD", 1, 59000, 62000);
    # When Bitcoin trades up to $59,000, buy 1 Bitcoin with a limit order at $62,000
    self.StopLimitOrder("BTCUSD", 1, 59000, 62000)
    When the asset is trading at $46,000, place an unmarketable sell stop limit order with a stop at $59,000 and a limit at $62,000. The stop is hit, the limit is set, and the order fills when the asset trades up to $59,000.

    To buy an asset with a stop limit order that has an unmarketable limit price, set the stop price above the current market price and set the limit price below the stop price.

    // When Bitcoin trades up to $52,000, buy 1 Bitcoin with a limit order at $41,000
    StopLimitOrder("BTCUSD", 1, 52000, 41000);
    
    # When Bitcoin trades up to $52,000, buy 1 Bitcoin with a limit order at $41,000
    self.StopLimitOrder("BTCUSD", 1, 52000, 41000)
    When the asset is trading at $37,000, place an unmarketable buy stop limit order with a stop at $52,500 and a limit at $41,000. The stop is hit and the limit is set when the asset trades up to $52,500. Then the stop limit order fills when the security trades down to $41,000.

    To sell an asset with a stop limit order that has an unmarketable limit price, set the stop price below the current market price and set the limit price above the stop price.

    // When Bitcoin trades down to $49,000, sell 1 Bitcoin with a limit order at $58,000
    StopLimitOrder("BTCUSD", -1, 49000, 58000);
    # When Bitcoin trades down to $49,000, sell 1 Bitcoin with a limit order at $58,000
    self.StopLimitOrder("BTCUSD", -1, 49000, 58000)
    When the asset is trading at $57,000, place an unmarketable sell stop limit order with a stop at $49,000 and a limit at $58,000. The stop is hit and the limit is set when the asset trades down to $49,000. Then the stop limit order fills when the security trades up to $58,000.

    To sell an asset with a stop limit order that has a marketable limit price, set the stop price below the current market price and set the limit price below the stop price.

    // When Bitcoin trades down to $37,000, sell 1 Bitcoin with a limit order at $34,000
    StopLimitOrder("BTCUSD", -1, 37000, 34000);
    # When Bitcoin trades down to $37,000, sell 1 Bitcoin with a limit order at $34,000
    self.StopLimitOrder("BTCUSD", -1, 37000, 34000)
    When the asset is trading at $57,000, place a marketable sell stop limit order with a stop at $37,000 and a limit at $34,000. The stop is hit, the limit is set, and the order fills when the asset trades down to $37,000.

    Monitor Order Fills

    Stop limit orders fill as limit orders when the security price passes the stop price. To monitor the fills of your order, save a reference to the order ticket .

    // When GLD trades up to $200, buy 10 shares with a limit order at $205
    var ticket = StopLimitOrder("GLD", 10, 200, 205);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # When GLD trades up to $200, buy 10 shares with a limit order at $205
    ticket = self.StopLimitOrder("GLD", 10, 200, 205)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, stop price, limit price, and tag of stop limit orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request..

    // Create a new order and save the order ticket
    var ticket = StopLimitOrder("SPY", -10, 400, 390, tag: "original tag");
    
    // Update the order
    var response = ticket.Update(new UpdateOrderFields() { 
      Quantity = -15,
      StopPrice = 415,
      LimitPrice = 395,
      Tag = "new tag"
    });
    
    // Check if the update was successful
    if (response.IsSuccess) { 
         Debug("Order updated successfully");
    }
    
    # Create a new order and save the order ticket
    ticket = self.StopLimitOrder("SPY", -10, 400, 390, tag="original tag")
    
    # Update the order
    update_settings = UpdateOrderFields()
    update_settings.Quantity = -15
    update_settings.StopPrice = 415
    update_settings.LimitPrice = 395
    update_settings.Tag = "new tag"
    response = ticket.Update(update_settings)
    
    # Check if the update was successful
    if response.IsSuccess:
         self.Debug("Order updated successfully")
    

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var stopResponse = ticket.UpdateStopPrice(stopPrice, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateStopPrice(stopPrice, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with stop limit orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for stop limit orders, see the Orders section of the brokerage model documentation .

    Requirements

    Stop limit orders can be submitted at any time for all security types.

    If your algorithm subscribes to extended market hours, they can be filled outside regular trading hours.

    Example

    The following backtest verifies the StopLimitOrder behavior. The following table shows the trades in the backtest:

    Submitted Time Filled Time Symbol Stop Price Limit Price Filled Price Quantity Type Status Value Tag
    2021-07-01T09:31:00Z 2021-07-01T09:37:00Z SPY 428.95 429.00 429.00 -10 Stop Limit Filled -4290.00 Stop Price: ¤428.95 Limit Price: ¤429.00
    2021-07-02T09:31:00Z 2021-07-02T10:12:00Z SPY 431.80 431.75 431.75 10 Stop Limit Filled 4317.50 Stop Price: ¤431.80 Limit Price: ¤431.75

    On July 1, 2021 at 9:31 AM Eastern Time (ET), the algorithm places a stop limit order to sell SPY with a stop price of $428.95 and a limit price of $429. At the time of the order submission, the ask high price is $429.16 and the ask close price is $429.11. The order fills at 9:37 AM ET at a price of $429. The fill model triggers the stop for buy orders when the ask high price is greater than the stop price, fills the order when the ask close price is less than the limit price, and sets the fill price to the maximum of the ask high price and the limit price.

    On July 2, 2021 at 9:31 AM ET, the algorithm places a stop limit order to buy SPY with a stop price of $431.80 and a limit price of $431.75. At the time of the order submissions, the bid low price is $431.49 and the bid close price is $431.54. The order fills at 10:12 AM ET at a price of $431.75. The fill model triggers the stop for sell orders when bid low price is less than the stop price, fills the order when the ask close price is less than the limit price, and sets the fill price to the minimum of the ask high price and the limit price.

    To reproduce these results, backtest the following algorithm:

     

    10.3.6 Market On Open Orders

    Introduction

    Market on open (MOO) orders fill at the official opening auction price for a security. Market that operate 24/7 don't support MOO orders.

    Place Orders

    To send a MOO order, call the MarketOnOpenOrder method and provide a Symbol and quantity. Submit the order at least two minutes before the market opens to be included in the opening auction. If you do not have sufficient capital for the order, it's rejected.

    // Buy 100 shares of IBM at the market open
    MarketOnOpenOrder("IBM", 100);
    
    // Sell 100 shares of IBM at the market open
    MarketOnOpenOrder("IBM", -100);
    # Buy 100 shares of IBM at the market open
    self.MarketOnOpenOrder("IBM", 100)
    
    # Sell 100 shares of IBM at the market open
    self.MarketOnOpenOrder("IBM", -100)

    You can provide a tag and order properties to the MarketOnOpenOrder method.

    MarketOnOpenOrder(symbol, quantity, tag: tag, orderProperties: orderProperties);
    self.MarketOnOpenOrder(symbol, quantity, tag=tag, orderProperties=order_properties)

    Monitor Order Fills

    MOO orders fill at the opening auction. If the auction is heavily skewed to one side of the market, your MOO order may not fill. To monitor the fills of your order, save a reference to the order ticket .

    // Buy 10 shares of SPY at the market open
    var ticket = MarketOnOpenOrder("SPY", 10);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # Buy 10 shares of SPY at the market open
    ticket = self.MarketOnOpenOrder("SPY", 10)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    You won't know the fill price of the order until after the market opens. If the asset price moves before the market open to where you can't afford the quantity of the order, the brokerage rejects your order. To increase the probability of a successful trade, leave a sufficient buying power buffer to handle daily price gaps.

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity and tag of MOO orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var ticket = MarketOnOpenOrder("AAPL", 100, "original tag");
    
    // Update the order
    var response = ticket.Update(new UpdateOrderFields()
    {
        Quantity = 75,
        Tag = "new tag"
    });
    
    // Check if the update was successful
    if (response.IsSuccess)
    { 
        Debug("Order updated successfully");
    }
    # Create a new order and save the order ticket
    ticket = self.MarketOnOpenOrder("AAPL", 100, "original tag")
    
    # Update the order
    update_settings = UpdateOrderFields()
    update_settings.Quantity = 75
    update_settings.Tag = "new tag"
    response = ticket.Update(update_settings)
    
    # Check if the update was successful
    if response.IsSuccess:
        self.Debug("Order updated successfully")
    

    To update individual fields of an order, call any of the following methods:

    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a MOO order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with MOO orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for MOO orders, see the Orders section of the brokerage model documentation .

    Requirements

    You can submit MOO orders at any time for Equity, Equity Options, and Index Options.

    Markets that operate 24/7 don't support MOO orders. The Forex market doesn't operate during the weekend. However, MOO orders are invalid if you place them after this market closes for the weekend.

    MOO orders don't support the GoodTilDate time in force . If you submit a MOO order with the GoodTilDate time in force, LEAN automatically adjusts the time in force to be GoodTilCanceled .

    Example

    The following backtest verifies the MarketOnOpenOrder behavior. The following table shows the first trade in the backtest:

    Submitted Time Filled Time Symbol Price Quantity Type Status Value Tag
    2021-07-01T10:31:00Z 2021-07-02T09:31:00Z SPY 431.67 10 Market On Open Filled 4316.70

    On July 1, 2021 at 10:31 AM Eastern Time (ET), the algorithm places a market on open order to buy SPY. The fill model fills the order on July 2, 2021 at 9:31 AM at a price of $431.67, which is the official opening auction price for July 2, 2021.

    To reproduce these results, backtest the following algorithm:

     

    10.3.7 Market On Close Orders

    Introduction

    Market on close (MOC) orders fill at the official closing auction price for a security. Markets that operate 24/7 don't support MOC orders.

    Place Orders

    To send a MOC order, call the MarketOnCloseOrder method with a Symbol and quantity. If you don't have sufficient capital for the order, it is rejected.

    // Buy 100 shares of AAPL at the market open
    MarketOnCloseOrder("AAPL", 100);
    
    // Sell 100 shares of AAPL at the market open
    MarketOnCloseOrder("AAPL", -100);
    # Buy 100 shares of AAPL at the market open
    self.MarketOnCloseOrder("AAPL", 100)
    
    # Sell 100 shares of AAPL at the market open
    self.MarketOnCloseOrder("AAPL", -100)

    You can provide a tag and order properties to the MarketOnCloseOrder method.

    MarketOnCloseOrder(symbol, quantity, tag: tag, orderProperties: orderProperties);
    self.MarketOnCloseOrder(symbol, quantity, tag=tag, orderProperties=order_properties)

    By default, you must place MOC orders at least 15.5 minutes before the close, but some exchanges let you submit them closer to the market closing time. To adjust the buffer period that's required, set the MarketOnCloseOrder.SubmissionTimeBuffer property.

    Orders.MarketOnCloseOrder.SubmissionTimeBuffer = TimeSpan.FromMinutes(10);
    MarketOnCloseOrder.SubmissionTimeBuffer = timedelta(minutes=10)

    You can also place MOC orders after the market close.

    Monitor Order Fills

    MOC orders fill at the closing auction. If the auction is heavily skewed to one side of the market, your MOC order may not fill. To monitor the fills of your order, save a reference to the order ticket .

    // Buy 10 shares of SPY at the market close
    var ticket = MarketOnCloseOrder("SPY", 10);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    # Buy 10 shares of SPY at the market close
    ticket = self.MarketOnCloseOrder("SPY", 10)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    You won't know the fill price of the order until after the market closes. If the asset price moves before the market close to where you can't afford the quantity of the order, the brokerage rejects your order. To increase the probability of a successful trade, leave a sufficient buying power buffer to handle the price movements before the close.

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity and tag of MOC orders until the order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var ticket = MarketOnCloseOrder("SLV", 25, "original tag");
    
    // Update the order
    var response = ticket.Update(new UpdateOrderFields()
    {
        Quantity = 50,
        Tag = "new tag"
    });
    
    // Check if the update was successful
    if (response.IsSuccess)
    {
        Debug("Order updated successfully");
    }
    # Create a new order and save the order ticket
    ticket = self.MarketOnOpenOrder("SLV", 25, "original tag")
    
    # Update the order
    update_settings = UpdateOrderFields()
    update_settings.Quantity = 50
    update_settings.Tag = "new tag"
    response = ticket.Update(update_settings)
    
    # Check if the update was successful
    if response.IsSuccess:
        self.Debug("Order updated successfully")

    To update individual fields of an order, call any of the following methods:

    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a MOC order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with MOC orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for MOC orders, see the Orders section of the brokerage model documentation .

    Requirements

    By default, you must place MOC orders at least 15.5 minutes before the close, but some exchanges let you submit them closer to the market closing time. To adjust the buffer period that's required, set the MarketOnCloseOrder.SubmissionTimeBuffer property.

    Orders.MarketOnCloseOrder.SubmissionTimeBuffer = TimeSpan.FromMinutes(10);
    MarketOnCloseOrder.SubmissionTimeBuffer = timedelta(minutes=10)

    Markets that operate 24/7 don't support MOC orders. The Forex market doesn't operate during the weekend.

    MOC orders don't support the GoodTilDate time in force . If you submit a MOC order with the GoodTilDate time in force, LEAN automatically adjusts the time in force to be GoodTilCanceled .

    Example

    The following backtest verifies the MarketOnCloseOrder behavior. The following table shows the first trade in the backtest:

    Submitted Time Filled Time Symbol Price Quantity Type Status Value Tag
    2021-07-01T10:31:00Z 2021-07-01T16:00:00Z SPY 430.43 10 Market On Close Filled 4304.30

    On July 1, 2021 at 10:31 AM Eastern Time (ET), the algorithm places a market on open order to buy SPY. The fill model fills the order on July 1, 2021 at 4:00 PM ET at a price of $430.43, which is the official closing auction price for July 1, 2021.

    To reproduce these results, backtest the following algorithm:

     

    10.3.8 Combo Market Orders

    Introduction

    Combo market orders are individual orders that contain market orders for muliple securities. Combo market orders currently only work for trading Option contracts.

    Place Orders

    To send a combo market order, create multiple Leg objects to represent the legs of the combo order, then call the ComboMarketOrder method. At least one leg must have a positive quantity and at least one leg must have a negative quantity. The legs must each target a unique contract. If you don't have sufficient capital for the order, it's rejected. By default, combo market orders are synchronous and fill immediately.

    foreach (var kvp in slice.OptionChains)
    {
        // Select contracts
        var contracts = kvp.Value.Contracts.Values.ToList();
        if (contracts.Count < 2) 
        {
            return;
        }
    
        // Create order legs
        var legs = new List<Leg>()
        {
            Leg.Create(contracts[0].Symbol, 1),
            Leg.Create(contracts[1].Symbol, -1)
        };
    
        // Place order
        ComboMarketOrder(legs, 1);
    }
    for canonical_symbol, chain in slice.OptionChains.items():
        # Select contracts
        contracts = [c for c in chain][:2]
        if len(contracts) < 2:
            return
    
        # Create order legs
        legs = []
        quantities = [1, -1]
        for i, contract in enumerate(contracts):
            legs.append(Leg.Create(contract.Symbol, quantities[i]))
        
        # Place order
        self.ComboMarketOrder(legs, 1)

    The quantity of the legs sets the ratio of the leg orders while the quantity argument of the ComboMarketOrder method sets the combo order size and acts as a global multiplier. In the preceding example, if we set the global multiplier to two, then the algorithm buys two units of the first contract and sells two units of the second contract. The quantity argument of the ComboMarketOrder method also sets the order direction of the combo order, which affects how the fill model fills the order.

    You can also provide a tag and order properties to the ComboMarketOrder method.

    ComboMarketOrder(legs, quantity, tag: tag, orderProperties: orderProperties);
    self.ComboMarketOrder(legs, quantity, tag=tag, orderProperties=order_properties)

    Monitor Order Fills

    If the brokerage has sufficient liquidity in their order book, combo market orders fill immediately. Otherwise, you get partial fills. To monitor the fills of your order, save a reference to the order tickets .

    var tickets = ComboMarketOrder(legs, 1);
    foreach (var ticket in tickets)
    {
        Debug($"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    }
    ticket = self.ComboMarketOrder(legs, 1)
    for ticket in tickets:
        self.Debug(f"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Synchronous Timeouts

    Combo market orders are synchronous by default, so your algorithm waits for the order to fill before moving to the next line of code. If your order takes longer than five seconds to fill, your algorithm continues executing even if the trade isn't filled. To adjust the timeout period, set the Transactions.MarketOrderFillTimeout property.

    // Adjust the market fill-timeout to 30 seconds.
    Transactions.MarketOrderFillTimeout = TimeSpan.FromSeconds(30);
    
     # Adjust the market fill-timeout to 30 seconds.
    self.Transactions.MarketOrderFillTimeout = timedelta(seconds=30)

    Place Asynchronous Orders

    When you trade a large portfolio of assets, you may want to send orders in batches and not wait for the response of each one. To send asynchronous orders, set the asynchronous argument to true.

    ComboMarketOrder(legs, quantity, true);
    self.ComboMarketOrder(legs, quantity, True)

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with combo market orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for combo market orders, see the Orders section of the brokerage model documentation .

    Requirements

    Combo market orders must be submitted during market hours for all security types.

    If your algorithm place combo market orders at or after the last minute of regular market hours, they will be converted into market-on-open orders and will have to observe their for the following asset types:

    1. Equities
    2. Equity Options
    3. Forex
    4. CFDs
    5. Index Options

    Combo market orders for Futures and Future Options can be submitted during extended market hours, or they will be invalid.

    Example

    The following backtest verifies the ComboMarketOrder behavior. The algorithm buys one contract and sells one contract at the same time. The following table shows the two trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2015-12-24T09:31:00Z GOOG 16011SC00745000 16.90 1 Buy Filled 16.90
    2015-12-24T09:31:00Z GOOG 160115C00747500 14.20 -1 Sell Filled -14.20

    On December 24, 2015, the algorithm buys GOOG 16011SC00745000 at $16.90 and sells GOOG 160115C00747500 at $14.20. The fill model fills the buy order at the ask close price and fills the sell order at the bid close price.

    To reproduce these results, backtest the following algorithm:

     

    10.3.9 Combo Limit Orders

    Introduction

    Combo limit orders are individual orders that contain limit orders for muliple securities. Combo limit orders are different from combo leg limit orders because you must set the limit price of all the leg orders to be the same with combo limit orders. With combo leg limit orders, you can create the order without forcing each leg to have the same limit price. Combo limit orders currently only work for trading Option contracts and their underlying Equities.

    Place Orders

    To send a combo limit order, create multiple Leg objects to represent the legs of the combo order, then call the ComboLimitOrder method. At least one leg must have a positive quantity and a tleast one leg must have a negative quantity. The legs must each target a unique contract, but don't set the OrderPrice property for any of the legs. If you don't have sufficient capital for the order, it's rejected.

    foreach (var kvp in slice.OptionChains)
    {
        // Select contracts
        var contracts = kvp.Value.Contracts.Values.ToList();
        if (contracts.Count < 2) 
        {
            return;
        }
    
        // Create order legs
        var legs = new List&lgt;Leg>()
        {
            Leg.Create(contracts[0].Symbol, 1),
            Leg.Create(contracts[1].Symbol, -1)
        };
    
        // Calculate limit price
        var limitPrice = Math.Round(legs.Select(leg => Securities[leg.Symbol].Close).Sum() * 0.95m, 2);
    
        // Place order
        ComboLimitOrder(legs, quantity: 1, limitPrice: limitPrice);
    }
    for canonical_symbol, chain in slice.OptionChains.items():
        # Select contracts
        contracts = [c for c in chain][:2]
        if len(contracts) < 2:
            return
    
        # Create order legs
        legs = []
        quantities = [1, -1]
        for i, contract in enumerate(contracts):
            legs.append(Leg.Create(contract.Symbol, quantities[i]))
        
        # Calculate limit price
        limit_price = round(sum([self.Securities[leg.Symbol].Close for leg in legs]) * 0.95, 2)
    
        # Place order
        self.ComboLimitOrder(legs, 1, limit_price)

    The quantity of the legs sets the ratio of the leg orders while the quantity argument of the ComboLimitOrder method sets the combo order size and acts as a global multiplier. In the preceding example, if we set the global multiplier to two, then the algorithm buys two units of the first contract and sells two units of the second contract. The quantity also sets the order direction of the combo limit order, which affects how the fill model fills the order.

    You can also provide a tag and order properties to the ComboLimitOrder method.

    ComboLimitOrder(legs, quantity, limitPrice, tag: tag, orderProperties: orderProperties);
    self.ComboLimitOrder(legs, quantity, limit_price, tag=tag, orderProperties=order_properties)

    Monitor Order Fills

    Combo limit orders fill all the legs at the same time. Each leg can fill when the sum of the security prices of the legs pass the limit price of the combo order. To monitor the fills of your order, save a reference to the order tickets .

    var tickets = ComboLimitOrder(legs, 1, limitPrice);
    foreach (var ticket in tickets)
    {
        Debug($"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    }
    tickets = self.ComboLimitOrder(legs, 1, limit_price)
    for ticket in tickets:
        self.Debug(f"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, limit price, and tag of the limit orders in each leg until the combo order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . To update the limit price of the combo order, you only need to update the limit price of one of the leg orders. The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var tickets = ComboLimitOrder(legs, quantity: 1, limitPrice: limitPrice);
    
    // Update the leg orders
    foreach (var ticket in tickets)
    {
        var response = ticket.Update(new UpdateOrderFields() 
        {
            Quantity = 2 * Math.Sign(ticket.Quantity),
            LimitPrice = ticket.Get(OrderField.LimitPrice) + 0.01m,
            Tag = $"Update #{ticket.UpdateRequests.Count + 1}"
        }); 
    
        // Check if the update was successful
        if (response.IsSuccess) 
        {
            Debug($"Order updated successfully for {ticket.Symbol}");
        }
    }
    # Create a new order and save the order tickets
    tickets = self.ComboLimitOrder(legs, 1, limit_price)
    
    # Update the leg orders
    for ticket in tickets:
        update_settings = UpdateOrderFields()
        update_settings.Quantity = 2 * np.sign(ticket.Quantity)
        update_settings.LimitPrice = ticket.Get(OrderField.LimitPrice) + 0.01
        update_settings.Tag = f"Update #{len(ticket.UpdateRequests) + 1}"
        response = ticket.Update(update_settings)
    
        # Check if the update was successful
        if response.IsSuccess:
            self.Debug(f"Order updated successfully for {ticket.Symbol}")

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a combo limit order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with combo limit orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for combo limit orders, see the Orders section of the brokerage model documentation .

    Requirements

    Combo limit orders can be submitted at any time for all security types.

    If your algorithm subscribes to extended market hours, they can be filled outside regular trading hours.

    Example

    The following backtest verifies the ComboLimitOrder behavior. The algorithm buys one contract and sells one contract at the same time. The following table shows the two trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2015-12-24T09:31:00Z GOOG 16011SC00745000 16.50 1 Buy Filled 16.50
    2015-12-24T09:31:00Z GOOG 160115C00747500 14.60 -1 Sell Filled -14.60

    On December 24, 2015 at 9:31 AM Eastern Time (ET), the algorithm places a combo limit order to buy one GOOG 16011SC00745000 contract and sell one GOOG 160115C00747500 contracts. The limit price is 75% of the contract spread, which equals $2.02. The combo order doesn't fill immediately because the contract spread $2.40 > $2.02. By 9:36 AM, the spread drops to $1.90, which is below the limit price, so the fill model fills the combo limit order.

    To reproduce these results, backtest the following algorithm:

     

    10.3.10 Combo Leg Limit Orders

    Introduction

    Combo leg limit orders are individual orders that contain limit orders for muliple securities. Combo leg limit orders are different from combo limit orders because you can create combo leg limit orders without forcing each leg to have the same limit price. Combo leg limit orders currently only work for trading Option contracts.

    Place Orders

    To send a combo leg limit order, create multiple Leg objects to represent the legs of the combo order, then call the ComboLegLimitOrder method. The legs must each target a unique contract. At least one leg must have a positive quantity and at least one leg must have a negative quantity. If you don't have sufficient capital for the order, it's rejected.

    foreach (var kvp in slice.OptionChains)
    {
        // Select contracts
        var contracts = kvp.Value.Contracts.Values.ToList();
        if (contracts.Count < 2) 
        {
            return;
        }
    
        // Create order legs
        var legs = new List<Leg>()
        {
            Leg.Create(contracts[0].Symbol, 1, contracts[0].LastPrice * 0.98m),
            Leg.Create(contracts[1].Symbol, -1, contracts[1].LastPrice * 1.02m)
        };
    
        // Place order
        ComboLegLimitOrder(legs, 1);
    }
    for canonical_symbol, chain in slice.OptionChains.items():
        # Select contracts
        contracts = [c for c in chain][:2]
        if len(contracts) < 2:
            return
    
        # Create order legs            
        legs = []
        quantities = [1, -1]
        factors = [0.98, 1.02]
        for i, contract in enumerate(contracts):
            legs.append(Leg.Create(contract.Symbol, quantities[i], contract.LastPrice * factors[i]))
        
        # Place order
        self.ComboLegLimitOrder(legs, 1)

    The quantity of the legs sets the ratio of the leg orders while the quantity argument of the ComboLegLimitOrder method sets the combo order size and acts as a global multiplier. In the preceding example, if we set the global multiplier to two, then the algorithm buys two units of the first contract and sells two units of the second contract. The quantity also sets the order direction of the combo limit order, which affects how the fill model fills the order.

    You can also provide a tag and order properties to the ComboLegLimitOrder method.

    ComboLegLimitOrder(legs, quantity, tag: tag, orderProperties: orderProperties);
    self.ComboLegLimitOrder(legs, quantity, tag=tag, orderProperties=order_properties)

    Monitor Order Fills

    Combo leg limit orders fill all the legs at the same time. Each leg can fill when the security price passes the limit price of the leg. To monitor the fills of your order, save a reference to the order tickets .

    var tickets = ComboLegLimitOrder(legs, 1);
    foreach (var ticket in tickets)
    {
        Debug($"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    }
    tickets = self.ComboLegLimitOrder(legs, 1)
    for ticket in tickets:
        self.Debug(f"Symbol: {ticket.Symbol}; Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models order fills in backtests, see Trade Fills .

    Update Orders

    You can update the quantity, limit price, and tag of the leg limit orders until the combo order fills or the brokerage prevents modifications. To update an order, pass an UpdateOrderFields object to the Update method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Update method returns an OrderResponse to signal the success or failure of the update request.

    // Create a new order and save the order ticket
    var tickets = ComboLegLimitOrder(legs, 1);
    
    // Update the leg orders
    foreach (var ticket in tickets)
    {
        var direction = Math.Sign(ticket.Quantity);
        var response = ticket.Update(new UpdateOrderFields() 
        {
            Quantity = 2 * direction,
            LimitPrice = ticket.Get(OrderField.LimitPrice) + 0.01m * direction,
            Tag = $"Update #{ticket.UpdateRequests.Count + 1}"
        }); 
    
        // Check if the update was successful
        if (response.IsSuccess) 
        {
            Debug($"Order updated successfully for {ticket.Symbol}");
        }
    }
    # Create a new order and save the order tickets
    tickets = self.ComboLegLimitOrder(legs, 1)
    
    # Update the leg orders
    for ticket in tickets:
        direction = np.sign(ticket.Quantity)
        update_settings = UpdateOrderFields()
        update_settings.Quantity = 2 * direction
        update_settings.LimitPrice = ticket.Get(OrderField.LimitPrice) + 0.01 * direction
        update_settings.Tag = f"Update #{len(ticket.UpdateRequests) + 1}"
        response = ticket.Update(update_settings)
    
        # Check if the update was successful
        if response.IsSuccess:
            self.Debug(f"Order updated successfully for {ticket.Symbol}")

    To update individual fields of an order, call any of the following methods:

    var limitResponse = ticket.UpdateLimitPrice(limitPrice, tag);
    
    var quantityResponse = ticket.UpdateQuantity(quantity, tag);
    
    var tagResponse = ticket.UpdateTag(tag);
    
    
    response = ticket.UpdateLimitPrice(limitPrice, tag)
    
    response = ticket.UpdateQuantity(quantity, tag)
    
    response = ticket.UpdateTag(tag)
    
    

    When you update an order, LEAN creates an UpdateOrderRequest object, which have the following attributes:

    To get a list of UpdateOrderRequest objects for an order, call the UpdateRequests method.

    var updateRequests = ticket.UpdateRequests();
    update_requests = ticket.UpdateRequests()

    Cancel Orders

    To cancel a combo leg limit order, call the Cancel method on the OrderTicket . If you don't have the order ticket, get it from the transaction manager . The Cancel method returns an OrderResponse object to signal the success or failure of the cancel request.

    var response = ticket.Cancel("Cancelled trade");
    if (response.IsSuccess)
    {
        Debug("Order successfully cancelled");
    }
    response = ticket.Cancel("Cancelled Trade")
    if response.IsSuccess:
        self.Debug("Order successfully cancelled")

    When you cancel an order, LEAN creates a CancelOrderRequest , which have the following attributes:

    To get the CancelOrderRequest for an order, call the CancelRequest method on the order ticket. The method returns null None if the order hasn't been cancelled.

    var request = ticket.CancelOrderRequest();
    request = ticket.CancelOrderRequest()

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with combo leg limit orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for combo leg limit orders, see the Orders section of the brokerage model documentation .

    Requirements

    Combo leg limit orders can be submitted at any time for all security types.

    If your algorithm subscribes to extended market hours, they can be filled outside regular trading hours.

    Example

    The following backtest verifies the ComboLegLimitOrder behavior. The algorithm buys one contract and sells one contract at the same time. The following table shows the two trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2015-12-24T09:31:00Z GOOG 16011SC00745000 16.10 2 Buy Filled 32.20 Update #72
    2015-12-24T09:31:00Z GOOG 160115C00747500 14.11515 -2 Sell Filled -28.2303 Update #72

    On December 24, 2015 at 9:31 AM Eastern Time (ET), the algorithm places a combo leg limit order to buy one GOOG 16011SC00745000 contract and sell two GOOG 160115C00747500 contracts. The limit price of both orders is 99.9% of the respective contract price, which is $16.2837 for GOOG 16011SC00745000 and $14.83515 for GOOG 160115C00747500. The combo order doesn't fill immediately, so the algorithm updates the leg orders at each time step. During the first update, the algorithm sets the quantity of the GOOG 160115C00747500 leg to -2. During each update, the limit price moves $0.01 closer to the market. That is, the limit price of GOOG 16011SC00745000 increases by $0.01 and the limit price of GOOG 160115C00747500 decreases by $0.01. After the 72nd update, the ask low price is below the limit price of the leg to buy GOOG 16011SC00745000 and the bid high price is above the limit price of the leg to sell GOOG 160115C00747500, so the fill model fills the combo leg limit order at 10:44 AM ET.

    To reproduce these results, backtest the following algorithm:

     

    10.3.11 Option Exercise Orders

    Introduction

    If you buy an Option contract, you can exercise your right to buy or sell the underlying asset at the strike price. However, you don't need to exercise it. You can sell the Option or let it expire worthless if it's out of the money. If you hold a long position in an Option that expires in the money, LEAN automatically exercises it at the expiration date. If you sell an Option contract and the buyer exercises their right to buy or sell the underlying asset, you are assigned the Option and must trade with the buyer at the strike price.

    Place Orders

    You can exercise American-style Option contracts anytime before they expire. Depending on your brokerage and the delivery method, you may be able to exercise European-style Option contracts on their expiration date. To exercise an Option, call the ExerciseOption method with the Option contract Symbol and a quantity. If you do not have sufficient capital for the order, it's rejected. By default, Option exercise orders are synchronous and fill immediately.

    var ticket = ExerciseOption(contractSymbol, quantity);
    ticket = self.ExerciseOption(contract_symbol, quantity)

    You can provide a tag and order properties to the ExerciseOption method.

    ExerciseOption(symbol, quantity, tag: tag, orderProperties: orderProperties);
    self.ExerciseOption(symbol, quantity, tag=tag, orderProperties=order_properties)

    Monitor Order Fills

    To monitor the fills of your order, save a reference to the order ticket .

    var ticket = ExerciseOption(contractSymbol, quantity);
    Debug($"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}");
    ticket = self.ExerciseOption(contract_symbol, quantity)
    self.Debug(f"Quantity filled: {ticket.QuantityFilled}; Fill price: {ticket.AverageFillPrice}")

    For more information about how LEAN models Option exercise orders in backtests, see the Exercise Option model .

    Synchronous Timeouts

    Option exercise orders are synchronous by default, so your algorithm waits for the order to fill before moving to the next line of code. If your order takes longer than five seconds to fill, your algorithm continues executing even if the trade isn't filled. To adjust the timeout period, set the Transactions.MarketOrderFillTimeout property.

    // Adjust the market fill-timeout to 30 seconds.
    Transactions.MarketOrderFillTimeout = TimeSpan.FromSeconds(30);
    
     # Adjust the market fill-timeout to 30 seconds.
    self.Transactions.MarketOrderFillTimeout = timedelta(seconds=30)

    Place Asynchronous Orders

    When you trade a large portfolio of assets, you may want to send orders in batches and not wait for the response of each one. To send asynchronous orders, set the asynchronous argument to True true .

    var ticket = ExerciseOption(contractSymbol, quantity, true);
    ticket = self.ExerciseOption(contract_symbol, quantity, True)

    Option Assignments

    If you sell an Option in a backtest, LEAN can simulate an Option exercise order on behalf of the buyer. By default, LEAN scans your portfolio every hour. It considers exercising American-style Options if they are within 4 days of their expiration and it considers exercising European-style Options on their day of expiration. If you have sold an Option that's 5% in-the-money and the Option exercise order is profitable after the cost of fees, LEAN exercises the Option. For more information about how we simulate Option assignments, see the Assignment reality model.

    Brokerage Support

    Each brokerage has a set of assets and order types they support. To avoid issues with Option exercise orders, set the brokerage model to a brokerage that supports them.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage);
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage)

    To check if your brokerage has any special requirements for Option exercise orders, see the Orders section of the brokerage model documentation .

    Requirements

    Option exercise orders can only be submitted for option contracts with a long position. European-style options cannot be exercised before their expiration date.

    Example

    The following backtest verifies the ExerciseOption behavior. The following table shows the first three trades in the backtest:

    Time Symbol Price Quantity Type Status Value Tag
    2021-07-01T09:31:00Z SPY 221216C00085000 345.30 1 Buy Market Filled 34530.00
    2021-07-01T09:31:00Z SPY 221216C00085000 0.00 -1 Sell Option Exercise Filled 0.00 Automatic Exercise
    2021-07-01T09:31:00Z SPY 85.00 100 Sell Option Exercise Filled 8500.00 Option Exercise

    The algorithm first brought a deep ITM option based on the set option selection conditions by $345.30, then exercise it actively, so 100 shares of SPY (in which 1 contract represents) was brought at its strike price at $85.00, with the option discarded from the portfolio.

    To reproduce these results, backtest the following algorithm:

     

    10.3.12 Other Order Types

    Introduction

    We are often asked to support other order types like one cancels the other, trailing stop, and multi-leg orders. Currently, LEAN doesn't support these order types, but we will add them over time. Part of the difficulty of implementing them is the incomplete brokerage support.

    One Cancels the Other Orders

    One cancels the other (OCO) orders are a set of orders that when one fills, it cancels the rest of the orders in the set. An example is to set a take-profit and a stop-loss order right after you enter a position. In this example, when either the take-profit or stop-loss order fills, you cancel the other order. OCO orders usually create an upper and lower bound on the exit price of a trade.

    When you place OCO orders, their price levels are usually relative to the fill price of an entry trade. If your entry trade is a synchronous market order, you can immediately get the fill price from the order ticket. If your entry trade doesn't execute immediately, you can get the fill price in the OnOrderEvents event handler. Once you have the entry fill price, you can calculate the price levels for the OCO orders.

    // Get the fill price from the order ticket of a sync market order
    _ticket = MarketOrder("SPY", 1);
    var fillPrice = _ticket.AverageFillPrice;
    
    // Get the fill price from the OnOrderEvent event handler
    public override void OnOrderEvent(OrderEvent orderEvent)
    {
        if (orderEvent.Status == OrderStatus.Filled && _ticket.OrderId == orderEvent.OrderId)
        {
            var fillPrice = orderEvent.FillPrice;
        }
    }
    # Get the fill price from the order ticket of a sync market order
    self.ticket = self.MarketOrder("SPY", 1)
    fill_price = self.ticket.AverageFillPrice
    
    # Get the fill price from the OnOrderEvent event handler
    def OnOrderEvent(self, orderEvent: OrderEvent) -> None:
        if orderEvent.Status == OrderStatus.Filled and self.ticket.OrderId == orderEvent.OrderId:
            fill_price = orderEvent.FillPrice

    After you have the target price levels, to implement the OCO orders, you can place active orders or track the security price to simulate the orders.

    Place Active Orders

    To place active orders for the OCO orders, use a combination of limit orders and stop limit orders . Place these orders so that their price levels that are far enough apart from each other. If their price levels are too close, several of the orders can fill in a single time step. When one of the orders fills, in the OnOrderEvent event handler, cancel the other orders in the OCO order set.

    OrderTicket _stopLoss = null;
    OrderTicket _takeProfit = null;
    
    public override void OnOrderEvent(OrderEvent orderEvent)
    {
        if (orderEvent.Status == OrderStatus.Filled)
        {
            if (orderEvent.OrderId == _ticket.OrderId)
            {
                _stopLoss = StopMarketOrder(orderEvent.Symbol, -orderEvent.FillQuantity, orderEvent.FillPrice*0.95m);
                _takeProfit = LimitOrder(orderEvent.Symbol, -orderEvent.FillQuantity, orderEvent.FillPrice*1.10m);
            }
            else if (_stopLoss != null && orderEvent.OrderId == _stopLoss.OrderId)
            {
                _takeProfit.Cancel();
            }
            else if (_takeProfit != null && orderEvent.OrderId == _takeProfit.OrderId)
            {
                _stopLoss.Cancel();
            }
        }
    }
    
    self.stop_loss = None
    self.take_profit = None
    
    def OnOrderEvent(self, orderEvent: OrderEvent) -> None:
        if orderEvent.Status == OrderStatus.Filled:
            if orderEvent.OrderId == self.ticket.OrderId:
                self.stop_loss = self.StopMarketOrder(orderEvent.Symbol, -orderEvent.FillQuantity, orderEvent.FillPrice*0.95)
                self.take_profit = self.LimitOrder(orderEvent.Symbol, -orderEvent.FillQuantity, orderEvent.FillPrice*1.10)
    
            elif self.stop_loss is not None and orderEvent.OrderId == self.stop_loss.OrderId:
                self.take_profit.Cancel()
    
            elif self.take_profit is not None and orderEvent.OrderId == self.take_profit.OrderId:
                self.stop_loss.Cancel()
    

    Simulate Orders

    To simulate OCO orders, track the asset price in the OnData method and place market or limit orders when asset price reaches the take-profit or stop-loss level. The benefit of manually simulating the OCO orders is that both of the orders can't fill in the same time step.

    decimal _entryPrice;
    
    public override void OnData(Slice slice)
    {
        if (!Portfolio.Invested)
        {
            var ticket = MarketOrder("SPY", 1);
            _entryPrice = ticket.AverageFillPrice;
        }
    
        if (!slice.Bars.ContainsKey("SPY")) return;
    
        if (slice.Bars["SPY"].Price >= _entryPrice * 1.10m)
        {
            Liquidate("SPY", -1, "take profit");
        }
        else if (slice.Bars["SPY"].Price <= _entryPrice * 0.95m)
        {
            Liquidate("SPY", -1, "stop loss");
        }
    }
    
    def OnData(self, slice: Slice) -> None:
        if not self.Portfolio.Invested:
            ticket = self.MarketOrder("SPY", 1)
            self.entry_price = ticket.AverageFillPrice
    
        if slice.Bars.ContainsKey("SPY"):
            if slice.Bars["SPY"].Price >= self.entry_price * 1.10:
                self.Liquidate("SPY", -1, "take profit")
    
            elif slice.Bars["SPY"].Price <= self.entry_price * 0.95:
                self.Liquidate("SPY", -1, "stop loss")

    Trailing Stop Loss Orders

    A trailing stop loss order is a dynamic stop loss that moves towards the asset price as the asset trades away from the stop price. For example, if you set a trailing stop loss to 10%, the furthest away it will ever be from the asset price is 10%. If it's a sell trailing stop loss order that's below the asset price and the asset price increases such that the trailing stop is more than 10% away, the trailing stop loss moves up to be 10% below the asset price. If the asset price decreases, the trailing stop loss doesn't move.

    To set a trailing stop loss order, see the Buy and Hold with a Trailing Stop Bootcamp lesson.

    Multi-Leg Orders

    Multi-leg orders are orders that contain multiple sub-orders. Examples of multi-leg orders include Option strategies like spreads , straddles , and strangles . You can manually implement other types of multi-leg orders with the built-in order types.

     

    10.4 Position Sizing

    Introduction

    LEAN provides several methods to help you set specific portfolio weights for assets. These methods account for lot size and pre-calculated order fees.

    Single Asset Targets

    The SetHoldings method calculates the number of asset units to purchase based on the portfolio weight you provide and then submits market orders. This method provides a quick way to set up a portfolio with a set of weights for assets. If you already have holdings, you may want to liquidate the existing holdings first to free up buying power.

    // Allocate 50% of portfolio value to IBM
    SetHoldings("IBM", 0.5);
    
    // Allocate 50% of portfolio value to IBM, but liquidate other holdings first
    SetHoldings("IBM", 0.5, true);
    
    // Provide a tag and order properties to the SetHoldings method
    SetHoldings(symbol, weight, liquidateExistingHoldings, tag, orderProperties);
    
     # Allocate 50% of buying power to IBM
    self.SetHoldings("IBM", 0.5)
    
    # Allocate 50% of portfolio value to IBM, but liquidate other holdings first
    self.SetHoldings("IBM", 0.5, True)
    
    # Provide a tag and order properties to the SetHoldings method
    self.SetHoldings(symbol, weight, liquidate_existing_holdings, tag, order_properties)

    If the percentage you provide translates to an order quantity of 0, the SetHoldings method doesn’t place an order and doesn’t log anything.

    Multiple Asset Targets

    When you trade a weighted basket of assets, sometimes you must intelligently scale down existing positions before increasing allocations to other assets. If you call the SetHoldings method with a list of PortfolioTarget objects, LEAN sorts the orders based on your position delta and then places the orders that reduce your position size in an asset before it places orders that increase your position size in an asset. When you call the SetHoldings method with a list of PortfolioTarget objects, the decimal you pass to the PortfolioTarget constructor represents the portfolio weight. In this situation, don't use the PortfolioTarget.Percent method.

    // Purchase a portfolio of targets, processing orders intelligently.
    var targets = new List<PortfolioTarget>() {
          new PortfolioTarget("SPY", 0.8m),
          new PortfolioTarget("IBM", 0.2m)
    };
    SetHoldings(targets);
    
    # Purchase a portfolio of targets, processing orders intelligently.
    self.SetHoldings([PortfolioTarget("SPY", 0.8), PortfolioTarget("IBM", 0.2)])
    

    Calculate Order Quantities

    The SetHoldings method uses market order to reach the target portfolio weight you provide. If you want to use a different order type, you need to specify the quantity to trade. To calculate the number of units to trade based on a portfolio weight, call the CalculateOrderQuantity method. The method calculates the quantity based on the current price of the asset and adjusts it for the fee model of the security. The target weight you provide is an unleveraged value. For instance, if you have 2x leverage and request a 100% weight, the method calculates the quantity that uses half of your available margin.

    // Calculate the fee-adjusted quantity of shares with given buying power
    var quantity = CalculateOrderQuantity("IBM", 0.4);
    
     # Calculate the fee-adjusted quantity of shares with given buying power
    quantity = self.CalculateOrderQuantity("IBM", 0.4)
    

    Buying Power Buffer

    If you place a market on open order near the market close, the market can gap overnight to a worse open price. If the gap is large enough against your trade direction, you may not have sufficient buying power at the open to fill your trade. To ensure a high probability of order fills through market gaps and discontinuities, the SetHoldings method assumes a 2.5% cash buffer. If LEAN rejects your orders due to buying power, widen the cash buffer through the algorithm Settings property.

    // Set the cash buffer to 5%
    Settings.FreePortfolioValuePercentage = 0.05m;
    
    // Set the cash buffer to $10,000
    Settings.FreePortfolioValue = 10000m;
    # Set the cash buffer to 5%
    self.Settings.FreePortfolioValuePercentage = 0.05
    
    # Set the cash buffer to $10,000
    self.Settings.FreePortfolioValue = 10000

    If you use FreePortfolioValuePercentage , you must set it in the Initialize or PostInitialize event handler. If you use FreePortfolioValue , you must set it after the PostInitialize event handler.

     

    10.5 Liquidating Positions

    Introduction

    The Liquidate method lets you liquidate individual assets or your entire portfolio. The method creates market orders to close positions and returns the IDs of the liquidation orders. If you have pending open orders for the security when you call Liquidate , LEAN tries to cancel them. The Liquidate method works for all asset classes, except Crypto. To liquidate Crypto positions, see Crypto Trades .

    Liquidate Individual Positions

    To liquidate your holdings in an individual security, call the Liquidate method and provide a ticker or Symbol .

    // Liquidate all IBM in your portfolio
    var orderIds = Liquidate("IBM");
    # Liquidate all IBM in your portfolio
    order_ids = self.Liquidate("IBM")

    You can pass an order tag to the Liquidate method.

    Liquidate("AAPL", "Liquidated");
    self.Liquidate("AAPL", "Liquidated")

    Liquidate All Positions

    To liquidate all of the positions in your portfolio, call the Liquidate method without any ticker of Symbol arguments.

    // Liquidate your entire portfolio
    var orderIds = Liquidate();
    // Liquidate your entire portfolio
    order_ids = self.Liquidate()

    You can pass an order tag to the Liquidate method.

    Liquidate(tag: "Liquidated");
    self.Liquidate(tag = "Liquidated")

    Enable and Disable Liquidations

    By default, the Liquidate method is functional. To enable and disable it, set the Settings.LiquidateEnabled property.

    // Disable liquidations
    Settings.LiquidateEnabled = false;
    
    // Enable liquidations
    Settings.LiquidateEnabled = true;
    # Disable liquidations
    self.Settings.LiquidateEnabled = False
    
    # Enable liquidations
    self.Settings.LiquidateEnabled = True

    Market Closed Considerations

    If you liquidate your positions when the market is closed, LEAN converts the orders into market on open orders. If your brokerage doesn't support market on open orders , the order is invalid.

     

    10.6 Crypto Trades

    Introduction

    All fiat and Crypto currencies are individual assets. When you buy a pair like BTCUSD, you trade USD for BTC. In this case, LEAN removes some USD from your portfolio cash book and adds some BTC. The virtual pair BTCUSD represents your position in the trade, but the virtual pair doesn't actually exist. It simply represents an open trade.

    Place Trades

    When you place Crypto trades, don't use the CalculateOrderQuantity or SetHoldings methods. Instead, calculate the order quantity based on the currency amounts in your cash book and place manual orders.

    The following code snippet demonstrates how to allocate 90% of your portfolio to BTC.

    public override void OnData(Slice data)
    {
        SetCryptoHoldings(_symbol, 0.9m);
    }
    
    private void SetCryptoHoldings(Symbol symbol, decimal percentage)
    {
        var crypto = Securities[symbol] as Crypto;
        var baseCurrency = crypto.BaseCurrency;
    
        // Calculate the target quantity in the base currency
        var targetQuantity = percentage * (Portfolio.TotalPortfolioValue - Settings.FreePortfolioValue) / baseCurrency.ConversionRate;
        var quantity = targetQuantity - baseCurrency.Amount;
    
        // Round down to observe the lot size
        var lotSize = crypto.SymbolProperties.LotSize;
        quantity = Math.Round(quantity / lotSize) * lotSize;
    
        if (IsValidOrderSize(crypto, quantity))
        {
            MarketOrder(symbol, quantity);
        }
    }
    
    // Brokerages have different order size rules
    // Binance considered the minimum volume (price x quantity):
    private bool IsValidOrderSize(Crypto crypto, decimal quantity)
    {
        return Math.Abs(crypto.Price * quantity) > crypto.SymbolProperties.MinimumOrderSize;
    }
    def OnData(self, data: Slice):
        self.set_crypto_holdings(self.symbol, .9)
    
    def set_crypto_holdings(self, symbol, percentage):
        crypto = self.Securities[symbol]
        base_currency = crypto.BaseCurrency
    
        # Calculate the target quantity in the base currency
        target_quantity = percentage * (self.Portfolio.TotalPortfolioValue - self.Settings.FreePortfolioValue) / base_currency.ConversionRate    
        quantity = target_quantity - base_currency.Amount
    
        # Round down to observe the lot size
        lot_size = crypto.SymbolProperties.LotSize
        quantity = round(quantity / lot_size) * lot_size
    
        if self.is_valid_order_size(crypto, quantity):
            self.MarketOrder(symbol, quantity)
    
    # Brokerages have different order size rules
    # Binance considers the minimum volume (price x quantity):
    def is_valid_order_size(self, crypto, quantity):
        return abs(crypto.Price * quantity) > crypto.SymbolProperties.MinimumOrderSize
    

    The preceding example doesn't take into account order fees. You can add a 0.1% buffer to accommodate it.

    The following example demonstrates how to form an equal-weighted Crypto portfolio and stay within the cash buffer .

    public override void OnData(Slice data)
    {
        var percentage = (1m - Settings.FreePortfolioValuePercentage) / _symbols.Count;
        foreach (var symbol in _symbols)
        {
            SetCryptoHoldings(_symbol, percentage);
        }
    }
    def OnData(self, data: Slice):
        percentage = (1 - self.Settings.FreePortfolioValuePercentage) / len(self.symbols);
        for symbol in self.symbols:
            self.set_crypto_holdings(symbol, percentage)

    You can replace the self. Settings.FreePortfolioValuePercentage for a class variable (e.g. self.cash_buffer _cashBuffer ).

    When you place Crypto trades, ensure you have a sufficient balance of the base or quote currency before each trade. If you hold multiple assets and you want to put all of your capital into BTCUSD, you need to first convert all your non-BTC assets into USD and then purchase BTCUSD.

    For a full example of placing crypto trades, see the BasicTemplateCryptoAlgorithm BasicTemplateCryptoAlgorithm .

    Liquidate Positions

    If you use the Liquidate method to liquidate a Crypto position, it only liquidates the quantity of the virtual pair. Since the virtual pair BTCUSD may not represent all of your BTC holdings, don't use the Liquidate method to liquidate Crypto positions. Instead, calculate the order quantity based on the currency amounts in your cash book and place manual orders. The following code snippet demonstrates how to liquidate a BTCUSD position.

    public override void OnData(Slice data)
    {
        LiquidateCrypto(_symbol);
    }
    
    private void LiquidateCrypto(Symbol symbol)
    {
        var crypto = Securities[symbol] as Crypto;
        var baseCurrency = crypto.BaseCurrency;
    
        // Avoid negative amount after liquidate
        var quantity = Math.Min(crypto.Holdings.Quantity, baseCurrency.Amount);
        
        // Round down to observe the lot size
        var lotSize = crypto.SymbolProperties.LotSize;
        quantity = (Math.Round(quantity / lotSize) - 1) * lotSize;
    
        if (IsValidOrderSize(crypto, quantity))
        {
            MarketOrder(symbol, -quantity);
        }
    }
    def OnData(self, data: Slice):
        self.liquidate_crypto(self.symbol)
    
    def liquidate_crypto(self, symbol):
        crypto = self.Securities[symbol]
        base_currency = crypto.BaseCurrency
    
        # Avoid negative amount after liquidate
        quantity = min(crypto.Holdings.Quantity, base_currency.Amount)
            
        # Round down to observe the lot size
        lot_size = crypto.SymbolProperties.LotSize;
        quantity = (round(quantity / lot_size) - 1) * lot_size
    
        if self.IsValidOrderSize(crypto, quantity):
            self.MarketOrder(symbol, -quantity)

    The order fees don't respect the lot size. When you try to liquidate a position, the absolute value of the base currency quantity can be less than the lot size and greater than zero. In this case, your algorithm holds a position that you can't liquidate and self. Portfolio[symbol].Invested is True true . The following code snippet demonstrates how to determine if you can liquidate a position:

    public override void OnData(Slice data)
    {
        var crypto = Securities[_symbol];
        if (Math.Abs(crypto.Holdings.Quantity) > crypto.SymbolProperties.LotSize)
        {
            LiquidateCrypto(_symbol);
        }
    }
    def OnData(self, data: Slice):
        crypto = self.Securities[self.symbol]
        if abs(crypto.Holdings.Quantity) > crypto.SymbolProperties.LotSize:
            self.liquidate_crypto(self.symbol)

     

    10.7 Option Strategies

    You can implement any of the following Option strategies in an algorithm. Click one to learn more.

    See Also

    Equity Options
    Future Options
    Index Options

     

    10.7.1 Bear Call Spread

    Introduction

    Bear call spread , also known as short call spread , consists of selling an ITM call and buying an OTM call. Both calls have the same underlying Equity and the same expiration date. The ITM call serves as a hedge for the OTM call. The bear call spread profits from a drop in underlying asset price.

    Implementation

    Follow these steps to implement the bear call spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                                  .Strikes(-15, 15)
                                                  .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain.Count() == 0) return;
      
          // Select the call Option contracts with the furthest expiry
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;    
          var calls = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Call);
          if (calls.Count() == 0) return;
      
          // Select the ITM and OTM contract strike prices from the remaining contracts
          var callStrikes = calls.Select(x => x.Strike).OrderBy(x => x);
          var itmStrike = callStrikes.First();
          var otmStrike = callStrikes.Last();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the furthest expiry date of the contracts
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the call Option contracts with the furthest expiry
          calls = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Call]
          if len(calls) == 0: return
      
          # Select the ITM and OTM contract strike prices from the remaining contracts
          call_strikes = sorted([x.Strike for x in calls])
          itm_strike = call_strikes[0]
          otm_strike = call_strikes[-1]
    5. In the OnData method, call the OptionStrategies.BearCallSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.BearCallSpread(_symbol, itmStrike, otmStrike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.BearCallSpread(self.symbol, itm_strike, otm_strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The bear call spread is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ P_T & = & (C^{OTM}_T - C^{ITM}_T + C^{ITM}_0 - C^{OTM}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ITM}_T & = & \textrm{ITM call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM call strike price}\\ & K^{ITM} & = & \textrm{ITM call strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{ITM}_0 & = & \textrm{ITM call value at position opening (debit paid)}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of bear call spread

    The maximum profit is the net credit you receive from opening the trade, $C^{ITM}_0 - C^{OTM}_0$. If the price declines, both calls expire worthless.

    The maximum loss is $K^{OTM} - K^{ITM} + C^{ITM}_0 - C^{OTM}_0$, which occurs when the underlying price is above the strike prices of both call Option contracts.

    If the Option is American Option, there is a risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    OTM call 4.40 835.00
    ITM call 36.80 767.50
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ & = & (829.08-835.00)^{+}\\ & = & 0\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ & = & (829.08-767.50)^{+}\\ & = & 61.58\\ P_T & = & (C^{OTM}_T - C^{ITM}_T + C^{ITM}_0 - C^{OTM}_0)\times m - fee\\ & = & (0-61.58+36.80-4.40)\times100-1.00\times2\\ & = & -2920\\ \end{array} $$

    So, the strategy losses $2,920.

    The following algorithm implements a bear call spread Option strategy:


    Demonstration Algorithm
    IndexOptionBearCallSpreadAlgorithm.py Python IndexOptionBearCallSpreadAlgorithm.cs C#

     

    10.7.2 Bear Put Spread

    Introduction

    Bear put spread , also known as short put spread , consists of buying an ITM put and selling an OTM put. Both puts have the same underlying Equity and the same expiration date. The OTM put serves as a hedge for the ITM put. The bear put spread profits from a decline in underlying asset price.

    Implementation

    Follow these steps to implement the bear put spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                               .Strikes(-15, 15)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain.Count() == 0) return;
      
          // Get the furthest expiry date of the contracts
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;
          
          // Select the put Option contracts with the furthest expiry
          var puts = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Put);
          if (puts.Count() == 0) return;
      
          // Select the ITM and OTM contract strike prices from the remaining contracts
          var putStrikes = puts.Select(x => x.Strike).OrderBy(x => x);
          var itmStrike = putStrikes.Last();
          var otmStrike = putStrikes.First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the furthest expiry date of the contracts
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the put Option contracts with the furthest expiry
          puts = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Put]
          if len(puts) == 0: return
      
          # Select the ITM and OTM contract strike prices from the remaining contracts
          put_strikes = sorted([x.Strike for x in puts])
          otm_strike = put_strikes[0]
          itm_strike = put_strikes[-1]
    5. In the OnData method, call the OptionStrategies.BearPutSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.BearPutSpread(_symbol, itmStrike, otmStrike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.BearPutSpread(self.symbol, itm_strike, otm_strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The bear put spread is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ P_T & = & (P^{ITM}_T - P^{OTM}_T + P^{OTM}_0 - P^{ITM}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ITM}_T & = & \textrm{ITM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM put strike price}\\ & K^{ITM} & = & \textrm{ITM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{ITM}_0 & = & \textrm{ITM put value at position opening (debit paid)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of bear put spread

    The maximum profit is $K^{ITM} - K^{OTM} + P^{OTM}_0 - P^{ITM}_0$. If the underlying price is below than the strike prices of both put Option contracts, they are worth $(K - S_T)$ at expiration.

    The maximum loss is the net debit you paid to open the position, $P^{OTM}_0 - P^{ITM}_0$.

    If the Option is American Option, there is a risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    OTM put 4.60 767.50
    ITM put 40.00 835.00
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ & = & (767.50-829.08)^{+}\\ & = & 0\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ & = & (835.00-829.08)^{+}\\ & = & 5.92\\ P_T & = & (P^{ITM}_T - P^{OTM}_T + P^{OTM}_0 - P^{ITM}_0)\times m - fee\\ & = & (5.92-0+4.60-40.00)\times100-1.00\times2\\ & = & -2950\\ \end{array} $$

    So, the strategy losses $2,950.

    The following algorithm implements a bear put spread strategy:


    Demonstration Algorithm
    IndexOptionBearPutSpreadAlgorithm.py Python IndexOptionBearPutSpreadAlgorithm.cs C#

     

    10.7.3 Bull Call Spread

    Introduction

    Bull call spread , also known as long call spread , consists of buying an ITM call and selling an OTM call. Both calls have the same underlying Equity and the same expiration date. The OTM call serves as a hedge for the ITM call. The bull call spread profits from a rise in underlying asset price.

    Implementation

    Follow these steps to implement the bull call spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                               .Strikes(-15, 15)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain.Count() == 0) return;
      
          // Get the furthest expiration date of the contracts
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;
          
          // Select the call Option contracts with the furthest expiry
          var calls = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Call);
          if (calls.Count() == 0) return;
      
          // Select the ITM and OTM contract strikes from the remaining contracts
          var putStrikes = calls.Select(x => x.Strike).OrderBy(x => x);
          var itmStrike = putStrikes.First();
          var otmStrike = putStrikes.Last();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the furthest expiration date of the contracts
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the call Option contracts with the furthest expiry
          calls = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Call]
          if len(calls) == 0: return
      
          # Select the ITM and OTM contract strike prices from the remaining contracts
          call_strikes = sorted([x.Strike for x in calls])
          itm_strike = call_strikes[0]
          otm_strike = call_strikes[-1]
    5. In the OnData method, call the OptionStrategies.BullCallSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.BullCallSpread(_symbol, itmStrike, otmStrike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.BullCallSpread(self.symbol, itm_strike, otm_strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The bull call spread is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ P_T & = & (C^{ITM}_T - C^{OTM}_T + C^{OTM}_0 - C^{ITM}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ITM}_T & = & \textrm{ITM call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM call strike price}\\ & K^{ITM} & = & \textrm{ITM call strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{ITM}_0 & = & \textrm{ITM call value at position opening (debit paid)}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of bull call spread

    The maximum profit is $K^{OTM} - K^{ITM} + C^{OTM}_0 - C^{ITM}_0$. If the underlying price increases to exceed both strikes at expiration, both calls are worth $(S_T - K)$ at expiration.

    The maximum loss is the net debit you paid to open the position, $C^{OTM}_0 - C^{ITM}_0$.

    If the Option is American Option, there is a risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    OTM call 3.00 835.00
    ITM call 41.00 767.50
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ & = & (829.08-835.00)^{+}\\ & = & 0\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ & = & (829.08-767.50)^{+}\\ & = & 61.58\\ P_T & = & (C^{ITM}_T - C^{OTM}_T + C^{OTM}_0 - C^{ITM}_0)\times m - fee\\ & = & (61.58-0+3.00-41.00)\times100-1.00\times2\\ & = & 2356\\ \end{array} $$

    So, the strategy profits $2,356.

    The following algorithm implements a bull call spread strategy:


    Demonstration Algorithm
    IndexOptionBullCallSpreadAlgorithm.py Python IndexOptionBullCallSpreadAlgorithm.cs C#

     

    10.7.4 Bull Put Spread

    Introduction

    Bull put spread , also known as long put spread , consists of buying an OTM put and selling an ITM put. Both puts have the same underlying Equity and the same expiration date. The OTM put serves as a hedge for the ITM put. The bull put spread profits from a rise in underlying asset price.

    Implementation

    Follow these steps to implement the bull put spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                               .Strikes(-15, 15)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain.Count() == 0) return;
      
          // Get the furthest expiration date of the contracts
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;
          
          // Select the put Option contracts with the furthest expiry
          var puts = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Put);
          if (puts.Count() == 0) return;
      
          // Select the ITM and OTM contract strikes from the remaining contracts
          var putStrikes = puts.Select(x => x.Strike).OrderBy(x => x);
          var itmStrike = putStrikes.Last();
          var otmStrike = putStrikes.First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the furthest expiration date of the contracts
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the put Option contracts with the furthest expiry
          puts = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Put]
          if len(puts) == 0: return
      
          # Select the ITM and OTM contract strikes from the remaining contracts
          put_strikes = sorted([x.Strike for x in puts])
          otm_strike = put_strikes[0]
          itm_strike = put_strikes[-1]
    5. In the OnData method, call the OptionStrategies.BullPutSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.BullPutSpread(_symbol, itmStrike, otmStrike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.BullPutSpread(self.symbol, itm_strike, otm_strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    This is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ P_T & = & (P^{OTM}_T - P^{ITM}_T + P^{ITM}_0 - P^{OTM}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ITM}_T & = & \textrm{ITM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM put strike price}\\ & K^{ITM} & = & \textrm{ITM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{ITM}_0 & = & \textrm{ITM put value at position opening (credit received)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of bear call spread

    The maximum profit is the net credit you received when opening the position, $P^{ITM}_0 - P^{OTM}_0$. If the underlying price is higher than the strike prices of both put contracts at expiration, both puts expire worthless.

    The maximum loss is $K^{ITM} - K^{OTM} + P^{ITM}_0 - P^{OTM}_0$.

    If the Option is American Option, there is a risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    OTM put 5.70 767.50
    ITM put 35.50 835.00
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ & = & (767.50-829.08)^{+}\\ & = & 0\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ & = & (835.00-829.08)^{+}\\ & = & 5.92\\ P_T & = & (P^{OTM}_T - P^{ITM}_T + P^{ITM}_0 - P^{OTM}_0)\times m - fee\\ & = & (0-5.92+35.50-5.70)\times100-1.00\times2\\ & = & 2386\\ \end{array} $$

    So, the strategy profits $2,386.

    The following algorithm implements a bull put spread strategy:


    Demonstration Algorithm
    IndexOptionBullPutSpreadAlgorithm.py Python IndexOptionBullPutSpreadAlgorithm.cs C#

     

    10.7.5 Call Butterfly

    Introduction

    The call butterfly strategy is the combination of a bull call spread and a bear call spread . In the call butterfly, all of the calls should have the same underlying Equity, the same expiration date, and the same strike price distance between the ITM-ATM and OTM-ATM call pairs. The call butterfly can be long or short.

    Long Call Butterfly

    The long call butterfly consists of a long ITM call, a long OTM call, and 2 short ATM calls. This strategy profits from low volatility in the underlying Equity price.

    Short Call Butterfly

    The short call butterfly consists of a short ITM call, a short OTM call, and 2 long ATM calls. This strategy profits from high volatility in the underlying Equity price.

    Implementation

    Follow these steps to implement the call butterfly strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                               .Strikes(-15, 15)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Get the furthest expiry date of the contracts
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;
          
          // Select the call Option contracts with the furthest expiry
          var calls = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Call);
          if (calls.Count() == 0) return;
      
          // Get the strike prices of the all the call Option contracts
          var callStrikes = calls.Select(x => x.Strike).OrderBy(x => x);
      
          // Get the ATM strike price
          var atmStrike = calls.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Get the strike prices for the contracts not ATM
          var spread = Math.Min(Math.Abs(callStrikes.First() - atmStrike), Math.Abs(callStrikes.Last() - atmStrike));
          var itmStrike = atmStrike - spread;
          var otmStrike = atmStrike + spread;
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the furthest expiry date of the contracts
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the call Option contracts with the furthest expiry
          calls = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Call]
          if len(calls) == 0: return
      
          # Get the strike prices of the all the call Option contracts
          call_strikes = sorted([x.Strike for x in calls])
      
          # Get the ATM strike price
          atm_strike = sorted(calls, key=lambda x: abs(x.Strike - chain.Underlying.Price))[0].Strike
      
          # Get the strike prices for the contracts not ATM
          spread = min(abs(call_strikes[0] - atm_strike), abs(call_strikes[-1] - atm_strike))
          itm_strike = atm_strike - spread
          otm_strike = atm_strike + spread
    5. In the OnData method, call the OptionStrategies.CallButterfly method and then submit the order.
    6. var optionStrategy = OptionStrategies.CallButterfly(_symbol, otmStrike, atmStrike, itmStrike, expiry);
      Buy(optionStrategy, 1);    // if long call butterfly
      Sell(optionStrategy, 1);   // if short call butterfly
      option_strategy = OptionStrategies.CallButterfly(self.symbol, otm_strike, atm_strike, itm_strike, expiry)
      self.Buy(option_strategy, 1)    # if long call butterfly
      self.Sell(option_strategy, 1)   # if short call butterfly

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy and Sell methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      Sell(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      self.Sell(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The call butterfly can be long or short.

    Long Call Butterfly

    The long call butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ C^{ATM}_T & = & (S_T - K^{ATM})^{+}\\ P_T & = & (C^{OTM}_T + C^{ITM}_T - 2\times C^{ATM}_T + 2\times C^{ATM}_0 - C^{ITM}_0 - C^{OTM}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ITM}_T & = & \textrm{ITM call value at time T}\\ & C^{ATM}_T & = & \textrm{ATM call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM call strike price}\\ & K^{ITM} & = & \textrm{ITM call strike price}\\ & K^{ATM} & = & \textrm{ATM call strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{ITM}_0 & = & \textrm{ITM call value at position opening (debit paid)}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (debit paid)}\\ & C^{ATM}_0 & = & \textrm{OTM call value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long call butterfly

    The maximum profit is $K^{ATM} - K^{ITM} + 2\times C^{ATM}_0 - C^{ITM}_0 - C^{OTM}_0$. It occurs when the underlying price is the same price at expiration as it was when opening the position and the payouts of the bull and bear call spreads are at their maximum.

    The maximum loss is the net debit paid: $2\times C^{ATM}_0 - C^{ITM}_0 - C^{OTM}_0$. It occurs when the underlying price is less than ITM strike or greater than OTM strike at expiration.

    If the Option is an American Option, there is a risk of early assignment on the sold contracts.

    Short Call Butterfly

    The short call butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ C^{ATM}_T & = & (S_T - K^{ATM})^{+}\\ P_T & = & (2\times C^{ATM}_T - C^{OTM}_T - C^{ITM}_T - 2\times C^{ATM}_0 + C^{ITM}_0 + C^{OTM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ITM}_T & = & \textrm{ITM call value at time T}\\ & C^{ATM}_T & = & \textrm{ATM call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM call strike price}\\ & K^{ITM} & = & \textrm{ITM call strike price}\\ & K^{ATM} & = & \textrm{ATM call strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{ITM}_0 & = & \textrm{ITM call value at position opening (credit received)}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (credit received)}\\ & C^{ATM}_0 & = & \textrm{ATM call value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short call butterfly

    The maximum profit is the net credit received: $C^{ITM}_0 + C^{OTM}_0 - 2\times C^{ATM}_0$. It occurs when the underlying price is less than ITM strike or greater than OTM strike at expiration.

    The maximum loss is $K^{ATM} - K^{ITM} + C^{ITM}_0 + C^{OTM}_0 - 2\times C^{ATM}_0$. It occurs when the underlying price is at the same level as when you opened the trade.

    If the Option is an American Option, there is a risk of early assignment on the sold contracts.

    Example

    The following table shows the price details of the assets in the long version of the algorithm:

    Asset Price ($) Strike ($)
    OTM call 4.90 767.50
    ATM call 15.00 800.00
    ITM call 41.00 832.50
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{OTM})^{+}\\ & = & (767.50-829.08)^{+}\\ & = & 0\\ C^{ITM}_T & = & (S_T - K^{ITM})^{+}\\ & = & (832.50-829.08)^{+}\\ & = & 3.42\\ C^{ATM}_T & = & (S_T - K^{ATM})^{+}\\ & = & (800.00-829.08)^{+}\\ & = & 0\\ P_T & = & (C^{OTM}_T + C^{ITM}_T - 2\times C^{ATM}_T + 2\times C^{ATM}_0 - C^{ITM}_0 - C^{OTM}_0)\times m - fee\\ & = & (0+3.42-0\times2-4.90-41.00+15.00\times2)\times100-1.00\times4\\ & = & -1252 \end{array} $$

    So, the strategy losses $1,252.

    The following algorithm implements a long call butterfly Option strategy:


    Demonstration Algorithm
    IndexOptionCallButterflyAlgorithm.py Python IndexOptionCallButterflyAlgorithm.cs C#

     

    10.7.6 Call Calendar Spread

    Introduction

    Call calendar spread , also known as call horizontal spread , is a combination of a longer-term (far-leg/front-month) call and a shorter-term (near-leg/back-month) call, where all calls have the same underlying stock and the same strike price. The call calendar spread can be long or short.

    Long Call Calendar Spread

    The long call calendar spread consists of buying a longer-term call and selling a shorter-term call. This strategy profits from a decrease in the underlying price. It also profits from the time decay value because the theta $\theta$ (the Option price decay by 1 day closer to maturity) of the shorter-term call is larger than longer-term call.

    Short Call Calendar Spread

    The short call calendar spread consists of selling a longer-term call and buying a shorter-term call. The strategy profits from from an increase in the underlying price.

    Implementation

    Follow these steps to implement the call calendar spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 2, 19);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                                  .Strikes(-1, 1)
                                                  .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(62)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 2, 19)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.Strikes(-1, 1).Expiration(timedelta(0), timedelta(62))
    3. In the OnData method, select the expiration and strikes of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Get the ATM strike
          var atmStrike = chain.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Select the ATM call Option contracts
          var calls = chain.Where(x => x.Strike == atmStrike && x.Right == OptionRight.Call);
          if (calls.Count() == 0) return;
      
          // Select the near and far expiry dates
          var expiries = calls.Select(x => x.Expiry).OrderBy(x => x);
          var nearExpiry = expiries.First();
          var farExpiry = expiries.Last();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the ATM strike
          atm_strike = sorted(chain, key=lambda x: abs(x.Strike - chain.Underlying.Price))[0].Strike
      
          # Select the ATM call Option contracts
          calls = [i for i in chain if i.Strike == atm_strike and i.Right == OptionRight.Call]
          if len(calls) == 0: return
      
          # Select the near and far expiry dates
          expiries = sorted([x.Expiry for x in calls])
          near_expiry = expiries[0]
          far_expiry = expiries[-1]
    5. In the OnData method, call the OptionStrategies.CallCalendarSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.CallCalendarSpread(_symbol, atmStrike, nearExpiry, farExpiry);
      Buy(optionStrategy, 1);        // if long call calendar spread
      Sell(optionStrategy, 1);     // if short call calendar spread
      option_strategy = OptionStrategies.CallCalendarSpread(self.symbol, atm_strike, near_expiry, far_expiry)
      self.Buy(option_strategy, 1)    # if long call calendar spread
      self.Sell(option_strategy, 1)   # if short call calendar spread

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy and Sell methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      Sell(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      self.Sell(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The call calendar spread can be long or short.

    Long Call Calendar Spread

    The long call calendar spread is a limited-reward-limited-risk strategy. The payoff at the shorter-term expiration is

    $$ \begin{array}{rcll} C^{\textrm{short-term}}_T & = & (S_T - K)^{+}\\ P_T & = & (C^{\textrm{long-term}}_T - C^{\textrm{short-term}}_T + C^{\textrm{short-term}}_0 - C^{\textrm{long-term}}_0)\times m - fee\\ \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{\textrm{short-term}}_T & = & \textrm{Shorter term call value at time T}\\ & C^{\textrm{long-term}}_T & = & \textrm{Longer term call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K & = & \textrm{Strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{\textrm{short-term}}_0 & = & \textrm{Shorter term call value at position opening (credit received)}\\ & C^{\textrm{long-term}}_0 & = & \textrm{Longer term call value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of shorter term call expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long call calendar spread

    The maximum profit is undetermined because it depends on the underlying volatility. It occurs when $S_T = S_0$ and the spread of the calls are at their maximum.

    The maximum loss is the net debit paid, $C^{\textrm{short-term}}_0 - C^{\textrm{long-term}}_0$. It occurs when the underlying price moves very deep ITM or OTM so the values of both calls are close to zero.

    If the Option is American Option, there is risk of early assignment on the sold contract. If the buyer exercises the call you sell, you could lose all the debit you received if you don't close the long call and the underlying price drops below the long call strike price.

    Short Call Calendar Spread

    The short call calendar spread is a limited-reward-limited-risk strategy. The payoff at the shorter-term expiration is

    $$ \begin{array}{rcll} C^{\textrm{short-term}}_T & = & (S_T - K)^{+}\\ P_T & = & (C^{\textrm{short-term}}_T - C^{\textrm{long-term}}_T + C^{\textrm{long-term}}_0 - C^{\textrm{short-term}}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{\textrm{short-term}}_T & = & \textrm{Shorter term call value at time T}\\ & C^{\textrm{long-term}}_T & = & \textrm{Longer term call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K & = & \textrm{Strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{\textrm{short-term}}_0 & = & \textrm{Shorter term call value at position opening (debit paid)}\\ & C^{\textrm{long-term}}_0 & = & \textrm{Longer term call value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of shorter term call expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short call calendar spread

    The maximum profit is the net credit received, $C^{\textrm{long-term}}_0 - C^{\textrm{short-term}}_0$. It occurs when the underlying price moves very deep ITM or OTM so the values of both calls are close to zero.

    The maximum loss is undetermined because it depends on the underlying volatility. It occurs when $S_T = S_0$ and the spread of the 2 calls are at their maximum.

    If the Option is American Option, there is risk of early assignment on the sold contract. If you don't close the call positions together, the naked short call will have unlimited drawdown risk after the long call expires.

    Example

    The following table shows the price details of the assets in the long version algorithm:

    Asset Price ($) Strike ($)
    Longer-term call at the start of the trade 4.40 835.00
    Shorter-term call at the start of the trade 36.80 767.50
    Longer-term call at time $T$ 31.35 835.00
    Underlying Equity at time $T$ 829.08 -

    Therefore, the payoff at time $T$ (the expiration of the short-term call) is

    $$ \begin{array}{rcll} C^{\textrm{short-term}}_T & = & (S_T - K)^{+}\\ & = & (828.07-800.00)^{+}\\ & = & 28.07\\ P_T & = & (C^{\textrm{long-term}}_T - C^{\textrm{short-term}}_T + C^{\textrm{short-term}}_0 - C^{\textrm{long-term}}_0)\times m - fee\\ & = & (31.35-28.07+11.30-20.00)\times100-1.00\times2\\ & = & -544 \end{array} $$

    So, the strategy losses $544.

    The following algorithm implements a long call calendar spread Option strategy:

    Demonstration Algorithm
    IndexOptionCallCalendarSpreadAlgorithm.py Python IndexOptionCallCalendarSpreadAlgorithm.cs C#

     

    10.7.7 Covered Call

    Introduction

    A Covered Call consists of buying a stock and selling call Options for the same amount of stock. The aim of the Covered Call is to profit from the Option premium by selling calls written on the stock you already owned. At any time for US Options or at expiration for European Options, if the stock moves below the strike price, you keep the premium and still maintain the underlying Equity position. If the underlying price moves above the strike, the Options contract will be exercised and you will have to sell the stock at the strike price, but you will still keep the premium. Another risk of a Covered Call comes from the long stock position, whose value could drop.

    Implementation

    Follow these steps to implement the covered call strategy:

    1. In the Initialize method, set the start date, set the end date, cash, subscribe to the underlying Equity, and create an Options universe .
    2. private Symbol _equity;
      private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2016, 1, 1);
          SetEndDate(2016, 3, 1);
          SetCash(100000);
      
          _equity = AddEquity("IBM", Resolution.Minute).Symbol;
          var option = AddOption("IBM", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.Strikes(-3, 3)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(30)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2016, 1, 1)
          self.SetEndDate(2016, 3, 1)
          self.SetCash(100000)
      
          equity = self.AddEquity("IBM", Resolution.Minute)
          option = self.AddOption("IBM", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(-3, +3, timedelta(0), timedelta(30))
    3. In the OnData method, select the Option contract.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Get the ATM strike price
          var atmStrike = chain.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Select the ATM call Option contracts
          var calls = chain.Where(x => x.Strike == atmStrike && x.Right == OptionRight.Call);
          if (calls.Count() == 0) return;
      
          // Select the contract with the furthest expiry
          var contracts = calls.OrderBy(x => x.Expiry);
          var contract = contracts.Last();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the ATM strike price
          atm_strike = sorted(chain, key = lambda x: abs(chain.Underlying.Price - x.Strike))[0].Strike
      
          # Select the ATM call Option contracts
          calls = [x for x in chain if x.Strike == atm_strike and x.Right == OptionRight.Call] 
          if len(calls) == 0: return
      
          # Select the contract with the furthest expiry
          contracts = sorted(calls, key=lambda x: x.Expiry, reverse=True)
          contract = contracts[0]
    5. In the OnData method, sell the Option contract and buy the corresponding amount of shares in the underlying Equity.
    6. Sell(contract.Symbol, 1); // Short the call Option
      Buy(_equity, 100);        // Buy 100 shares (contract multiplier) of the underlying stock
      self.Sell(contract.Symbol, 1) # Short the call Option
      self.Buy("IBM", 100)          # Buy 100 shares (contract multiplier) of the underlying stock

    Strategy Payoff

    The payoff of the strategy is

    $$ \begin{array}{rcll} C_T & = & (S_T - K)^{+}\\ P_T & = & (S_T - S_0 + C_0 - C_T)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C_T & = & \textrm{Call value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K & = & \textrm{Call strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & S_0 & = & \textrm{Underlying asset price when the trade opened}\\ & C_0 & = & \textrm{Call price when the trade opened (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    covered call strategy payoff

    The maximum profit is $K - S_T + C_0$. It occurs when the underlying price is at or above the strike price of the call at expiration.

    If the underlying price drop, the maximum loss is $S_0 - C_0$.

    If the Option is American Option, there is risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    Call 3.50 185.00
    Underlying Equity at start of the trade 187.07 -
    Underlying Equity at expiration 190.09 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C_T & = & (S_T - K)^{+}\\ & = & (190.09 - 185)^{+}\\ & = & 5.09\\ P_T & = & (S_T - S_0 + C_0 - C_T)\times m - fee\\ & = & (190.09 - 187.07 + 3.50 - 5.09)\times m - fee\\ & = & 141 \end{array} $$

    So, the strategy gains $141.

    The following algorithm implements a covered call strategy:

     

    10.7.8 Iron Butterfly

    Introduction

    Warning: There is currently no OptionStrategies method for Iron Butterfly orders, so this tutorial manually orders the individual legs in the strategy. If you manually place multi-leg orders one at a time while there is no liquidity at a strike price, you can get stuck in an unhedged position.

    The Iron Butterfly is an option strategy which involves four Option contracts. All the contracts have the same underlying stock and expiration, but the order of strike prices for the four contracts is $A>B>C$. The following table describes the strike price of each contract:

    Position Strike
    1 OTM call $A$
    1 ATM call $B$
    1 ATM put $B$
    1 OTM put $C=B-(A-B)$

    The iron butterfly can be long or short.

    Long Iron Butterfly

    The long iron butterfly consists of selling an OTM call, selling an OTM put, buying an ATM call, and buying an ATM put. This strategy profits from a decrease in price movement (implied volatility).

    Short Call Butterfly

    The short call butterfly consists of buying an OTM call, buying an OTM put, selling an ATM call, and selling an ATM put. This strategy profits from an increase in price movement (implied volatility) and from time decay value since ATM options decay sharper.

    Implementation

    Follow these steps to implement the short iron butterfly strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 4, 1);
          SetEndDate(2017, 5, 10);
          SetCash(100000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.Strikes(-10, 10)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(30)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 4, 1)
          self.SetEndDate(2017, 5, 10)
          self.SetCash(100000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(-10, 10, timedelta(0), timedelta(30))
    3. In the OnData method, select the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Separate the call and put contracts
          var calls = chain.Where(x => x.Right == OptionRight.Call);
          var puts = chain.Where(x => x.Right == OptionRight.Put);
          if (calls.Count() == 0 || puts.Count() == 0) return;
      
          // Get the ATM strike price
          var atmStrike = chain.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Select the OTM contracts
          var otmCallContract = calls.OrderBy(x => x.Strike).Last();
          var otmPutContract = puts.OrderBy(x => x.Strike).First();
      
          // Select the ATM contracts
          var atmCallContract = calls.Where(x => x.Strike == atmStrike).First();
          var atmPutsContract = puts.Where(x => x.Strike == atmStrike).First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Separate the call and put contracts
          call = [i for i in chain if i.Right == 0]
          put = [i for i in chain if i.Right == 1]
          if len(call) == 0 or len(put) == 0 : return
      
          # Select the OTM contracts
          call_contracts = sorted(call, key = lambda x: x.Strike)
          put_contracts = sorted(put, key = lambda x: x.Strike)
          otm_call = call_contracts[-1]
          otm_put = put_contracts[0]
      
          # Select the ATM contracts
          atm_put = sorted(put_contracts, key = lambda x: abs(chain.Underlying.Price - x.Strike))[0]
          atm_call = sorted(call_contracts, key = lambda x: abs(chain.Underlying.Price - x.Strike))[0]
      
    5. In the OnData method, submit the orders.
    6. Sell(atmPutsContract.Symbol, 1);
      Sell(atmCallContract.Symbol, 1);
      Buy(otmCallContract.Symbol, 1);
      Buy(otmPutContract.Symbol, 1);
      self.Sell(atm_put.Symbol, 1)
      self.Sell(atm_call.Symbol, 1)
      self.Buy(otm_call.Symbol, 1)
      self.Buy(otm_put.Symbol, 1)

    Strategy Payoff

    The iron butterfly can be long or short.

    Long Iron Butterfly

    The long iron butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^C_{OTM})^{+}\\ C^{ATM}_T & = & (S_T - K^C_{ATM})^{+}\\ P^{OTM}_T & = & (K^P_{OTM} - S_T)^{+}\\ P^{ATM}_T & = & (K^P_{ATM} - S_T)^{+}\\ P_T & = & (C^{ATM}_T + P^{ATM}_T - C^{OTM}_T - P^{OTM}_T - C^{ATM}_0 - P^{ATM}_0 + C^{OTM}_0 + P^{OTM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ATM}_T & = & \textrm{ATM call value at time T}\\ & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ATM}_T & = & \textrm{ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^C_{OTM} & = & \textrm{OTM call strike price}\\ & K^C_{ATM} & = & \textrm{ATM call strike price}\\ & K^P_{OTM} & = & \textrm{OTM put strike price}\\ & K^P_{ATM} & = & \textrm{ATM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (credit received)}\\ & C^{ATM}_0 & = & \textrm{ATM call value at position opening (debit paid)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (credit received)}\\ & P^{ATM}_0 & = & \textrm{ATM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long iron butterfly

    The maximum profit is $K^C_{OTM} - K^C_{ATM} - C^{ATM}_0 - P^{ATM}_0 + C^{OTM}_0 + P^{OTM}_0$. It occurs when the underlying price is below the OTM put strike price or above the OTM call strike price at expiration.

    The maximum loss is the net debit paid, $C^{OTM}_0 + P^{OTM}_0 - C^{ATM}_0 - P^{ATM}_0$. It occurs when the underlying price stays the same as when you opened the trade.

    If the Option is American Option, there is a risk of early assignment on the sold contracts.

    Short Call Butterfly

    The short call butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^C_{OTM})^{+}\\ C^{ATM}_T & = & (S_T - K^C_{ATM})^{+}\\ P^{OTM}_T & = & (K^P_{OTM} - S_T)^{+}\\ P^{ATM}_T & = & (K^P_{ATM} - S_T)^{+}\\ P_T & = & (C^{OTM}_T + P^{OTM}_T - C^{ATM}_T - P^{ATM}_T - C^{OTM}_0 - P^{OTM}_0 + C^{ATM}_0 + P^{ATM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & C^{ATM}_T & = & \textrm{ATM call value at time T}\\ & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ATM}_T & = & \textrm{ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^C_{OTM} & = & \textrm{OTM call strike price}\\ & K^C_{ATM} & = & \textrm{ATM call strike price}\\ & K^P_{OTM} & = & \textrm{OTM put strike price}\\ & K^P_{ATM} & = & \textrm{ATM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (debit paid)}\\ & C^{ATM}_0 & = & \textrm{ATM call value at position opening (credit received)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (debit paid)}\\ & P^{ATM}_0 & = & \textrm{ATM put value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short iron butterfly

    The maximum profit is the net credit received, $C^{ATM}_0 + P^{ATM}_0 - C^{OTM}_0 - P^{OTM}_0$. It occurs when the underlying price stays the same as when you opened the trade.

    The maximum loss is $K^C_{OTM} - K^C_{ATM} - C^{ATM}_0 - P^{ATM}_0 + C^{OTM}_0 + P^{OTM}_0$. It occurs when the underlying price is below the OTM put strike price or above the OTM call strike price at expiration.

    If the Option is American Option, there is a risk of early assignment on the sold contracts.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    OTM call 1.85 857.50
    OTM put 2.75 810.00
    ATM call 8.10 832.00
    ATM put 7.40 832.00
    Underlying Equity at expiration 851.20 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^C_{OTM})^{+}\\ & = & (851.20-857.50)^{+}\\ & = & 0\\ C^{ATM}_T & = & (S_T - K^C_{ATM})^{+}\\ & = & (851.20-832.00)^{+}\\ & = & 19.20\\ P^{OTM}_T & = & (K^P_{OTM} - S_T)^{+}\\ & = & (832.00-851.20)^{+}\\ & = & 0\\ P^{ATM}_T & = & (K^P_{ATM} - S_T)^{+}\\ & = & (810.00-851.20)^{+}\\ & = & 0\\ P_T & = & (C^{OTM}_T + P^{OTM}_T - C^{ATM}_T - P^{ATM}_T - C^{OTM}_0 - P^{OTM}_0 + C^{ATM}_0 + P^{ATM}_0)\times m - fee\\ & = & (0+0-19.20-0+8.10+7.40-1.85-2.75)\times100-1\times4\\ & = & -834 \end{array} $$

    So, the strategy losses $834.

    The following algorithm implements a short iron butterfly Option strategy:

     

    10.7.9 Iron Condor

    Introduction

    The Iron Condor is an Option strategy that consists of four contracts. All the contracts have the same underlying Equity and expiration, but the order of strike prices is $A>B>C>D$. The following table describes the strike prices of each contract:

    Position Strike
    1 far-OTM call $A$
    1 near-OTM call $B, where B > underlying\ price$
    1 near-OTM put $C, where C < underlying\ price$
    1 far-OTM put $D, where C-D = A-B$

    The iron condor can be long or short.

    Long Iron Condor

    The long iron condor consists of selling a far OTM call, selling a far OTM put, buying a near OTM call, and buying a near OTM put. This strategy profits from a increase in price movement (implied volatility).

    Short Iron Condor

    The short iron condor consists of buying a far OTM call, buying a far OTM put, selling a near ATM call, and selling a near ATM put. This strategy profits from an decrease in price movement (implied volatility) and time decay since ATM options decay sharper.

    Implementation

    Follow these steps to implement the long iron condor strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 1);
          SetCash(100000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.Strikes(-10, 10)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(30)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 1)
          self.SetCash(300000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(-10, 10, timedelta(0), timedelta(30))
    3. In the OnData method, select the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Separate the call and put contracts
          var calls = chain.Where(x => x.Right == OptionRight.Call);
          var puts = chain.Where(x => x.Right == OptionRight.Put);
          if (calls.Count() == 0 || puts.Count() == 0) return;
      
          // Sort the contracts by their strike prices
          var callContracts = calls.OrderByDescending(x => x.Strike);
          var putContracts = puts.OrderBy(x => x.Strike);
      
          // Select the contracts in the strategy legs
          var farCallContract = callContracts.First();
          var farPutContract = putContracts.First();
          var nearCallContract = callContracts.Skip(2).First();
          var nearPutContract = putContracts.Skip(2).First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Separate the call and put contracts
          call = [i for i in chain if i.Right == 0]
          put = [i for i in chain if i.Right == 1]
          if len(call) == 0 or len(put) == 0 : return
      
          # Sort the contracts by their strike prices
          call_contracts = sorted(call, key = lambda x: x.Strike, reverse=True)
          put_contracts = sorted(put, key = lambda x: x.Strike)
      
          # Select the contracts in the strategy legs
          near_put = call_contracts[1]
          near_call = put_contracts[1]
          far_call = call_contracts[0]
          far_put = put_contracts[0]
    5. In the OnData method, create the order legs and then call the ComboMarketOrder method.
    6. var legs = new List<Leg>
      {
          Leg.Create(nearCallContract.Symbol, 1),
          Leg.Create(nearPutContract.Symbol, 1),
          Leg.Create(farCallContract.Symbol, -1),
          Leg.Create(farPutContract.Symbol, -1)
      };
      ComboMarketOrder(legs, 1);
      legs = [
          Leg.Create(near_call.Symbol, 1),
          Leg.Create(near_put.Symbol, 1),
          Leg.Create(far_call.Symbol, -1),
          Leg.Create(far_put.Symbol, -1)
      ]
      self.ComboMarketOrder(legs, 1)

    Strategy Payoff

    The iron condor can be long or short.

    Long Iron Condor

    This is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{far}_T & = & (S_T - K^C_{far})^{+}\\ C^{near}_T & = & (S_T - K^C_{near})^{+}\\ P^{far}_T & = & (K^P_{far} - S_T)^{+}\\ P^{near}_T & = & (K^P_{near} - S_T)^{+}\\ P_T & = & (C^{near}_T + P^{near}_T - C^{far}_T - P^{far}_T - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{far}_T & = & \textrm{Far OTM call value at time T}\\ & C^{near}_T & = & \textrm{Near OTM call value at time T}\\ & P^{far}_T & = & \textrm{Far OTM put value at time T}\\ & P^{near}_T & = & \textrm{Near ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^C_{far} & = & \textrm{Far OTM call strike price}\\ & K^C_{near} & = & \textrm{Near OTM call strike price}\\ & K^P_{far} & = & \textrm{Far OTM put strike price}\\ & K^P_{near} & = & \textrm{Near OTM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{far}_0 & = & \textrm{Far OTM call value at position opening (credit received)}\\ & C^{near}_0 & = & \textrm{Near OTM call value at position opening (debit paid)}\\ & P^{far}_0 & = & \textrm{Far OTM put value at position opening (credit received)}\\ & P^{near}_0 & = & \textrm{Near OTM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long iron condor

    The maximum profit is $K^C_{far} - K^C_{near} - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0$, where $K^P_{OTM} > S_T$ or $S_T > K^C_{OTM}$.

    The maximum loss is the net debit paid: $C^{far}_0 + P^{far}_0 - C^{near}_0 - P^{near}_0$, where $K^P_{OTM} < S_T < K^C_{OTM}$.

    If the Option is American Option, there is a risk of early assignment on the sold contracts.

    Short Iron Condor

    This is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} C^{far}_T & = & (S_T - K^C_{far})^{+}\\ C^{near}_T & = & (S_T - K^C_{near})^{+}\\ P^{far}_T & = & (K^P_{far} - S_T)^{+}\\ P^{near}_T & = & (K^P_{near} - S_T)^{+}\\ P_T & = & (C^{far}_T + P^{far}_T - C^{near}_T - P^{near}_T - C^{far}_0 - P^{far}_0 + C^{near}_0 + P^{near}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{far}_T & = & \textrm{Far OTM call value at time T}\\ & C^{near}_T & = & \textrm{Near OTM call value at time T}\\ & P^{far}_T & = & \textrm{Far OTM put value at time T}\\ & P^{near}_T & = & \textrm{Near ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^C_{far} & = & \textrm{Far OTM call strike price}\\ & K^C_{near} & = & \textrm{Near OTM call strike price}\\ & K^P_{far} & = & \textrm{Far OTM put strike price}\\ & K^P_{near} & = & \textrm{Near OTM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{far}_0 & = & \textrm{Far OTM call value at position opening (credit received)}\\ & C^{near}_0 & = & \textrm{Near OTM call value at position opening (debit paid)}\\ & P^{far}_0 & = & \textrm{Far OTM put value at position opening (credit received)}\\ & P^{near}_0 & = & \textrm{Near OTM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short iron condor

    The maximum profit is the net credit received after commission when opening the trade, where $K^P_{OTM} < S_T < K^C_{OTM}$.

    The maximum loss is $K^C_{far} - K^C_{near} + C^{near}_0 + P^{near}_0 - C^{far}_0 - P^{far}_0$, where $K^P_{OTM} > S_T$ or $S_T > K^C_{OTM}$.

    If the Option is American Option, there is risk of early assignment on the sold contracts.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    Far-OTM call 1.85 857.50
    Far-OTM put 2.75 810.00
    Near-OTM call 1.35 855.00
    Near-OTM put 2.15 815.00
    Underlying Equity at expiration 851.20 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{far}_T & = & (S_T - K^C_{far})^{+}\\ & = & (851.20-857.50)^{+}\\ & = & 0\\ C^{near}_T & = & (S_T - K^C_{near})^{+}\\ & = & (851.20-855.00)^{+}\\ & = & 0\\ P^{far}_T & = & (K^P_{far} - S_T)^{+}\\ & = & (815.00-851.20)^{+}\\ & = & 0\\ P^{near}_T & = & (K^P_{near} - S_T)^{+}\\ & = & (810.00-851.20)^{+}\\ & = & 0\\ P_T & = & (C^{near}_T + P^{near}_T - C^{far}_T - P^{far}_T - C^{near}_0 - P^{near}_0 + C^{far}_0 + P^{far}_0)\times m - fee\\ & = & (0+0-0-0+1.35+2.15-1.85-2.75)\times100-1\times4\\ & = & -114 \end{array} $$

    So, the strategy losses $114.

    The following algorithm implements a long iron condor Option strategy:

    Demonstration Algorithm
    IndexOptionIronCondorAlgorithm.py Python IndexOptionIronCondorAlgorithm.cs C#

     

    10.7.10 Protective Collar

    Introduction

    A Protective Collar is an Options strategy that consists of a covered call and a long put (protective put) with a lower strike price than the short call contract. In contrast to the covered call, the protective put component limits the drawdown of the strategy when the underlying price decreases too much.

    Implementation

    Follow these steps to implement the protective collar strategy:

    1. In the Initialize method, set the start date, set the end date, subscribe to the underlying Equity , and create an Option universe .
    2. private Symbol _equitySymbol, _optionSymbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 4, 1);
          SetEndDate(2017, 4, 30);
          SetCash(100000);
      
          _equitySymbol = AddEquity("GOOG").Symbol;
          var option = AddOption("GOOG", Resolution.Minute);
          _optionSymbol = option.Symbol;
          option.SetFilter(universe => universe.Strikes(-10, 10)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(30)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 4, 1)
          self.SetEndDate(2017, 4, 30)
          self.SetCash(100000)
          
          self.equity_symbol = self.AddEquity("GOOG").Symbol
          option = self.AddOption("GOOG", Resolution.Minute)
          self.option_symbol = option.Symbol
          option.SetFilter(-10, +10, timedelta(0), timedelta(30))
    3. In the OnData method, select the Option contracts.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_optionSymbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Select an expiry date
          var expiry = chain.OrderBy(x => x.Expiry).Last().Expiry;
      
          // Select the call and put contracts that expire on the selected date
          var calls = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Call);
          var puts = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Put);
          if (calls.Count() == 0 || puts.Count() == 0) return;
      
          // Select the OTM contracts
          var call = calls.OrderBy(x => x.Strike).Last();
          var put = puts.OrderBy(x => x.Strike).First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Select an expiry date
          expiry = sorted(chain, key = lambda x: x.Expiry)[-1].Expiry
      
          # Select the call and put contracts that expire on the selected date
          calls = [x for x in chain if x.Right == OptionRight.Call and x.Expiry == expiry]
          puts = [x for x in chain if x.Right == OptionRight.Put and x.Expiry == expiry]
          if not calls or not puts: return
      
          # Select the OTM contracts
          call = sorted(calls, key = lambda x: x.Strike)[-1]
          put = sorted(puts, key = lambda x: x.Strike)[0]
    5. In the OnData method, submit the orders.
    6. Sell(call.Symbol, 1);    // Sell the OTM call
      Buy(put.Symbol, 1);      // Buy the OTM call
      Buy(_equitySymbol, 100); // Buy 100 shares of the underlying stock
      self.Sell(call.Symbol, 1)          # Sell the OTM call
      self.Buy(put.Symbol, 1)            # Buy the OTM put
      self.Buy(self.equity_symbol, 100)  # Buy 100 shares of the underlying stock

    Strategy Payoff

    This is a limited-profit-limited-loss strategy. The payoff is

    $$ \begin{array}{rcll} C_T & = & (S_T - K^{C})^{+}\\ P_T & = & (K^{P} - S_T)^{+}\\ Payoff_T & = & (S_T - S_0 - C_T + P_T + C_0 - P_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C_T & = & \textrm{Call value at time T}\\ & P_T & = & \textrm{Put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{C} & = & \textrm{Call strike price}\\ & K^{P} & = & \textrm{Put strike price}\\ & Payoff_T & = & \textrm{Payout total at time T}\\ & S_0 & = & \textrm{Underlying asset price when the trade opened}\\ & C_0 & = & \textrm{Call price when the trade opened (credit received)}\\ & P_0 & = & \textrm{Put price when the trade opened (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    protective collar strategy payoff

    The maximum profit is $K^{C} - S_T + C_0 - P_0$. It occurs when the underlying price is at or above the strike price of the call at expiration.

    The maximum profit is $S_T - K^{P} + C_0 - P_0$. It occurs when the underlying price is at or below the strike price of the put at expiration.

    If the Option is American Option, there is risk of early assignment on the sold contract.

    Example

    The following table shows the price details of the assets in the algorithm:

    Asset Price ($) Strike ($)
    Call 2.85 845.00
    Put 6.00 822.50
    Underlying Equity at expiration 843.19 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C_T & = & (S_T - K^{C})^{+}\\ & = & (843.19-845.00)^{+}\\ & = & 0\\ P_T & = & (K^{P} - S_T)^{+}\\ & = & (822.50-843.19)^{+}\\ & = & 0\\ Payoff_T & = & (S_T - S_0 - C_T + P_T + C_0 - P_0)\times m - fee\\ & = & (843.19-833.17+0-0+2.85-6.00)\times100-1.00\times3\\ & = & 684\\ \end{array} $$

    So, the strategy gains $684.

    The following algorithm implements a protective collar Option strategy:

     

    10.7.11 Put Butterfly

    Introduction

    Put butterfly is the combination of a bull put spread and a bear put spread . In this strategy, all the puts have the same underlying stock, the same expiration date, and the strike price distance of ITM-ATM and OTM-ATM put pairs are the same. The put butterfly strategy can be long or short.

    Long Put Butterfly

    The long put butterfly strategy consists of buying an ITM put, buying an OTM put, and selling 2 ATM puts. This strategy profits from low volatility.

    Short Put Butterfly

    The short put butterfly strategy consists of selling an ITM put, selling an OTM put, and buying 2 ATM puts. This strategy profits from a drastic change in underlying price.

    Implementation

    Follow these steps to implement the put butterfly strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 3, 5);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                                  .Strikes(-15, 15)
                                                  .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(31)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 3, 5)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(31))
    3. In the OnData method, select strikes and expiration date of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Select an expiry date
          var expiry = chain.OrderByDescending(x => x.Expiry).First().Expiry;
          
          // Select the put contracts that expire on the selected date
          var puts = chain.Where(x => x.Expiry == expiry && x.Right == OptionRight.Put);
          if (puts.Count() == 0) return;
      
          // Sort the put contracts by their strike prices
          var putStrikes = puts.Select(x => x.Strike).OrderBy(x => x);
      
          // Get the ATM strike price
          var atmStrike = puts.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Get the distance between lowest strike price and ATM strike, and highest strike price and ATM strike 
          // Get the lower value as the spread distance as equidistance is needed for both sides
          var spread = Math.Min(Math.Abs(putStrikes.First() - atmStrike), Math.Abs(putStrikes.Last() - atmStrike));
      
          // Select the strike prices of the strategy legs
          var itmStrike = atmStrike + spread;
          var otmStrike = atmStrike - spread;
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Select an expiry date
          expiry = sorted(chain, key = lambda x: x.Expiry, reverse=True)[0].Expiry
          
          # Select the put contracts that expire on the selected date
          puts = [i for i in chain if i.Expiry == expiry and i.Right == OptionRight.Put]
          if len(puts) == 0: return
      
          # Sort the put contracts by their strike prices
          put_strikes = sorted([x.Strike for x in puts])
      
          # Get the ATM strike price
          atm_strike = sorted(puts, key=lambda x: abs(x.Strike - chain.Underlying.Price))[0].Strike
      
          # Get the distance between lowest strike price and ATM strike, and highest strike price and ATM strike. 
          # Get the lower value as the spread distance as equidistance is needed for both sides
          spread = min(abs(put_strikes[0] - atm_strike), abs(put_strikes[-1] - atm_strike))
      
          # Select the strike prices of the strategy legs
          itm_strike = atm_strike + spread
          otm_strike = atm_strike - spread
    5. In the OnData method, call the OptionStrategies.PutButterfly method and then submit the order.
    6. var optionStrategy = OptionStrategies.PutButterfly(_symbol, itmStrike, atmStrike, otmStrike, expiry);
      Buy(optionStrategy, 1);    // if long put butterfly
      Sell(optionStrategy, 1);   // if short put butterfly
      option_strategy = OptionStrategies.PutButterfly(self.symbol, itm_strike, atm_strike, otm_strike, expiry)
      self.Buy(option_strategy, 1)    # if long put butterfly
      self.Sell(option_strategy, 1)   # if short put butterfly

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy and Sell methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      Sell(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      self.Sell(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The put butterfly can be long or short.

    Long Put Butterfly

    The long put butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ P^{ATM}_T & = & (K^{ATM} - S_T)^{+}\\ P_T & = & (P^{OTM}_T + P^{ITM}_T - 2\times P^{ATM}_T + 2\times P^{ATM}_0 - P^{ITM}_0 - P^{OTM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ITM}_T & = & \textrm{ITM put value at time T}\\ & P^{ATM}_T & = & \textrm{ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM put strike price}\\ & K^{ITM} & = & \textrm{ITM put strike price}\\ & K^{ATM} & = & \textrm{ATM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{ITM}_0 & = & \textrm{ITM put value at position opening (debit paid)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (debit paid)}\\ & P^{ATM}_0 & = & \textrm{ATM put value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long put butterfly

    The maximum profit is $K^{ATM} - K^{OTM} + 2\times P^{ATM}_0 - P^{ITM}_0 - P^{OTM}_0$. It occurs when the underlying price is the same at expiration as it was when you open the trade. In this case, the payout of the combined bull put and bear put spreads are at their maximum.

    The maximum loss is the net debit paid, $2\times P^{ATM}_0 - P^{ITM}_0 - P^{OTM}_0$. It occurs when the underlying price is below the ITM strike price or above the OTM strike price at expiration.

    If the Option is American Option, there is risk of early assignment on the sold contracts.

    Short Put Butterfly

    The short put butterfly is a limited-reward-limited-risk strategy. The payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ P^{ATM}_T & = & (K^{ATM} - S_T)^{+}\\ P_T & = & (2\times P^{ATM}_T - P^{OTM}_T - P^{ITM}_T - 2\times P^{ATM}_0 + P^{ITM}_0 + P^{OTM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & P^{ITM}_T & = & \textrm{ITM put value at time T}\\ & P^{ATM}_T & = & \textrm{ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{OTM} & = & \textrm{OTM put strike price}\\ & K^{ITM} & = & \textrm{ITM put strike price}\\ & K^{ATM} & = & \textrm{ATM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{ITM}_0 & = & \textrm{ITM put value at position opening (credit received)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (credit received)}\\ & P^{ATM}_0 & = & \textrm{ATM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short put butterfly

    The maximum profit is the net credit received, $P^{ITM}_0 + P^{OTM}_0 - 2\times P^{ATM}_0$. It occurs when the underlying price is below the ITM strike or above the OTM strike at expiration.

    The maximum loss is $K^{ATM} - K^{OTM} - 2\times P^{ATM}_0 + P^{ITM}_0 + P^{OTM}_0$. It occurs when the underlying price at expiration is at the same price as when you opened the trade.

    If the Option is American Option, there is risk of early assignment on the sold contracts.

    Example

    The following table shows the price details of the assets in the long put butterfly algorithm:

    Asset Price ($) Strike ($)
    ITM put 37.80 832.50
    ATM put 14.70 800.00
    OTM put 5.70 767.50
    Underlying Equity at expiration 829.08 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} P^{OTM}_T & = & (K^{OTM} - S_T)^{+}\\ & = & (829.08-832.50)^{+}\\ & = & 0\\ P^{ITM}_T & = & (K^{ITM} - S_T)^{+}\\ & = & (829.08-767.50)^{+}\\ & = & 61.58\\ P^{ATM}_T & = & (K^{ATM} - S_T)^{+}\\ & = & (829.08-800.00)^{+}\\ & = & 29.08\\ P_T & = & (P^{OTM}_T + P^{ITM}_T - 2\times P^{ATM}_T + 2\times P^{ATM}_0 - P^{ITM}_0 - P^{OTM}_0)\times m - fee\\ & = & (61.58+0-29.08\times2-5.70-37.80+14.70\times2)\times100-1.00\times4\\ & = & -1072 \end{array} $$

    So, the strategy losses $1,072.

    The following algorithm implements a long put butterfly Option strategy:


    Demonstration Algorithm
    IndexOptionPutButterflyAlgorithm.py Python IndexOptionPutButterflyAlgorithm.cs C#

     

    10.7.12 Put Calendar Spread

    Introduction

    Put calendar spread , also known as put horizontal spread , is a combination of a longer-term (far-leg/front-month) put and a shorter-term (near-leg/back-month) put, where both puts have the same underlying stock and the same strike price. The put calendar spread strategy can be long or short.

    Long Put Calendar Spread

    The long put calendar spread consists of buying a longer-term put and selling a shorter-term put. This strategy profits from a decrease in price movement. The strategy also profits from the time decay value because the theta $\theta$ (the Option price decay by 1 day closer to maturity) of the shorter-term put is larger than the longer-term put.

    Short Put Calendar Spread

    The short put calendar spread consists of selling a longer-term put and buying a shorter-term put. This strategy profits from an increase in price movement.

    Implementation

    Follow these steps to implement the put calendar spread strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 2, 1);
          SetEndDate(2017, 2, 19);
          SetCash(500000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(universe => universe.IncludeWeeklys()
                                               .Strikes(-1, 1)
                                               .Expiration(TimeSpan.FromDays(0), TimeSpan.FromDays(62)));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 2, 1)
          self.SetEndDate(2017, 2, 19)
          self.SetCash(500000)
      
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(self.UniverseFunc)
      
      def UniverseFunc(self, universe: OptionFilterUniverse) -> OptionFilterUniverse:
          return universe.Strikes(-1, 1).Expiration(timedelta(0), timedelta(62))
    3. In the OnData method, select the strike price and expiration dates of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Get the ATM strike price
          var atmStrike = chain.OrderBy(x => Math.Abs(x.Strike - chain.Underlying.Price)).First().Strike;
      
          // Select the ATM put contracts
          var puts = chain.Where(x => x.Strike == atmStrike && x.Right == OptionRight.Put);
          if (puts.Count() == 0) return;
      
          // Select the near and far expiration dates
          var expiries = puts.Select(x => x.Expiry).OrderBy(x => x);
          var nearExpiry = expiries.First();
          var farExpiry = expiries.Last();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Get the ATM strike price
          atm_strike = sorted(chain, key=lambda x: abs(x.Strike - chain.Underlying.Price))[0].Strike
      
          # Select the ATM put contracts
          puts = [i for i in chain if i.Strike == atm_strike and i.Right == OptionRight.Put]
          if len(puts) == 0: return
      
          # Select the near and far expiration dates
          expiries = sorted([x.Expiry for x in puts], key = lambda x: x)
          near_expiry = expiries[0]
          far_expiry = expiries[-1]
    5. In the OnData method, call the OptionStrategies.PutCalendarSpread method and then submit the order.
    6. var optionStrategy = OptionStrategies.PutCalendarSpread(_symbol, atmStrike, nearExpiry, farExpiry);
      Buy(optionStrategy, 1);    // if long put calendar spread
      Sell(optionStrategy, 1);   // if short put calendar spread
      option_strategy = OptionStrategies.PutCalendarSpread(self.symbol, atm_strike, near_expiry, far_expiry)
      self.Buy(option_strategy, 1)    # if long put calendar spread
      self.Sell(option_strategy, 1)   # if short put calendar spread

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy and Sell methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      Sell(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      self.Sell(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The put calendar spread can be long or short.

    Long Put Calendar Spread

    The long put calendar spread is a limited-reward-limited-risk strategy. The payoff is taken at the shorter-term expiration. The payoff is

    $$ \begin{array}{rcll} P^{\textrm{short-term}}_T & = & (K - S_T)^{+}\\ P_T & = & (P^{\textrm{long-term}}_T - P^{\textrm{short-term}}_T + P^{\textrm{short-term}}_0 - P^{\textrm{long-term}}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{\textrm{short-term}}_T & = & \textrm{Shorter term put value at time T}\\ & P^{\textrm{long-term}}_T & = & \textrm{Longer term put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K & = & \textrm{Strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{\textrm{short-term}}_0 & = & \textrm{Shorter term put value at position opening (credit received)}\\ & P^{\textrm{long-term}}_0 & = & \textrm{Longer term put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of shorter term put expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long put calendar spread

    The maximum profit is undetermined because it depends on the underlying volatility.  It occurs when $S_T = S_0$ and the spread of the puts are at their maximum.

    The maximum loss is the net debit paid, $P^{\textrm{short-term}}_0 - P^{\textrm{long-term}}_0$. It occurs when the underlying price moves very deep ITM or OTM so the values of both puts are close to zero.

    If the Option is American Option, there is risk of early assignment on the sold contract. Naked long puts pose risk of losing all the debit paid if you don't close the position with short put together and the price drops below its strike.

    Short Put Calendar Spread

    The short put calendar spread is a limited-reward-limited-risk strategy. The payoff is taken at the shorter-term expiration. The payoff is

    $$ \begin{array}{rcll} P^{\textrm{short-term}}_T & = & (K - S_T)^{+}\\ P_T & = & (P^{\textrm{short-term}}_T - P^{\textrm{long-term}}_T + P^{\textrm{long-term}}_0 - P^{\textrm{short-term}}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & P^{\textrm{short-term}}_T & = & \textrm{Shorter term put value at time T}\\ & P^{\textrm{long-term}}_T & = & \textrm{Longer term put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K & = & \textrm{Strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & P^{\textrm{short-term}}_0 & = & \textrm{Shorter term put value at position opening (debit paid)}\\ & P^{\textrm{long-term}}_0 & = & \textrm{Longer term put value at position opening (credit received)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of shorter term put expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of short put calendar spread

    The maximum profit is the net credit received, $P^{\textrm{long-term}}_0 - P^{\textrm{short-term}}_0$. It occurs when the underlying price moves very deep ITM or OTM so the values of both puts are close to zero.

    The maximum loss is undetermined because it depends on the underlying volatility. It occurs when $S_T = S_0$ and the spread of the 2 puts are at their maximum.

    If the Option is American Option, there is risk of early assignment on the sold contract. Additionally, if you don't close the put positions together, the naked short put will have unlimited drawdown risk after the long put expires.

    Example

    The following table shows the price details of the assets in the long put calendar spread algorithm:

    Asset Price ($) Strike ($)
    Shorter-term put at position opening 11.30 800.00
    Longer-term put at position opening 19.30 800.00
    Longer-term put at shorter-term expiration
    3.50 800.00
    Underlying Equity at shorter-term expiration 828.07 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} P^{\textrm{short-term}}_T & = & (K - S_T)^{+}\\ & = & (800.00-828.07)^{+}\\ & = & 0\\ P_T & = & (P^{\textrm{long-term}}_T - P^{\textrm{short-term}}_T + P^{\textrm{short-term}}_0 - P^{\textrm{long-term}}_0)\times m - fee\\ & = & (3.50-0+11.30-19.30)\times100-1.00\times2\\ & = & -452\\ \end{array} $$

    So, the strategy losses $452.

    The following algorithm implements a long put calendar spread Option strategy:

    Demonstration Algorithm
    IndexOptionPutCalendarSpreadAlgorithm.py Python IndexOptionPutCalendarSpreadAlgorithm.cs C#

     

    10.7.13 Straddle

    Introduction

    Long Straddle is an Options trading strategy that consists of buying an ATM call and an ATM put, where both contracts have the same underlying asset, strike price, and expiration date. This strategy aims to profit from volatile movements in the underlying stock, either positive or negative.

    Implementation

    Follow these steps to implement the long straddle strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 4, 1);
          SetEndDate(2017, 6, 30);
          SetCash(100000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(-1, 1, TimeSpan.FromDays(30), TimeSpan.FromDays(60));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 4, 1)
          self.SetEndDate(2017, 6, 30)
          self.SetCash(100000)
          
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(-1, 1, timedelta(30), timedelta(60))
    3. In the OnData method, select the expiration date and strike price of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Select an expiration date
          var expiry = chain.OrderBy(contract => contract.Expiry).Last().Expiry;
      
          // Select the ATM strike price
          var strike = chain.Where(contract => contract.Expiry == expiry)
                            .Select(contract => contract.Strike)
                            .OrderBy(strike => Math.Abs(strike - chain.Underlying.Price))
                            .First();
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Select an expiration date
          expiry = sorted(chain, key=lambda contract: contract.Expiry, reverse=True)[0].Expiry
      
          # Select the ATM strike price
          strikes = [contract.Strike for contract in chain if contract.Expiry == expiry]
          strike = sorted(strikes, key=lambda strike: abs(strike - chain.Underlying.Price))[0]
    5. In the OnData method, call the OptionStrategies.Straddle method and then submit the order.
    6. var optionStrategy = OptionStrategies.Straddle(_symbol, strike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.Straddle(self.symbol, strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The payoff of the strategy is

    $$ \begin{array}{rcll} C^{ATM}_T & = & (S_T - K^{C})^{+}\\ P^{ATM}_T & = & (K^{P} - S_T)^{+}\\ P_T & = & (C^{ATM}_T + P^{ATM}_T - C^{ATM}_0 - P^{ATM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{ATM}_T & = & \textrm{ATM call value at time T}\\ & P^{ATM}_T & = & \textrm{ATM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{C} & = & \textrm{ATM call strike price}\\ & K^{P} & = & \textrm{ATM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{ATM}_0 & = & \textrm{ATM call value at position opening (debit paid)}\\ & P^{ATM}_0 & = & \textrm{ATM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    Strategy payoff decomposition and analysis of long straddle

    The maximum profit is unlimited if the underlying price rises to infinity at expiration.

    The maximum loss is the net debit paid, $C^{ATM}_0 + P^{ATM}_0$. It occurs when the underlying price is the same at expiration as it was when you opened the trade. In this case, both Options expire worthless.

    Example

    The following table shows the price details of the assets in the algorithm at Option expiration (2017-05-20):

    Asset Price ($) Strike ($)
    Call 22.30 835.00
    Put 23.90 835.00
    Underlying Equity at expiration 934.01 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{ATM}_T & = & (S_T - K^{C})^{+}\\ & = & (934.01-835.00)^{+}\\ & = & 98.99\\ P^{ATM}_T & = & (K^{P} - S_T)^{+}\\ & = & (835.00-934.01)^{+}\\ & = & 0\\ P_T & = & (C^{ATM}_T + P^{ATM}_T - C^{ATM}_0 - P^{ATM}_0)\times m - fee\\ & = & (98.99+0-22.3-23.9)\times100-1.00\times2\\ & = & 5277 \end{array} $$

    So, the strategy gains $5,277.

    The following algorithm implements a long straddle Option strategy:

     

    10.7.14 Strangle

    Introduction

    Long Strangle is an Options trading strategy that consists of simultaneously buying an OTM put and an OTM call, where both contracts have the same underlying asset and expiration date. This strategy aims to profit from volatile movements in the underlying stock, either positive or negative.

    Compared to a long straddle , the net debit of a long strangle is lower since OTM Options are cheaper. Additionally, the losing range of a long straddle is wider and the strike spread is wider.

    Implementation

    Follow these steps to implement the long strangle strategy:

    1. In the Initialize method, set the start date, end date, cash, and Option universe .
    2. private Symbol _symbol;
      
      public override void Initialize()
      {
          SetStartDate(2017, 4, 1);
          SetEndDate(2017, 4, 30);
          SetCash(100000);
      
          var option = AddOption("GOOG", Resolution.Minute);
          _symbol = option.Symbol;
          option.SetFilter(-5, 5, TimeSpan.FromDays(0), TimeSpan.FromDays(30));
      }
      def Initialize(self) -> None:
          self.SetStartDate(2017, 4, 1)
          self.SetEndDate(2017, 4, 30)
          self.SetCash(100000)
          
          option = self.AddOption("GOOG", Resolution.Minute)
          self.symbol = option.Symbol
          option.SetFilter(-5, 5, timedelta(0), timedelta(30))
    3. In the OnData method, select the expiration date and strike prices of the contracts in the strategy legs.
    4. public override void OnData(Slice slice)
      {
          if (Portfolio.Invested) return;
      
          // Get the OptionChain
          var chain = slice.OptionChains.get(_symbol, null);
          if (chain == null || chain.Count() == 0) return;
      
          // Select an expiration date
          var expiry = chain.OrderBy(contract => contract.Expiry).Last().Expiry;
      
          // Select the OTM call strike
          var callStrikes = chain.Where(contract => contract.Expiry == expiry 
                                                    && contract.Right == OptionRight.Call 
                                                    && contract.Strike > chain.Underlying.Price)
                                 .Select(contract => contract.Strike);
          if (callStrikes.Count() == 0) return;
          var callStrike = callStrikes.Min();
      
          // Select the OTM put strike
          var putStrikes = chain.Where(contract => contract.Expiry == expiry 
                                                    && contract.Right == OptionRight.Put 
                                                    && contract.Strike < chain.Underlying.Price)
                                .Select(contract => contract.Strike);
          if (putStrikes.Count() == 0) return;
          var putStrike = putStrikes.Max();
      }
      def OnData(self, slice: Slice) -> None:
          if self.Portfolio.Invested: return
      
          # Get the OptionChain
          chain = slice.OptionChains.get(self.symbol, None)
          if not chain: return
      
          # Select an expiration date
          expiry = sorted(chain, key=lambda contract: contract.Expiry, reverse=True)[0].Expiry
      
          # Select the OTM call strike
          strikes = [contract.Strike for contract in chain if contract.Expiry == expiry]
          call_strikes = [contract.Strike for contract in chain 
              if contract.Expiry == expiry 
              and contract.Right == OptionRight.Call
              and contract.Strike > chain.Underlying.Price]
          if len(call_strikes) == 0: return
          call_strike = min(call_strikes)
      
          # Select the OTM put strike
          put_strikes = [contract.Strike for contract in chain 
              if contract.Expiry == expiry 
              and contract.Right == OptionRight.Put
              and contract.Strike < chain.Underlying.Price]
          if len(put_strikes) == 0: return
          put_strike = max(put_strikes)
    5. In the OnData method, call the OptionStrategies.Strangle method and then submit the order.
    6. var optionStrategy = OptionStrategies.Strangle(_symbol, callStrike, putStrike, expiry);
      Buy(optionStrategy, 1);
      option_strategy = OptionStrategies.Strangle(self.symbol, call_strike, put_strike, expiry)
      self.Buy(option_strategy, 1)

      Option strategies synchronously execute by default. To asynchronously execute Option strategies, set the asynchronous argument to False false . You can also provide a tag and order properties to the Buy methods.

      Buy(optionStrategy, quantity, asynchronous, tag, orderProperties);
      
      self.Buy(option_strategy, quantity, asynchronous, tag, order_properties)
      

    Strategy Payoff

    The payoff of the strategy is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{C})^{+}\\ P^{OTM}_T & = & (K^{P} - S_T)^{+}\\ P_T & = & (C^{OTM}_T + P^{OTM}_T - C^{OTM}_0 - P^{OTM}_0)\times m - fee \end{array} $$ $$ \begin{array}{rcll} \textrm{where} & C^{OTM}_T & = & \textrm{OTM call value at time T}\\ & P^{OTM}_T & = & \textrm{OTM put value at time T}\\ & S_T & = & \textrm{Underlying asset price at time T}\\ & K^{C} & = & \textrm{OTM call strike price}\\ & K^{P} & = & \textrm{OTM put strike price}\\ & P_T & = & \textrm{Payout total at time T}\\ & C^{OTM}_0 & = & \textrm{OTM call value at position opening (debit paid)}\\ & P^{OTM}_0 & = & \textrm{OTM put value at position opening (debit paid)}\\ & m & = & \textrm{Contract multiplier}\\ & T & = & \textrm{Time of expiration} \end{array} $$

    The following chart shows the payoff at expiration:

    long strangle strategy payoff

    The maximum profit is unlimited if the underlying price rises to infinity at expiration.

    The maximum loss is the net debit paid, $C^{OTM}_0 + P^{OTM}_0$. It occurs when the underlying price at expiration is the same as when you opened the trade. In this case, both Options expire worthless.

    Example

    The following table shows the price details of the assets in the algorithm at Option expiration (2017-04-22):

    Asset Price ($) Strike ($)
    Call 8.80 835.00
    Put 9.50 832.50
    Underlying Equity at expiration 843.19 -

    Therefore, the payoff is

    $$ \begin{array}{rcll} C^{OTM}_T & = & (S_T - K^{C})^{+}\\ & = & (843.19-835.00)^{+}\\ & = & 8.19\\ P^{OTM}_T & = & (K^{P} - S_T)^{+}\\ & = & (832.50-843.19)^{+}\\ & = & 0\\ P_T & = & (C^{OTM}_T + P^{OTM}_T - C^{OTM}_0 - P^{OTM}_0)\times m - fee\\ & = & (8.19+0-8.80-9.50)\times100-1.00\times2\\ & = & -1013 \end{array} $$

    So, the strategy losses $1,013.

    The following algorithm implements a long strangle Option strategy:

     

    10.8 Order Properties

    Introduction

    Order properties enable you to customize how the brokerage executes your orders. The DefaultOrderProperties of your algorithm sets the order properties for all of your orders. To adjust the order properties of an order, you can change the DefaultOrderProperties or pass an order properties object to the order method.

    Time In Force

    The TimeInForce property determines how long an order should remain open if it doesn't fill. This property doesn't apply to market orders since they usually fill immediately. Time in force is useful to automatically cancel old trades. The following table describes the available TimeInForce options:

    Member Example Description
    GoodTilCanceled TimeInForce.GoodTilCanceled Order is valid until filled (default)
    Day TimeInForce.Day Order is valid until filled or the market closes
    GoodTilDate(DateTime expiry) GoodTilDate(expiry: datetime) TimeInForce.GoodTilDate(new DateTime(2019, 6, 19, 12, 0, 0)) GoodTilDate(datetime(2019, 6, 19, 12, 0, 0)) Order is valid until filled or the specified expiration time

    By default, orders remain open until they are canceled ( TimeInForce.GoodTilCanceled ). To update the value, set the DefaultOrderProperties.TimeInForce before you place an order or pass an orderProperties argument to the order method.

    // Set a Limit Order to be good until market close
    DefaultOrderProperties.TimeInForce = TimeInForce.Day;
    LimitOrder("IBM", 100, 120);
    
    // Set a Limit Order to be good until noon
    LimitOrder("IBM", 100, 120, orderProperties: new OrderProperties 
    {
        TimeInForce = TimeInForce.GoodTilDate(new DateTime(2019, 6, 19, 12, 0, 0))
    });
    # Set a Limit Order to be good until market close
    self.DefaultOrderProperties.TimeInForce = TimeInForce.Day
    self.LimitOrder("IBM", 100, 120)
    
    # Set a Limit Order to be good until noon
    order_properties = OrderProperties()
    order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(2019, 6, 19, 12, 0, 0))
    self.LimitOrder("IBM", 100, 120, orderProperties=order_properties)

    If you trade a market that's open 24 hours a day with daily data, TimeInForce.Day won't work because the order cancels at the market close time but your algorithm receives daily data at midnight.

    Market on open (MOO) and market on close (MOC) orders don't support the GoodTilDate time in force. If you submit a MOO or MOC order with the GoodTilDate time in force, LEAN automatically adjusts the time in force to be GoodTilCanceled .

    The brokerage you use may not support all of the TimeInForce options. To see the options that your brokerage supports, see the Orders section of the brokerage model documentation .

    Brokerage-Specific Properties

    Some brokerages support additional order properties so you can customize how your orders execute. Some examples include the following order properties:

    To view the order properties your brokerage supports, see the Orders section of the brokerage model documentation .

    Tags

    You can tag orders to aid your strategy development. Tags can be any string of up to 100 characters. Tags aren't part of the OrderProperties object, but they are a property of the Order class you can set. To set an order tag, pass it as an argument when you create the order or use the order update methods.

    // Tag an order on creation
    var ticket = LimitOrder("SPY", 100, 221.05, tag: "Original tag");
    
    // Update the tag with UpdateTag
    ticket.UpdateTag("Updated tag");
    
    // Update the tag with UpdateOrderFields
    ticket.Update(new() { Tag = "Another tag" });
     # Tag an order on creation
    ticket = self.LimitOrder("SPY", 100, 221.05, "Original tag")
    
    # Update the tag with UpdateTag
    ticket.UpdateTag("Updated tag")
    
    # Update the tag with UpdateOrderFields
    update_settings = UpdateOrderFields()
    update_settings.Tag = "Another tag"
    ticket.Update(update_settings)

     

    10.9 Order Events

    Introduction

    An OrderEvent object represents an update to the state of an order. As the state of your orders change, we notify your algorithm with OrderEvent objects through the OnOrderEvent and OnAssignmentOrderEvent event handlers.

    Track Order Events

    Each order generates events over its life as its status changes. Your algorithm receives these events through the OnOrderEvent and OnAssignmentOrderEvent methods. The OnOrderEvent event handler receives all order events. The OnAssignmentOrderEvent receives order events for Option assignments. The event handlers receive an OrderEvent object, which contains information about the order status.

    public override void OnOrderEvent(OrderEvent orderEvent)
    {
        var order = Transactions.GetOrderById(orderEvent.OrderId);
        if (orderEvent.Status == OrderStatus.Filled)
        {
            Debug($"{Time}: {order.Type}: {orderEvent}");
        }
    }
    
    public override void OnAssignmentOrderEvent(OrderEvent assignmentEvent)
    {
        Log(assignmentEvent.ToString());
    }
    def OnOrderEvent(self, orderEvent: OrderEvent) -> None:
        order = self.Transactions.GetOrderById(orderEvent.OrderId)
        if orderEvent.Status == OrderStatus.Filled:
            self.Debug(f"{self.Time}: {order.Type}: {orderEvent}")
    
    def OnAssignmentOrderEvent(self, assignmentEvent: OrderEvent) -> None:
        self.Log(str(assignmentEvent))

    To get a list of all OrderEvent objects for an order, call the OrderEvents method of the order ticket .

    var orderEvents = orderTicket.OrderEvents();
    order_events = order_ticket.OrderEvents()

    If you don't have the order ticket, get the order ticket from the TransactionManager .

    Order States

    Orders can have any of the following states:

    Event Attributes

    The OnOrderEvent and OnAssignmentOrderEvent event handlers in your algorithm receive OrderEvent objects, which have the following attributes:

     

    10.10 Order Errors

    Introduction

    If an error occurs with one of your orders, LEAN logs the error message and stops executing.

    Types of Order Errors

    Errors can occur when you place orders or after you place them.

    Errors at Order Submission

    The following errors can occur when you submit an order:

    Errors After Order Submission

    The following errors can occur for active orders:

    Common Errors

    There are a few common order errors you may experience.

    Why is my order converted to a market on open order?

    If you place a market order when the market is closed, LEAN automatically converts the order into market on open order. This most commonly happens when you use daily or hourly data, which your algorithm can receive when the market is closed. Your algorithm receives daily bars at midnight and receives the last hourly bar of each day at 4 PM Eastern Time (ET). To avoid LEAN from converting your market order to market on open orders, submit your market orders when the market is open. To check if the market is open, call the IsMarketOpen method.

    if (IsMarketOpen(_symbol))
    {
        MarketOrder(symbol, quantity);
    }
    if self.IsMarketOpen(self.symbol):
        self.MarketOrder(self.symbol, quantity)

    Why am I seeing the "stale price" warning?

    Stale fills occur when you fill an order with price data that is timestamped an hour or more into the past. Stale fills usually only occur if you trade illiquid assets or if your algorithm uses daily data but you trade intraday with Scheduled Events. If your order is filled with stale data, the fill price may not be realistic. The pre-built fill models can only fill market orders with stale data. To adjust the length of time that needs to pass before an order is considered stale, set the StalePriceTimeSpan setting.

    Settings.StalePriceTimeSpan = TimeSpan.FromMinutes(10);
    self.Settings.StalePriceTimeSpan = timedelta(minutes=10)

    Why do I get "Backtest Handled Error: The security with symbol '/ES' is marked as non-tradable"?

    This error occurs when you place an order for a continuous Futures contract, which isn't a tradable security. To fix the issue, place the order for a specific Futures contract. To access the currently selected contract in the continuous contract series, use the Mapped property of the Future object.

    Error Code Reference

    The OrderError enumeration has the following members:

    Order Response Error Reference

    The following sections explain why each OrderResponseErrorCode occurs and how to avoid it.

    None

    The OrderResponseErrorCode.None (0) error means there is no order response error.

    Processing Error

    The OrderResponseErrorCode.ProcessingError (-1) error occurs in the following situations:

    To investigate this order response error further, see the HandleSubmitOrderRequest , UpdateOrder , and CancelOrder methods of the BrokerageTransactionHandler in the LEAN GitHub repository.

    Order Already Exists

    The OrderResponseErrorCode.OrderAlreadyExists (-2) error occurs when you submit a new order but you already have an open order or a completed order with the same order ID. This order response error usually comes from a concurrency issue.

    To avoid this order response, don't place two asynchronous orders at the same time. GitHub Issue #6736 may address the underlying problem.

    Insufficient Buying Power

    The OrderResponseErrorCode.InsufficientBuyingPower (-3) error occurs when you place an order but the buying power model determines you can't afford it.

    This error commonly occurs when you place a market on open order with daily data. If you place the order with SetHoldings or use CalculateOrderQuantity to determine the order quantity, LEAN calculates the order quantity based on the market close price. If the open price on the following day makes your order more expensive, then you may have insufficient buying power. To avoid the order response error in this case, either use intraday data and place trades when the market is open or adjust your buying power buffer .

    Settings.FreePortfolioValuePercentage = 0.05m;
    self.Settings.FreePortfolioValuePercentage = 0.05

    Brokerage Model Refused to Submit Order

    The OrderResponseErrorCode.BrokerageModelRefusedToSubmitOrder (-4) error occurs when you place an order but the brokerage model determines it's invalid. The brokerage model usually checks your order meets the following requirements before sending it to the brokerage:

    Each brokerage model can have additional order requirements that the brokerage declares. To avoid this order response error, see the Orders section of the brokerage model documentation .

    To investigate this order response error further, see the CanSubmitOrder method definition of your brokerage model . This order response error occurs when the CanSubmitOrder method returns false False .

    Brokerage Failed to Submit Order

    The OrderResponseErrorCode.BrokerageFailedToSubmitOrder (-5) error occurs when you place an order but the brokerage implementation fails to submit the order to your brokerage.

    To investigate this order response error further, see the PlaceOrder method definition of your brokerage or the BacktestingBrokerage in the LEAN GitHub repository. This order response error occurs when the PlaceOrder method throws an error or returns false .

    Brokerage Failed to Update Order

    The OrderResponseErrorCode.BrokerageFailedToUpdateOrder (-6) error occurs when you try to update an order but the brokerage implementation fails to submit the order update request to your brokerage.

    To avoid this order response error, see the Orders section of the brokerage model documentation .

    To investigate this order response error further, see the UpdateOrder method definition of your brokerage or the BacktestingBrokerage in the LEAN GitHub repository. This order response error occurs when the UpdateOrder method throws an error or returns false .

    Brokerage Failed to Cancel Order

    The OrderResponseErrorCode.BrokerageFailedToCancelOrder (-8) error occurs when you try to cancel an order but the brokerage implementation fails to submit the cancel request to your brokerage.

    To investigate this order response error further, see the CancelOrder method definition of your brokerage or the BacktestingBrokerage in the LEAN GitHub repository. This order response error occurs when CancelOrder method throws an error or returns false .

    Invalid Order Status

    The OrderResponseErrorCode.InvalidOrderStatus (-9) error occurs when you try to update or cancel an order but the order is already complete. An order is complete if it has OrderStatus.Filled , OrderStatus.Canceled , or OrderStatus.Invalid .

    To avoid this order response error, check Status of an order ticket or order event before you update or cancel the order.

    if (!_orderTicket.Status.IsClosed())
    {
        _orderTicket.Cancel();
    }
    if not OrderExtensions.IsClosed(order_ticket.Status):
        order_ticket.Cancel()

    Unable to Find Order

    The OrderResponseErrorCode.UnableToFindOrder (-10) error occurs when you try to place, update, or cancel an order, but the BrokerageTransactionHandler doesn't have a record of the order ID.

    To investigate this order response error further, see BrokerageTransactionHandler.cs in the LEAN GitHub repository. This order response error occurs when the BrokerageTransactionHandler can't find the order ID in it's _completeOrders or _completeOrderTickets dictionaries.

    Order Quantity Zero

    The OrderResponseErrorCode.OrderQuantityZero (-11) error occurs when you place an order that has zero quantity or when you update an order to have a zero quantity. This error commonly occurs if you use the SetHoldings method but the portfolio weight you provide to the method is too small to translate into a non-zero order quantity.

    To avoid this order response error, check if the quantity of the order is non-zero before you place the order. If you use the SetHoldings method, replace it with a combination of the CalculateOrderQuantity and MarketOrder methods.

    var quantity = CalculateOrderQuantity(_symbol, 0.05);
    if (quantity != 0)
    {
        MarketOrder(_symbol, quantity);
    }
    quantity = self.CalculateOrderQuantity(self.symbol, 0.05)
    if quantity:
        self.MarketOrder(self.symbol, quantity)

    Unsupported Request Type

    The OrderResponseErrorCode.UnsupportedRequestType (-12) error occurs in the following situations:

    To avoid this order response error, check the quantity of your holdings before you try to exercise an Option contract.

    var holdingQuantity = Portfolio[_contractSymbol].Quantity;
    if (holdingQuantity > 0)
    {
        ExerciseOption(_contractSymbol, Math.Max(holdingQuantity, exerciseQuantity));
    }
    holding_quantity = self.Portfolio[self.contract_symbol].Quantity
    if holding_quantity > 0:
        self.ExerciseOption(self.contract_symbol, max(holding_quantity, exercise_quantity))

    Missing Security

    The OrderResponseErrorCode.MissingSecurity (-14) error occurs when you place an order for a security but you don't have a subscription for the security in your algorithm.

    To avoid this order response error, create a subscription for each security you want to trade. To create subscriptions, see the Requesting Data page of the documentation for each asset class .

    Exchange Not Open

    The OrderResponseErrorCode.ExchangeNotOpen (-15) error occurs in the following situations:

    Security Price Zero

    The OrderResponseErrorCode.SecurityPriceZero (-16) error occurs when you place an order or exercise an Option contract while the security price is $0. The security price can be $0 for the following reasons:

    Forex Base and Quote Currencies Required

    The OrderResponseErrorCode.ForexBaseAndQuoteCurrenciesRequired (-17) error occurs when you place a trade for a Forex or Crypto pair but you don't have the base currency and quote currency in your cash book . This error should never occur. If it does, create a bug report.

    Forex Conversion Rate Zero

    The OrderResponseErrorCode.ForexConversionRateZero (-18) error occurs when you place a trade for a Forex or Crypto pair and LEAN can't convert the value of the base currency to your account currency. This error usually indicates a lack of data. Investigate the data and if there is some missing, report it .

    Security Has No Data

    The OrderResponseErrorCode.SecurityHasNoData (-19) error occurs when you place an order for a security before your algorithm receives any data for it. If you subscribe to a security and place an order for the security in the same time step , you'll get this error. To avoid this order response error, initialize the security price with the last known price.

    SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))

    Exceeded Maximum Orders

    The OrderResponseErrorCode.ExceededMaximumOrders (-20) error occurs when exceed your order quota in a backtest. The number of orders you can place in a single backtest depends on the tier of your organization . The following table shows the number of orders you can place on each tier:

    Tier Orders Quota
    Free 10K
    Quant Researcher 10M
    Team Unlimited
    Trading Firm Unlimited
    Institution Unlimited

    To avoid this order response error, reduce the number of orders in your backtest or upgrade your organization .

    Market on Close Order Too Late

    The OrderResponseErrorCode.MarketOnCloseOrderTooLate (-21) error occurs when you try to place a market on close (MOC) order too early in the trading day.

    To avoid this order response error, place the MOC order closer to the market close or adjust the submission time buffer. By default, you must place MOC orders at least 15.5 minutes before the close, but some exchanges let you submit them closer to the market closing time. To adjust the buffer period that's required, set the MarketOnCloseOrder.SubmissionTimeBuffer property.

    Orders.MarketOnCloseOrder.SubmissionTimeBuffer = TimeSpan.FromMinutes(10);
    MarketOnCloseOrder.SubmissionTimeBuffer = timedelta(minutes=10)

    Invalid Request

    The OrderResponseErrorCode.InvalidRequest (-22) error occurs when you try to cancel an order multiple times.

    To avoid this order response error, only try to cancel an order one time.

    Request Canceled

    The OrderResponseErrorCode.RequestCanceled (-23) error occurs when you try to cancel an order multiple times.

    To avoid this order response error, only try to cancel an order one time.

    Algorithm Warming Up

    The OrderResponseErrorCode.AlgorithmWarmingUp (-24) error occurs in the following situations:

    To avoid this order response error, only manage orders after the warm-up period ends. To avoid trading during the warm-up period, add an IsWarmingUp guard to the top of the OnData method.

    if (IsWarmingUp) return;
    if self.IsWarmingUp: return

    Brokerage Model Refused to Update Order

    The OrderResponseErrorCode.BrokerageModelRefusedToUpdateOrder (-25) error occurs in backtests when you try to update an order in a way that the brokerage model doesn't support.

    To avoid this issue, see the Orders section of the brokerage model documentation to check its order requirements.

    To investigate this order response error further, see the CanUpdateOrder method definition of your brokerage model .

    Quote Currency Required

    The OrderResponseErrorCode.QuoteCurrencyRequired (-26) error occurs when you place an order for a Forex or Crypto pair and don't have the quote currency of the pair in your cash book . This error should never occur. If it does, create a bug report.

    Conversion Rate Zero

    The OrderResponseErrorCode.ConversionRateZero (-27) error occurs when you place an order for a Forex or Crypto pair and LEAN can't convert the value of the quote currency in the pair to your account currency. This order response error usually indicates a lack of data. Investigate the data and if there is data missing, report it .

    Non-Tradable Security

    The OrderResponseErrorCode.NonTradableSecurity (-28) error occurs when you place an order for a security that's not tradable . To avoid this order response error, check if a security is tradable before you trade it.

    if (Securities[_symbol].IsTradable)
    {
        MarketOrder(_symbol, quantity);
    }
    if self.Securities[self.symbol].IsTradable:
        self.MarketOrder(self.symbol, quantity)

    Non-Exercisable Security

    The OrderResponseErrorCode.NonExercisableSecurity (-29) error occurs when you call the ExerciseOption method with a Symbol that doesn't reference an Option contract.

    Order Quantity Less Than Lot Size

    The OrderResponseErrorCode.OrderQuantityLessThanLotSize (-30) error occurs when you place an order with a quantity that's less than the lot size of the security.

    To avoid this order response error, check if the order quantity is greater than or equal to the security lot size before you place an order.

    var lotSize = Securities[_symbol].SymbolProperties.LotSize;
    if (quantity >= lotSize)
    {
        MarketOrder(_symbol, quantity);
    }
    lot_size = self.Securities[self.symbol].SymbolProperties.LotSize
    if quantity >= lot_size:
        self.MarketOrder(self.symbol, quantity)

    Exceeds Shortable Quantity

    The OrderResponseErrorCode.ExceedsShortableQuantity (-31) error occurs when you place an order to short a security but the shortable provider of the brokerage model states there isn't enough shares to borrow. For a full example of this error, clone and run this backtest .

    To avoid this order response error, check if there are enough shares available before you place an order to short a security.

    var availableToBorrow = BrokerageModel.GetShortableProvider().ShortableQuantity(_symbol, Time);
    if (availableToBorrow == null || quantityToBorrow <= availableToBorrow)
    {
        MarketOrder(_symbol, -quantityToBorrow);
    }
    available_to_borrow = self.BrokerageModel.GetShortableProvider().ShortableQuantity(self.symbol, self.Time)
    if available_to_borrow == None or quantity_to_borrow <= available_to_borrow:
        self.MarketOrder(self.symbol, -quantity_to_borrow)

    Invalid New Order Status

    The OrderResponseErrorCode.InvalidNewOrderStatus (-32) error occurs in live trading when you try to update or cancel an order while it still has OrderStatus.New status.

    To avoid this order response error, check the Status property of the order ticket or order event before you update or cancel an order.

    if (_orderTicket.Status != OrderStatus.New)
    {
        _orderTicket.Cancel();
    }
    if self.order_ticket.Status != OrderStatus.New:
        self.order_ticket.Cancel()

    European Option Not Expired on Exercise

    The OrderResponseErrorCode.EuropeanOptionNotExpiredOnExercise (-33) error occurs when you try to exercise a European Option contract before its expiry date.

    To avoid this order response error, check the type and expiry date of the contract before you exercise it.

    if (_contractSymbol.ID.OptionStyle == OptionStyle.European && _contractSymbol.ID.Date == Time.Date)
    {
        ExerciseOption(_contractSymbol, quantity);
    }
    if (self.contract_symbol.ID.OptionStyle == OptionStyle.European && self.contract_symbol.ID.Date == self.Time.Date)
    {
        self.ExerciseOption(self.contract_symbol, quantity);
    }

     

    10.11 Trade Statistics

    Introduction

    The TradeBuilder tracks the trades of your algorithm and calculates some statistics. You can adjust how it defines a trade and how it matches offsetting order fills.

    Set Trade Builder

    To set the TradeBuilder , in the Initialize method, call the SetTradeBuilder method.

    SetTradeBuilder(new TradeBuilder(groupingMethod, matchingMethod));
    self.SetTradeBuilder(TradeBuilder(groupingMethod, matchingMethod))

    The following table describes the arguments the TradeBuilder constructor accepts:

    Argument Data Type Description Default Value
    groupingMethod FillGroupingMethod The method used to group order fills into trades
    matchingMethod FillMatchingMethod The method used to match offsetting order fills

    The FillGroupingMethod enumeration has the following members:

    The FillMatchingMethod enumeration has the following members:

    Default Behavior

    The default TradeBuilder uses FillGroupingMethod.FillToFill and FillMatchingMethod.FIFO .

    Check Open Positions

    To check if you have a position open for a security as defined by the FillGroupingMethod , call the HasOpenPosition method.

    var hasOpenPosition = TradeBuilder.HasOpenPosition(_symbol);
    has_open_position = self.TradeBuilder.HasOpenPosition(self.symbol)

    Get Closed Trades

    To get your closed trades, use the ClosedTrades property.

    var trades = TradeBuilder.ClosedTrades;
    trades = self.TradeBuilder.ClosedTrades

    This property returns a list of Trade objects, which have the following attributes:

     

    10.12 Trading Calendar

    Introduction

    The TradingCalendar contains a variety of events relevant to the assets in your algorithm. We source the event data from Quantlib .

    Trading Day Properties

    TradingDay objects represent the trading events of a single day. They have the following properties:

    Get a Single Trading Day

    To get the trading events of the current day, call the GetTradingDay method with no arguments.

    var tradingDay = TradingCalendar.GetTradingDay();
    trading_day = self.TradingCalendar.GetTradingDay()

    To get the trading events of a specific day, pass a DateTime datetime object to the GetTradingDay method.

    var tradingDay = TradingCalendar.GetTradingDay(new DateTime(2022, 6, 1));
    trading_day = self.TradingCalendar.GetTradingDay(datetime(2022, 6, 1))

    Get Trading Days

    To get all the trading events across a range of dates, pass start and end DateTime datetime objects to the GetTradingDays method.

    var startDate = new DateTime(2022, 6, 1);
    var endDate = new DateTime(2022, 7, 1);
    var tradingDays = TradingCalendar.GetTradingDays(startDate, endDate);
    start_date = datetime(2022, 6, 1)
    end_date = datetime(2022, 7, 1)
    trading_days = self.TradingCalendar.GetTradingDays(start_date, end_date)

    To get specific trading events across a range of dates, pass a TradingDayType enumeration member and the dates to the GetDaysByType method.

    var tradingDays = TradingCalendar.GetDaysByType(TradingDayType.OptionExpiration, startDate, endDate);
    trading_days = self.TradingCalendar.GetDaysByType(TradingDayType.OptionExpiration, start_date, end_date)

    The TradingDayType enumeration has the following members:

     

    10.13 Financial Advisors

    Introduction

    Financial Advisor accounts enable certified professionals to use a single trading algorithm to manage several client accounts. Our Interactive Brokers integration enables you to place FA group orders.

    Group Routing

    To place trades using a subset of client accounts, create Account Groups in Trader Workstation and then define the InteractiveBrokersOrderProperties when you create orders.

    DefaultOrderProperties = new InteractiveBrokersOrderProperties
    {
        FaGroup = "TestGroupEQ",
        FaMethod = "EqualQuantity",
        FaProfile = "TestProfileP",
        Account = "DU123456"
    };
    self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
    self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
    self.DefaultOrderProperties.FaMethod = "EqualQuantity"
    self.DefaultOrderProperties.FaProfile = "TestProfileP"
    self.DefaultOrderProperties.Account = "DU123456"

    SecurityHolding objects aggregate your positions across all the account groups. If you have two groups where group A has 10 shares of SPY and group B has -10 shares of SPY, then self.Portfolio["SPY"].Quantity Portfolio["SPY"].Quantity is zero.

    Allocation Methods

    The following table shows the supported allocation methods for FA group orders:

    FaMethod Description
    "EqualQuantity" Distributes shares equally between all accounts in the group. If you use this method, specify an order quantity.
    "NetLiq" Distributes shares based on the net liquidation value of each account. The system calculates ratios based on the net liquidation value in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "AvailableEquity" Distributes shares based on the amount of available equity in each account. The system calculates ratios based on the available equity in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "PctChange" Increases or decreases an already existing position. Positive percents increase positions and negative percents decrease positions. If you use this method, specify a percent instead of an order quantity.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new InteractiveBrokersOrderProperties()
        {
            FaGroup = "TestGroupEQ",
            FaMethod = "EqualQuantity",
            FaProfile = "TestProfileP",
            Account = "DU123456"
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
    
        // Override the default order properties
        // "NetLiq" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "NetLiq" 
                   });
    
        // "AvailableEquity" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "AvailableEquity" 
                   });
        
        // "PctChange" requires a percentage of portfolio input
        SetHoldings(_symbol, pctPortfolio,
                    orderProperties: new InteractiveBrokersOrderProperties
                    { 
                        FaMethod = "PctChange" 
                    });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
        self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
        self.DefaultOrderProperties.FaMethod = "EqualQuantity"
        self.DefaultOrderProperties.FaProfile = "TestProfileP"
        self.DefaultOrderProperties.Account = "DU123456"
    
    def OnData(self, slice: Slice) -> None:
        # Override the default order properties
        # "NetLiq" requires a order size input
        order_properties = InteractiveBrokersOrderProperties()
        order_properties.FaMethod = "NetLiq"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "AvailableEquity" requires a order size input
        order_properties.FaMethod = "AvailableEquity"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "PctChange" requires a percentage of portfolio input
        order_properties.FaMethod = "PctChange"
        self.SetHoldings(self.symbol, pct_portfolio, orderProperties=order_properties)

    Subscription Requirements

    To use FA group orders through our Interactive Brokers integration, you need to connect as a member of a Trading Firm and Institution organization. If you aren't currently on either of these tiers, upgrade your organization .

     

    11 Reality Modeling

    11.1 Key Concepts

    Introduction

    Reality models make backtests as realistic as possible to how the strategy would perform in live trading. These reality models model the behavior of things like the portfolio, brokerage, fills, slippage, options, and strategy capacity . Some reality models are set on a security basis and some are set at the portfolio level. The default models assume you trade highly liquid assets. If you trade high volumes or on illiquid assets, you should create custom reality models to be more realistic.

    Security Level Models

    LEAN's philosophy is to make the models per security as much as possible. The following models are security-level models:

    To set a security-level reality model, call the set reality model method on the Security object. To get the correct method, see the preceding documentation page for each type of model.

    // Set IBM to have a constant $1 transaction fee 
    Securities["IBM"].SetFeeModel(new ConstantFeeModel(1)); 
    # Set IBM to have a constant $1 transaction fee
    self.Securities["IBM"].SetFeeModel(ConstantFeeModel(1))

    You can also set the security-specific models inside a security initializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetFeeModel(new ConstantFeeModel(1));    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetFeeModel(ConstantFeeModel(1))

    Portfolio Level Models

    A portfolio is a semi-closed system where the state updates over time as the value and quantity of assets in the portfolio fluctuate. It's a semi-closed system because the portfolio usually incurs transaction fees and you can add and deposit capital from the portfolio. LEAN models the portfolio holdings to track and update the average price of each asset with every transaction.

    At the portfolio level, you can set the margin call model .

    Portfolio.SetMarginCallModel(new DefaultMarginCallModel(Portfolio, DefaultOrderProperties));
    
    self.Portfolio.SetMarginCallModel(DefaultMarginCallModel(self.Portfolio, self.DefaultOrderProperties))

     

    11.2 Trade Fills

    11.2.1 Key Concepts

    Introduction

    A trade fill is the quantity and price at which your brokerage executes your order in the market. Fill models model how each type of order fills to accurately simulate the behavior of a real brokerage. Fill models determine the price and quantity of your fills, can incorporate spread costs, and work with the slippage model to add slippage into the fill price. If you trade US Equities, our built-in fill models can fill your orders at the official opening and closing auction prices .

    Set Models

    The brokerage model of your algorithm automatically sets the fill model for each security, but you can override it. To manually set the fill model of a security, call the SetFillModel method on the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    security.SetFillModel(new ImmediateFillModel());
    # In Initialize
    security = self.AddEquity("SPY")
    security.SetFillModel(ImmediateFillModel())

    You can also set the fill model in a security initializer . If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetFillModel(new ImmediateFillModel());    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetFillModel(ImmediateFillModel())

    To view all the pre-built fill models, see Supported Models .

    Default Behavior

    The brokerage model of your algorithm automatically sets the fill model of each security. The default brokerage model is the DefaultBrokerageModel , which sets the EquityFillModel for Equities, the FutureFillModel for Futures, the FutureOptionFillModel for Future Options, and the ImmediateFillModel for all other asset classes.

    Model Structure

    Fill Models should extend the FillModel class. To implement your own fill model, override the methods in the FillModel class you wish to change. The class has a dedicated method for each order type. The method receives a Security and Order object and returns an OrderEvent object that contains information about the order status, fill quantity, and errors.

    public class MyFillModel : FillModel {
    
        public override OrderEvent MarketFill(Security asset, MarketOrder order) {
            return base.MarketFill(asset, order);
        }
    
        public override OrderEvent LimitFill(Security asset, LimitOrder order) {
            return base.LimitFill(asset, order);
        }
    
        public override OrderEvent LimitIfTouchedFill(Security asset, LimitIfTouchOrder order) {
            return base.LimitIfTouchedFill(asset, order);
        }
    
        public override OrderEvent StopMarketFill(Security asset, StopMarketOrder order) {
            return base.StopMarketFill(asset, order);
        }
    
        public override OrderEvent StopLimitFill(Security asset, StopLimitOrder order) {
            return base.StopLimitFill(asset, order);
        }
    
        public override OrderEvent MarketOnOpenFill(Security asset, MarketOnOpenOrder order) {
            return base.MarketOnOpenFill(asset, order);
        }
    
        public override OrderEvent MarketOnCloseFill(Security asset, MarketOnCloseOrder order) {
            return base.MarketOnCloseFill(asset, order);
        }
    }
    
    class MyFillModel(FillModel):
    
        def MarketFill(self, asset: Security, order: MarketOrder) -> OrderEvent:
            return super().MarketFill(asset, order)
    
        def LimitFill(self, asse: Securityt, order: LimitOrder) -> OrderEvent:
            return super().LimitFill(asset, order)
    
        def LimitIfTouchedFill(self, asset: Security, order: LimitIfTouchOrder) -> OrderEvent:
            return super().LimitIfTouchedFill(asset, order)
    
        def StopMarketFill(self, asset: Security, order: StopMarketOrder) -> OrderEvent:
            return super().StopMarketFill(asset, order)
    
        def StopLimitFill(self, asset: Security, order: StopLimitOrder) -> OrderEvent:
            return super().StopLimitFill(asset, order)
    
        def MarketOnOpenFill(self, asset: Security, order: MarketOnOpenOrder) -> OrderEvent:
            return super().MarketOnOpenFill(asset, order)
    
        def MarketOnCloseFill(self, asset: Security, order: MarketOnCloseOrder) -> OrderEvent:
            return super().MarketOnCloseFill(asset, order)
    

    Partial Fills

    In live trading, your orders can partially fill. For example, if you have a buy limit order at the bid price for 100 shares and someone sells 10 shares with a market order, your order is partially filled. In backtests, the pre-built fill models assume orders completely fill. To simulate partial fills in backtests, create a custom fill model.

    Stale Fills

    Stale fills occur when you fill an order with price data that is timestamped an hour or more into the past. Stale fills usually only occur if you trade illiquid assets or if your algorithm uses daily data but you trade intraday with Scheduled Events. If your order is filled with stale data, the fill price may not be realistic. The pre-built fill models can only fill market orders with stale data. To adjust the length of time that needs to pass before an order is considered stale, set the StalePriceTimeSpan setting.

    Settings.StalePriceTimeSpan = TimeSpan.FromMinutes(10);
    self.Settings.StalePriceTimeSpan = timedelta(minutes=10)

    Examples

    Demonstration Algorithms
    CustomModelsAlgorithm.py Python CustomPartialFillModelAlgorithm.py Python ForwardDataOnlyFillModelAlgorithm.py Python CustomModelsAlgorithm.cs C# CustomPartialFillModelAlgorithm.cs C# ForwardDataOnlyFillModelAlgorithm.cs C#

     

    11.2.2 Supported Models

    Fill models determine the price and quantity of your fills. The following fill models are available:

    See Also

    Reality Modeling
    Order Types

     

    11.2.2.1 Equity Model

    Introduction

    The EquityFillModel is the default fill model if you trade Equity assets with the DefaultBrokerageModel . This fill model fills trades completely and immediately.

    security.SetFillModel(new EquityFillModel());
    security.SetFillModel(EquityFillModel())

    The fill logic of each order depends on the order type, the data format of the security subscription, and the order direction. The following sections explain the fill logic of each order given these factors.

    To view the implementation of this model, see the LEAN GitHub repository .

    Market Orders

    The model fills buy market orders at the best effort ask price plus slippage and fills sell market orders at the best effort bid price minus slippage.

    To get the best effort bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the best effort ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the best effort bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    The model only fills market orders during regular trading hours.

    Limit Orders

    To fill limit orders, the model first gets the best effort TradeBar . To get the best effort TradeBar , the model checks the resolution of your security subscription. If your subscription provies Tick data, it gets the most recent back of trade ticks and consolidates them to build a TradeBar . If your subscription provies TradeBar data, it gets the most recent TradeBar . If the EndTime of the best effort TradeBar is less than or equal to the time you placed the order, the model waits until the next best effort TradeBar to fill the order.

    Once the model has a valid best effort TradeBar , it can fill the order. The following table shows the fill condition and fill price of limit orders. The model only fills the order once the fill condition is met.

    Order Direction Fill Condition Fill Price
    Buy low price < limit price min(open price, limit price)
    Sell high price > limit price max(open price, limit price)

    The model only fills limit orders when the exchange is open.

    The model won't fill limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Limit if Touched Orders

    To fill limit if touched orders, the model first gets the best effort TradeBar . To get the best effort TradeBar , the model checks the resolution of your security subscription. If your subscription provies Tick data, it gets the most recent back of trade ticks and consolidates them to build a TradeBar . If your subscription provies TradeBar data, it gets the most recent TradeBar . If the EndTime of the best effort TradeBar is less than or equal to the time you placed the order, the model waits until the next best effort TradeBar to fill the order.

    After the model has a valid best effort TradeBar , it can check if the trigger price has been touched. The following table describes the trigger condition of limit if touched orders for each order direction:

    Order Direction Trigger Condition
    Buy low price <= trigger price
    Sell high price >= trigger price

    Once the limit if touched order triggers, the model starts to check if it should fill the order. The following table shows the fill condition and fill price of limit if touched orders. The model only fills the order once the fill condition is met

    Order Direction Fill Condition Fill Price
    Buy Best effort ask price <= limit price
    min(best effort ask price, limit price)
    Sell Best effort bid price >= limit price
    max(best effort bid price, limit price)

    To get the best effort bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the best effort ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the best effort bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    The model only fills limit orders when the exchange is open.

    The model won't trigger or fill limit if touched orders with stale data .

    Stop Market Orders

    To fill stop market orders, the model first gets the best effort TradeBar . To get the best effort TradeBar , the model checks the resolution of your security subscription. If your subscription provies Tick data, it gets the most recent back of trade ticks and consolidates them to build a TradeBar . If your subscription provies TradeBar data, it gets the most recent TradeBar . If the EndTime of the best effort TradeBar is less than or equal to the time you placed the order, the model waits until the next best effort TradeBar to fill the order.

    Once the stop condition is met, the model fills the orders and sets the fill price.

    Once the model has a valid best effort TradeBar , it can fill the order. The following table shows the stop condition and fill price of stop market orders. The model only fills the order once the stop condition is met.

    Order Direction Fill Condition Fill Price
    Buy high price >= stop price max(open price, stop price) + slippage
    Sell low price <= stop price min(open price, stop price) - slippage

    The model only fills stop market orders during regular trading hours.

    The model won't fill stop market orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Limit Orders

    The fill logic of stop limit orders depends on the data format of the security subscription and the order direction. The following table shows the fill price of stop limit orders given these factors. To determine the fill price of the order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    The following table describes how the fill model processes the order given the data format and order direction. Once the stop condition is met, the model starts to check the fill condition. Once the fill condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Condition Fill Price
    Tick Quote Buy quote price > stop price quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price < stop price quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price > stop price trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price < stop price trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask high price > stop price ask close price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid low price < stop price bid close price > limit price max(bid low price, limit price)
    TradeBar
    Buy high price > stop price close price < limit price min(high price, limit price)
    TradeBar
    Sell low price < stop price close price > limit price max(low price, limit price)

    The model won't fill stop limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    The model only fills stop limit orders when the exchange is open.

    Market on Open Orders

    The following table describes the fill price of market on open orders for each data format and order direction:

    Data Format Order Direction Fill Price
    Tick Buy If the model receives the official opening auction price within one minute, the order fills at official open price + slippage. After one minute, the order fills at the most recent trade price + slippage. If the security doesn't trade within the first two minutes, the order fills at the best effort ask price + slippage.
    Tick Sell If the model receives the official opening auction price within one minute, the order fills at the official open price - slippage. After one minute, the order fills at the most recent trade price - slippage. If the security doesn't trade within the first two minutes, the order fills at the best effort bid price - slippage.
    TradeBar Buy Open price + slippage
    TradeBar Sell Open price - slippage
    QuoteBar Buy Best effort ask price + slippage
    QuoteBar Sell Best effort bid price - slippage

    The model checks the data format in the following order:

    1. Tick
    2. TradeBar
    3. QuoteBar

    To get the best effort bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the best effort ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the best effort bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Market on Close Orders

    The following table describes the fill price of market on close orders for each data format and order direction:

    Data Format Order Direction Fill Price
    Tick Buy If the model receives the official closing auction price within one minute after the close, the order fills at official close price + slippage. After one minute, the order fills at the most recent trade price + slippage. If the security doesn't trade within the first two minutes, the order fills at the best effort ask price + slippage.
    Tick Sell If the model receives the official closing auction price within one minute after the close, the order fills at the official close price - slippage. After one minute, the order fills at the most recent trade price - slippage. If the security doesn't trade within the first two minutes after the close, the order fills at the best effort bid price - slippage.
    TradeBar Buy Open price + slippage
    TradeBar Sell Open price - slippage
    QuoteBar Buy Best effort ask price + slippage
    QuoteBar Sell Best effort bid price - slippage

    The model checks the data format in the following order:

    1. Tick
    2. TradeBar
    3. QuoteBar

    To get the best effort bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the best effort ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the best effort bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Combo Market Orders

    The fill logic of combo market orders depends on the data format of the security subscription and the order direction. The following table shows the fill price of combo market orders given these factors. To determine the fill price of the order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy Ask quote price + slippage
    Tick Quote Sell Bid quote price - slippage
    Tick Trade Buy Trade price + slippage
    Tick Trade Sell Trade price - slippage
    QuoteBar
    Buy Ask close price + slippage
    QuoteBar
    Sell Bid close price - slippage
    TradeBar
    Buy Close price + slippage
    TradeBar
    Sell Close price - slippage

    The model only fills combo market orders if all the following conditions are met:

    The fill quantity of each leg is the product of the leg order quantity and the combo market order quantity.

    Combo Limit Orders

    The fill logic of combo limit orders depends on the data format of the security subscription and the order direction. To determine the fill price of the order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    To fill combo limit orders, the fill model calculates the aggregate price of the combo order, which is the sum of prices for each security in the order legs. The price of each security is a function of the data format and order direction. Legs with a positive order quantity increase the aggregate price and legs with a negative quantity decrease the aggregate price. The following table shows how the fill model calculates the security prices.

    Data Format TickType Combo Order Direction Leg Order Direction Price
    Tick Quote Buy or sell Buy Ask price
    Tick Quote Buy or sell Sell Bid price
    Tick Trade Buy or sell Buy or sell Trade price
    QuoteBar Buy Buy Ask low price
    QuoteBar Buy Sell Bid low price
    QuoteBar Sell Buy Ask high price
    QuoteBar Sell Sell Bid high price
    TradeBar Buy Buy or sell Low price
    TradeBar Sell Buy or sell High price

    After the fill model calculates the aggregate price of the combo order, it checks if it should fill the order. The following table describes the fill condition of the combo order and the fill price price of each leg:

    Data Format TickType Combo Order Direction Fill Condition Leg Order Direction Fill Price
    Tick Quote Buy Aggregate price < combo limit price Buy or sell Quote price
    Tick Quote Sell Aggregate price > combo limit price Buy or sell Quote price
    Tick Trade Buy Aggregate price < combo limit price Buy or sell Trade price
    Tick Trade Sell Aggregate price > combo limit price Buy or sell Trade price
    QuoteBar
    Buy Aggregate price < combo limit price Buy Ask low price
    QuoteBar
    Buy Aggregate price < combo limit price Sell Bid low price
    QuoteBar
    Sell Aggregate price > combo limit price Buy Ask high price
    QuoteBar
    Sell Aggregate price > combo limit price Sell Bid high price
    TradeBar
    Buy Aggregate price < combo limit price Buy or sell Low price
    TradeBar
    Sell Aggregate price > combo limit price Buy or sell High price

    The model only fills combo limit orders if the data isn't stale and all the legs can fill in the same time step after the order time step. The fill quantity of each leg is the product of the leg order quantity and the combo order quantity.

    Combo Leg Limit Orders

    The fill logic of combo leg limit orders depends on the data format of the security subscription and the order direction. The following table shows the fill price of combo leg limit orders given these factors. To determine the fill price of the order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    The order direction in the table represents the order direction of the order leg, not the order direction of the combo order.

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy Ask price < limit price min(ask price, limit price)
    Tick Quote Sell Bid price > limit price max(bid price, limit price)
    Tick Trade Buy Trade price < limit price min(trade price, limit price)
    Tick Trade Sell Trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy Ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell Bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy Low price < limit price min(high price, limit price)
    TradeBar
    Sell High price > limit price max(low price, limit price)

    The model only fills combo leg limit orders if all the following conditions are met:

    The fill quantity is the product of the leg order quantity and the combo order quantity.

     

    11.2.2.2 Future Model

    Introduction

    The FutureFillModel is the default fill model if you trade Futures contracts with the DefaultBrokerageModel . This fill model fills trades completely and immediately.

    security.SetFillModel(new FutureFillModel());
    security.SetFillModel(FutureFillModel())

    The fill logic of each order depends on the order type, the data format of the security subscription, and the order direction. The following tables show the fill price of each order given these factors. To determine the fill price of an order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    To view the implementation of this model, see the LEAN GitHub repository .

    Market Orders

    The following table describes the fill price of market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model only fills market orders if the exchange is open and it immediately fills them. If your algorithm places a market order at 10 AM, it fills at 10 AM.

    Limit Orders

    The following table describes the fill logic of limit orders for each data format and order direction:

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy low price < limit price min(high price, limit price)
    TradeBar
    Sell high price > limit price max(low price, limit price)

    The model won't fill limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Limit if Touched Orders

    The model converts a limit if touched order to a limit order when the trigger condition is met. The following table describes the trigger condition of limit if touched orders for each data format and order direction:

    Data Format TickType Order Direction Trigger Condition
    Tick Quote Buy quote price <= trigger price
    Tick Quote Sell quote price >= trigger price
    Tick Trade Buy trade price <= trigger price
    Tick Trade Sell trade price >= trigger price
    TradeBar
    Buy low price <= trigger price
    TradeBar
    Sell high price >= trigger price

    Once the limit if touched order triggers, to fill the order, the model checks the bid price for buy orders and the ask price for sell orders.

    To get the bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Buy orders fill when the bid price <= limit price and sell orders fill when the ask price >= limit price. The order fills at the limit price. The model won't trigger or fill limit if touched orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Market Orders

    The following table describes the fill logic of stop market orders for each data format and order direction. Once the stop condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Price
    Tick Quote Buy quote price > stop price max(stop price, quote price + slippage)
    Tick Quote Sell quote price < stop price min(stop price, quote price - slippage)
    Tick Trade Buy trade price > stop price max(stop price, last trade price + slippage)
    Tick Trade Sell trade price < stop price min(stop price, last trade price - slippage)
    QuoteBar
    Buy ask high price > stop price max(stop price, ask close price + slippage)
    QuoteBar
    Sell bid low price < stop price min(stop price, bid close price - slippage)
    TradeBar
    Buy high price > stop price max(stop price, close price + slippage)
    TradeBar
    Sell low price < stop price min(stop price, close price - slippage)

    The model only fills stop market orders when the exchange is open.

    The model won't fill stop market orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Limit Orders

    The following table describes the fill logic of stop limit orders for each data format and order direction. Once the stop condition is met, the model starts to check the fill condition. Once the fill condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Condition Fill Price
    Tick Quote Buy quote price > stop price quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price < stop price quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price > stop price trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price < stop price trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask high price > stop price ask close price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid low price < stop price bid close price > limit price max(bid low price, limit price)
    TradeBar
    Buy high price > stop price close price < limit price min(high price, limit price)
    TradeBar
    Sell low price < stop price close price > limit price max(low price, limit price)

    The model won't fill stop limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Open Orders

    The following table describes the fill price of market on open orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask open price + slippage
    QuoteBar
    Sell bid open price - slippage
    TradeBar
    Buy open price + slippage
    TradeBar
    Sell open price - slippage

    The model won't fill market on open orders during pre-market hours.

    The model won't fill market on open orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Close Orders

    The following table describes the fill price of market on close orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model won't fill market on close orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Combo Market Orders

    The following table describes the fill price of combo market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy Ask quote price + slippage
    Tick Quote Sell Bid quote price - slippage
    Tick Trade Buy Trade price + slippage
    Tick Trade Sell Trade price - slippage
    QuoteBar
    Buy Ask close price + slippage
    QuoteBar
    Sell Bid close price - slippage
    TradeBar
    Buy Close price + slippage
    TradeBar
    Sell Close price - slippage

    The model only fills combo market orders if all the following conditions are met:

    The fill quantity of each leg is the product of the leg order quantity and the combo market order quantity.

    Combo Limit Orders

    To fill combo limit orders, the fill model calculates the aggregate price of the combo order, which is the sum of prices for each security in the order legs. The price of each security is a function of the data format and order direction. Legs with a positive order quantity increase the aggregate price and legs with a negative quantity decrease the aggregate price. The following table shows how the fill model calculates the security prices.

    Data Format TickType Combo Order Direction Leg Order Direction Price
    Tick Quote Buy or sell Buy Ask price
    Tick Quote Buy or sell Sell Bid price
    Tick Trade Buy or sell Buy or sell Trade price
    QuoteBar Buy Buy Ask low price
    QuoteBar Buy Sell Bid low price
    QuoteBar Sell Buy Ask high price
    QuoteBar Sell Sell Bid high price
    TradeBar Buy Buy or sell Low price
    TradeBar Sell Buy or sell High price

    After the fill model calculates the aggregate price of the combo order, it checks if it should fill the order. The following table describes the fill condition of the combo order and the fill price price of each leg:

    Data Format TickType Combo Order Direction Fill Condition Leg Order Direction Fill Price
    Tick Quote Buy Aggregate price < combo limit price Buy or sell Quote price
    Tick Quote Sell Aggregate price > combo limit price Buy or sell Quote price
    Tick Trade Buy Aggregate price < combo limit price Buy or sell Trade price
    Tick Trade Sell Aggregate price > combo limit price Buy or sell Trade price
    QuoteBar
    Buy Aggregate price < combo limit price Buy Ask low price
    QuoteBar
    Buy Aggregate price < combo limit price Sell Bid low price
    QuoteBar
    Sell Aggregate price > combo limit price Buy Ask high price
    QuoteBar
    Sell Aggregate price > combo limit price Sell Bid high price
    TradeBar
    Buy Aggregate price < combo limit price Buy or sell Low price
    TradeBar
    Sell Aggregate price > combo limit price Buy or sell High price

    The model only fills combo limit orders if the data isn't stale and all the legs can fill in the same time step after the order time step. The fill quantity of each leg is the product of the leg order quantity and the combo order quantity.

    Combo Leg Limit Orders

    The following table describes the fill logic of combo leg limit orders for each data format and order direction. The order direction in the table represents the order direction of the order leg, not the order direction of the combo order.

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy Ask price < limit price min(ask price, limit price)
    Tick Quote Sell Bid price > limit price max(bid price, limit price)
    Tick Trade Buy Trade price < limit price min(trade price, limit price)
    Tick Trade Sell Trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy Ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell Bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy Low price < limit price min(high price, limit price)
    TradeBar
    Sell High price > limit price max(low price, limit price)

    The model only fills combo leg limit orders if all the following conditions are met:

    The fill quantity is the product of the leg order quantity and the combo order quantity.

     

    11.2.2.3 Future Option Model

    Introduction

    The FutureOptionFillModel is the default fill model if you trade Future Option contracts with the DefaultBrokerageModel . This fill model fills trades completely and immediately.

    security.SetFillModel(new FutureOptionFillModel());
    security.SetFillModel(FutureOptionFillModel())

    The fill logic of each order depends on the order type, the data format of the security subscription, and the order direction. The following tables show the fill price of each order given these factors. To determine the fill price of an order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    To view the implementation of this model, see the LEAN GitHub repository .

    Market Orders

    The following table describes the fill price of market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model only fills market orders if the exchange is open and it immediately fills them. If your algorithm places a market order at 10 AM, it fills at 10 AM.

    Limit Orders

    The following table describes the fill logic of limit orders for each data format and order direction:

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy low price < limit price min(high price, limit price)
    TradeBar
    Sell high price > limit price max(low price, limit price)

    The model won't fill limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Limit if Touched Orders

    The model converts a limit if touched order to a limit order when the trigger condition is met. The following table describes the trigger condition of limit if touched orders for each data format and order direction:

    Data Format TickType Order Direction Trigger Condition
    Tick Quote Buy quote price <= trigger price
    Tick Quote Sell quote price >= trigger price
    Tick Trade Buy trade price <= trigger price
    Tick Trade Sell trade price >= trigger price
    TradeBar
    Buy low price <= trigger price
    TradeBar
    Sell high price >= trigger price

    Once the limit if touched order triggers, to fill the order, the model checks the bid price for buy orders and the ask price for sell orders.

    To get the bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Buy orders fill when the bid price <= limit price and sell orders fill when the ask price >= limit price. The order fills at the limit price. The model won't trigger or fill limit if touched orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Market Orders

    The following table describes the fill logic of stop market orders for each data format and order direction. Once the stop condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Price
    Tick Quote Buy quote price > stop price max(stop price, quote price + slippage)
    Tick Quote Sell quote price < stop price min(stop price, quote price - slippage)
    Tick Trade Buy trade price > stop price max(stop price, last trade price + slippage)
    Tick Trade Sell trade price < stop price min(stop price, last trade price - slippage)
    QuoteBar
    Buy ask high price > stop price max(stop price, ask close price + slippage)
    QuoteBar
    Sell bid low price < stop price min(stop price, bid close price - slippage)
    TradeBar
    Buy high price > stop price max(stop price, close price + slippage)
    TradeBar
    Sell low price < stop price min(stop price, close price - slippage)

    The model only fills stop market orders when the exchange is open.

    The model won't fill stop market orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Limit Orders

    The following table describes the fill logic of stop limit orders for each data format and order direction. Once the stop condition is met, the model starts to check the fill condition. Once the fill condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Condition Fill Price
    Tick Quote Buy quote price > stop price quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price < stop price quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price > stop price trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price < stop price trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask high price > stop price ask close price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid low price < stop price bid close price > limit price max(bid low price, limit price)
    TradeBar
    Buy high price > stop price close price < limit price min(high price, limit price)
    TradeBar
    Sell low price < stop price close price > limit price max(low price, limit price)

    The model won't fill stop limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Open Orders

    The following table describes the fill price of market on open orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask open price + slippage
    QuoteBar
    Sell bid open price - slippage
    TradeBar
    Buy open price + slippage
    TradeBar
    Sell open price - slippage

    The model won't fill market on open orders during pre-market hours.

    The model won't fill market on open orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Close Orders

    The following table describes the fill price of market on close orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model won't fill market on close orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Combo Market Orders

    The following table describes the fill price of combo market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy Ask quote price + slippage
    Tick Quote Sell Bid quote price - slippage
    Tick Trade Buy Trade price + slippage
    Tick Trade Sell Trade price - slippage
    QuoteBar
    Buy Ask close price + slippage
    QuoteBar
    Sell Bid close price - slippage
    TradeBar
    Buy Close price + slippage
    TradeBar
    Sell Close price - slippage

    The model only fills combo market orders if all the following conditions are met:

    The fill quantity of each leg is the product of the leg order quantity and the combo market order quantity.

    Combo Limit Orders

    To fill combo limit orders, the fill model calculates the aggregate price of the combo order, which is the sum of prices for each security in the order legs. The price of each security is a function of the data format and order direction. Legs with a positive order quantity increase the aggregate price and legs with a negative quantity decrease the aggregate price. The following table shows how the fill model calculates the security prices.

    Data Format TickType Combo Order Direction Leg Order Direction Price
    Tick Quote Buy or sell Buy Ask price
    Tick Quote Buy or sell Sell Bid price
    Tick Trade Buy or sell Buy or sell Trade price
    QuoteBar Buy Buy Ask low price
    QuoteBar Buy Sell Bid low price
    QuoteBar Sell Buy Ask high price
    QuoteBar Sell Sell Bid high price
    TradeBar Buy Buy or sell Low price
    TradeBar Sell Buy or sell High price

    After the fill model calculates the aggregate price of the combo order, it checks if it should fill the order. The following table describes the fill condition of the combo order and the fill price price of each leg:

    Data Format TickType Combo Order Direction Fill Condition Leg Order Direction Fill Price
    Tick Quote Buy Aggregate price < combo limit price Buy or sell Quote price
    Tick Quote Sell Aggregate price > combo limit price Buy or sell Quote price
    Tick Trade Buy Aggregate price < combo limit price Buy or sell Trade price
    Tick Trade Sell Aggregate price > combo limit price Buy or sell Trade price
    QuoteBar
    Buy Aggregate price < combo limit price Buy Ask low price
    QuoteBar
    Buy Aggregate price < combo limit price Sell Bid low price
    QuoteBar
    Sell Aggregate price > combo limit price Buy Ask high price
    QuoteBar
    Sell Aggregate price > combo limit price Sell Bid high price
    TradeBar
    Buy Aggregate price < combo limit price Buy or sell Low price
    TradeBar
    Sell Aggregate price > combo limit price Buy or sell High price

    The model only fills combo limit orders if the data isn't stale and all the legs can fill in the same time step after the order time step. The fill quantity of each leg is the product of the leg order quantity and the combo order quantity.

    Combo Leg Limit Orders

    The following table describes the fill logic of combo leg limit orders for each data format and order direction. The order direction in the table represents the order direction of the order leg, not the order direction of the combo order.

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy Ask price < limit price min(ask price, limit price)
    Tick Quote Sell Bid price > limit price max(bid price, limit price)
    Tick Trade Buy Trade price < limit price min(trade price, limit price)
    Tick Trade Sell Trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy Ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell Bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy Low price < limit price min(high price, limit price)
    TradeBar
    Sell High price > limit price max(low price, limit price)

    The model only fills combo leg limit orders if all the following conditions are met:

    The fill quantity is the product of the leg order quantity and the combo order quantity.

     

    11.2.2.4 Immediate Model

    Introduction

    The ImmediateFillModel is the default fill model if you trade non-Equity assets with the DefaultBrokerageModel . This fill model fills trades completely and immediately.

    security.SetFillModel(new ImmediateFillModel());
    security.SetFillModel(ImmediateFillModel())

    The fill logic of each order depends on the order type, the data format of the security subscription, and the order direction. The following tables show the fill price of each order given these factors. To determine the fill price of an order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If your security subscription doesn't provide quote data, the fill model checks the most recent TradeBar .

    To view the implementation of this model, see the LEAN GitHub repository .

    Market Orders

    The following table describes the fill price of market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model only fills market orders if the exchange is open and it immediately fills them. If your algorithm places a market order at 10 AM, it fills at 10 AM.

    Limit Orders

    The following table describes the fill logic of limit orders for each data format and order direction:

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy low price < limit price min(high price, limit price)
    TradeBar
    Sell high price > limit price max(low price, limit price)

    The model won't fill limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Limit if Touched Orders

    The model converts a limit if touched order to a limit order when the trigger condition is met. The following table describes the trigger condition of limit if touched orders for each data format and order direction:

    Data Format TickType Order Direction Trigger Condition
    Tick Quote Buy quote price <= trigger price
    Tick Quote Sell quote price >= trigger price
    Tick Trade Buy trade price <= trigger price
    Tick Trade Sell trade price >= trigger price
    TradeBar
    Buy low price <= trigger price
    TradeBar
    Sell high price >= trigger price

    Once the limit if touched order triggers, to fill the order, the model checks the bid price for buy orders and the ask price for sell orders.

    To get the bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Buy orders fill when the bid price <= limit price and sell orders fill when the ask price >= limit price. The order fills at the limit price. The model won't trigger or fill limit if touched orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Market Orders

    The following table describes the fill logic of stop market orders for each data format and order direction. Once the stop condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Price
    Tick Quote Buy quote price > stop price max(stop price, quote price + slippage)
    Tick Quote Sell quote price < stop price min(stop price, quote price - slippage)
    Tick Trade Buy trade price > stop price max(stop price, last trade price + slippage)
    Tick Trade Sell trade price < stop price min(stop price, last trade price - slippage)
    QuoteBar
    Buy ask high price > stop price max(stop price, ask close price + slippage)
    QuoteBar
    Sell bid low price < stop price min(stop price, bid close price - slippage)
    TradeBar
    Buy high price > stop price max(stop price, close price + slippage)
    TradeBar
    Sell low price < stop price min(stop price, close price - slippage)

    The model only fills stop market orders when the exchange is open.

    The model won't fill stop market orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Limit Orders

    The following table describes the fill logic of stop limit orders for each data format and order direction. Once the stop condition is met, the model starts to check the fill condition. Once the fill condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Condition Fill Price
    Tick Quote Buy quote price > stop price quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price < stop price quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price > stop price trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price < stop price trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask high price > stop price ask close price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid low price < stop price bid close price > limit price max(bid low price, limit price)
    TradeBar
    Buy high price > stop price close price < limit price min(high price, limit price)
    TradeBar
    Sell low price < stop price close price > limit price max(low price, limit price)

    The model won't fill stop limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Open Orders

    The following table describes the fill price of market on open orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask open price + slippage
    QuoteBar
    Sell bid open price - slippage
    TradeBar
    Buy open price + slippage
    TradeBar
    Sell open price - slippage

    The model won't fill market on open orders during pre-market hours.

    The model won't fill market on open orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Close Orders

    The following table describes the fill price of market on close orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model won't fill market on close orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Combo Market Orders

    The following table describes the fill price of combo market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy Ask quote price + slippage
    Tick Quote Sell Bid quote price - slippage
    Tick Trade Buy Trade price + slippage
    Tick Trade Sell Trade price - slippage
    QuoteBar
    Buy Ask close price + slippage
    QuoteBar
    Sell Bid close price - slippage
    TradeBar
    Buy Close price + slippage
    TradeBar
    Sell Close price - slippage

    The model only fills combo market orders if all the following conditions are met:

    The fill quantity of each leg is the product of the leg order quantity and the combo market order quantity.

    Combo Limit Orders

    To fill combo limit orders, the fill model calculates the aggregate price of the combo order, which is the sum of prices for each security in the order legs. The price of each security is a function of the data format and order direction. Legs with a positive order quantity increase the aggregate price and legs with a negative quantity decrease the aggregate price. The following table shows how the fill model calculates the security prices.

    Data Format TickType Combo Order Direction Leg Order Direction Price
    Tick Quote Buy or sell Buy Ask price
    Tick Quote Buy or sell Sell Bid price
    Tick Trade Buy or sell Buy or sell Trade price
    QuoteBar Buy Buy Ask low price
    QuoteBar Buy Sell Bid low price
    QuoteBar Sell Buy Ask high price
    QuoteBar Sell Sell Bid high price
    TradeBar Buy Buy or sell Low price
    TradeBar Sell Buy or sell High price

    After the fill model calculates the aggregate price of the combo order, it checks if it should fill the order. The following table describes the fill condition of the combo order and the fill price price of each leg:

    Data Format TickType Combo Order Direction Fill Condition Leg Order Direction Fill Price
    Tick Quote Buy Aggregate price < combo limit price Buy or sell Quote price
    Tick Quote Sell Aggregate price > combo limit price Buy or sell Quote price
    Tick Trade Buy Aggregate price < combo limit price Buy or sell Trade price
    Tick Trade Sell Aggregate price > combo limit price Buy or sell Trade price
    QuoteBar
    Buy Aggregate price < combo limit price Buy Ask low price
    QuoteBar
    Buy Aggregate price < combo limit price Sell Bid low price
    QuoteBar
    Sell Aggregate price > combo limit price Buy Ask high price
    QuoteBar
    Sell Aggregate price > combo limit price Sell Bid high price
    TradeBar
    Buy Aggregate price < combo limit price Buy or sell Low price
    TradeBar
    Sell Aggregate price > combo limit price Buy or sell High price

    The model only fills combo limit orders if the data isn't stale and all the legs can fill in the same time step after the order time step. The fill quantity of each leg is the product of the leg order quantity and the combo order quantity.

    Combo Leg Limit Orders

    The following table describes the fill logic of combo leg limit orders for each data format and order direction. The order direction in the table represents the order direction of the order leg, not the order direction of the combo order.

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy Ask price < limit price min(ask price, limit price)
    Tick Quote Sell Bid price > limit price max(bid price, limit price)
    Tick Trade Buy Trade price < limit price min(trade price, limit price)
    Tick Trade Sell Trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy Ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell Bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy Low price < limit price min(high price, limit price)
    TradeBar
    Sell High price > limit price max(low price, limit price)

    The model only fills combo leg limit orders if all the following conditions are met:

    The fill quantity is the product of the leg order quantity and the combo order quantity.

     

    11.2.2.5 Latest Price Model

    Introduction

    The LatestPriceFillModel fills trades completely and immediately.

    security.SetFillModel(new LatestPriceFillModel());
    security.SetFillModel(LatestPriceFillModel())

    The fill logic of each order depends on the order type, the data format of the security subscription, and the order direction. The following tables show the fill price of each order given these factors. To determine the fill price of an order, the fill model first checks the most recent tick for the security. If your security subscription doesn't provide tick data, the fill model checks the most recent QuoteBar . If there is no QuoteBar available, it uses the OHLC prices from the Security object. If there is a QuoteBar available, the fill model gets the most recent TradeBar . If the TradeBar is more recent, it uses the TradeBar data. Otherwise, it uses the QuoteBar data.

    To view the implementation of this model, see the LEAN GitHub repository .

    Market Orders

    The following table describes the fill price of market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model only fills market orders if the exchange is open and it immediately fills them. If your algorithm places a market order at 10 AM, it fills at 10 AM.

    Limit Orders

    The following table describes the fill logic of limit orders for each data format and order direction:

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy low price < limit price min(high price, limit price)
    TradeBar
    Sell high price > limit price max(low price, limit price)

    The model won't fill limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Limit if Touched Orders

    The model converts a limit if touched order to a limit order when the trigger condition is met. The following table describes the trigger condition of limit if touched orders for each data format and order direction:

    Data Format TickType Order Direction Trigger Condition
    Tick Quote Buy quote price <= trigger price
    Tick Quote Sell quote price >= trigger price
    Tick Trade Buy trade price <= trigger price
    Tick Trade Sell trade price >= trigger price
    TradeBar
    Buy low price <= trigger price
    TradeBar
    Sell high price >= trigger price

    Once the limit if touched order triggers, to fill the order, the model checks the bid price for buy orders and the ask price for sell orders.

    To get the bid price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a buy quote, use the bid price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing bid price of the most recent QuoteBar .

    To get the ask price, the model uses the following procedure:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a sell quote, use the ask price of the most recent quote tick.
    2. If the subscription provides QuoteBar data, use the closing ask price of the most recent QuoteBar .

    If neither of the preceding procedures yield a result, the model uses the following procedure to get the bid or ask price:

    1. If the subscription provides Tick data and the most recent batch of ticks contains a tick of type TickType.Trade , use the last trade price.
    2. If the subscription provides TradeBar data, use the closing bid price of the most recent QuoteBar .

    Buy orders fill when the bid price <= limit price and sell orders fill when the ask price >= limit price. The order fills at the limit price. The model won't trigger or fill limit if touched orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Market Orders

    The following table describes the fill logic of stop market orders for each data format and order direction. Once the stop condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Price
    Tick Quote Buy quote price > stop price max(stop price, quote price + slippage)
    Tick Quote Sell quote price < stop price min(stop price, quote price - slippage)
    Tick Trade Buy trade price > stop price max(stop price, last trade price + slippage)
    Tick Trade Sell trade price < stop price min(stop price, last trade price - slippage)
    QuoteBar
    Buy ask high price > stop price max(stop price, ask close price + slippage)
    QuoteBar
    Sell bid low price < stop price min(stop price, bid close price - slippage)
    TradeBar
    Buy high price > stop price max(stop price, close price + slippage)
    TradeBar
    Sell low price < stop price min(stop price, close price - slippage)

    The model only fills stop market orders when the exchange is open.

    The model won't fill stop market orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Stop Limit Orders

    The following table describes the fill logic of stop limit orders for each data format and order direction. Once the stop condition is met, the model starts to check the fill condition. Once the fill condition is met, the model fills the orders and sets the fill price.

    Data Format TickType Order Direction Stop Condition Fill Condition Fill Price
    Tick Quote Buy quote price > stop price quote price < limit price min(quote price, limit price)
    Tick Quote Sell quote price < stop price quote price > limit price max(quote price, limit price)
    Tick Trade Buy trade price > stop price trade price < limit price min(trade price, limit price)
    Tick Trade Sell trade price < stop price trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy ask high price > stop price ask close price < limit price min(ask high price, limit price)
    QuoteBar
    Sell bid low price < stop price bid close price > limit price max(bid low price, limit price)
    TradeBar
    Buy high price > stop price close price < limit price min(high price, limit price)
    TradeBar
    Sell low price < stop price close price > limit price max(low price, limit price)

    The model won't fill stop limit orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Open Orders

    The following table describes the fill price of market on open orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask open price + slippage
    QuoteBar
    Sell bid open price - slippage
    TradeBar
    Buy open price + slippage
    TradeBar
    Sell open price - slippage

    The model won't fill market on open orders during pre-market hours.

    The model won't fill market on open orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Market on Close Orders

    The following table describes the fill price of market on close orders for each data format and order side:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy quote price + slippage
    Tick Quote Sell quote price - slippage
    Tick Trade Buy trade price + slippage
    Tick Trade Sell trade price - slippage
    QuoteBar
    Buy ask close price + slippage
    QuoteBar
    Sell bid close price - slippage
    TradeBar
    Buy close price + slippage
    TradeBar
    Sell close price - slippage

    The model won't fill market on close orders with stale data or data with the order timestamp to avoid look-ahead bias.

    Combo Market Orders

    The following table describes the fill price of combo market orders for each data format and order direction:

    Data Format TickType Order Direction Fill Price
    Tick Quote Buy Ask quote price + slippage
    Tick Quote Sell Bid quote price - slippage
    Tick Trade Buy Trade price + slippage
    Tick Trade Sell Trade price - slippage
    QuoteBar
    Buy Ask close price + slippage
    QuoteBar
    Sell Bid close price - slippage
    TradeBar
    Buy Close price + slippage
    TradeBar
    Sell Close price - slippage

    The model only fills combo market orders if all the following conditions are met:

    The fill quantity of each leg is the product of the leg order quantity and the combo market order quantity.

    Combo Limit Orders

    To fill combo limit orders, the fill model calculates the aggregate price of the combo order, which is the sum of prices for each security in the order legs. The price of each security is a function of the data format and order direction. Legs with a positive order quantity increase the aggregate price and legs with a negative quantity decrease the aggregate price. The following table shows how the fill model calculates the security prices.

    Data Format TickType Combo Order Direction Leg Order Direction Price
    Tick Quote Buy or sell Buy Ask price
    Tick Quote Buy or sell Sell Bid price
    Tick Trade Buy or sell Buy or sell Trade price
    QuoteBar Buy Buy Ask low price
    QuoteBar Buy Sell Bid low price
    QuoteBar Sell Buy Ask high price
    QuoteBar Sell Sell Bid high price
    TradeBar Buy Buy or sell Low price
    TradeBar Sell Buy or sell High price

    After the fill model calculates the aggregate price of the combo order, it checks if it should fill the order. The following table describes the fill condition of the combo order and the fill price price of each leg:

    Data Format TickType Combo Order Direction Fill Condition Leg Order Direction Fill Price
    Tick Quote Buy Aggregate price < combo limit price Buy or sell Quote price
    Tick Quote Sell Aggregate price > combo limit price Buy or sell Quote price
    Tick Trade Buy Aggregate price < combo limit price Buy or sell Trade price
    Tick Trade Sell Aggregate price > combo limit price Buy or sell Trade price
    QuoteBar
    Buy Aggregate price < combo limit price Buy Ask low price
    QuoteBar
    Buy Aggregate price < combo limit price Sell Bid low price
    QuoteBar
    Sell Aggregate price > combo limit price Buy Ask high price
    QuoteBar
    Sell Aggregate price > combo limit price Sell Bid high price
    TradeBar
    Buy Aggregate price < combo limit price Buy or sell Low price
    TradeBar
    Sell Aggregate price > combo limit price Buy or sell High price

    The model only fills combo limit orders if the data isn't stale and all the legs can fill in the same time step after the order time step. The fill quantity of each leg is the product of the leg order quantity and the combo order quantity.

    Combo Leg Limit Orders

    The following table describes the fill logic of combo leg limit orders for each data format and order direction. The order direction in the table represents the order direction of the order leg, not the order direction of the combo order.

    Data Format TickType Order Direction Fill Condition Fill Price
    Tick Quote Buy Ask price < limit price min(ask price, limit price)
    Tick Quote Sell Bid price > limit price max(bid price, limit price)
    Tick Trade Buy Trade price < limit price min(trade price, limit price)
    Tick Trade Sell Trade price > limit price max(trade price, limit price)
    QuoteBar
    Buy Ask low price < limit price min(ask high price, limit price)
    QuoteBar
    Sell Bid high price > limit price max(bid low price, limit price)
    TradeBar
    Buy Low price < limit price min(high price, limit price)
    TradeBar
    Sell High price > limit price max(low price, limit price)

    The model only fills combo leg limit orders if all the following conditions are met:

    The fill quantity is the product of the leg order quantity and the combo order quantity.

     

    11.3 Slippage

    11.3.1 Key Concepts

    Introduction

    Slippage is the difference between the fill price you expect to get for an order and the actual fill price. Since the price can move in the direction of your trade or against the direction of your trade while you wait for the order to fill, slippage can be positive or negative. Slippage models model slippage to make backtest results more realistic.

    Factors Impacting Slippage

    There are many factors that can impact slippage, including the trading engine, brokerage connection, and market dynamics.

    Trading Engine

    How long does it take from when you place an order to when it's sent to the brokerage? Longer delays lead to more slippage.

    Brokerage Connection

    How long does it take for your brokerage to receive an order that you send? Slow internet connections, long travel distances, and poor infrastructure lead to more slippage

    Market Dynamics

    How volatile is the current market environment? More volatility leads to more slippage.

    Does the market consist of sophisticated microsecond arbitrageurs? If your order creates an arbitrage opportunity, it can cause more slippage.

    Set Models

    The brokerage model of your algorithm automatically sets the slippage model for each security, but you can override it. To manually set the slippage model of a security, call the SetSlippageModel method on the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    security.SetSlippageModel(new VolumeShareSlippageModel());
    # In Initialize
    security = self.AddEquity("SPY")
    security.SetSlippageModel(VolumeShareSlippageModel())

    You can also set the slippage model in a security initializer . If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetSlippageModel(new VolumeShareSlippageModel());    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetSlippageModel(VolumeShareSlippageModel())

    To view all the pre-built slippage models, see Supported Models .

    Default Behavior

    The brokerage model of your algorithm automatically sets the slippage model of each security. The default brokerage model is the DefaultBrokerageModel , which uses the ConstantSlippageModel to model zero slippage for all securities.

    Model Structure

    Slippage models should implement the ISlippageModel interface. Extensions of the ISlippageModel interface must implement the GetSlippageApproximation method, which calculates the slippage quantity.

    public class MySlippageModel : ISlippageModel 
    {
        public decimal GetSlippageApproximation(Security asset, Order order) 
        {
            return asset.Price*0.0001m*(decimal) Math.Log10(2*(double) order.AbsoluteQuantity);
        }
    }
    
    class MySlippageModel:
    
        def GetSlippageApproximation(self, asset: Security, order: Order) -> float:
            return asset.Price * 0.0001 * np.log10(2*float(order.AbsoluteQuantity))

    Examples

    Demonstration Algorithms
    CustomModelsAlgorithm.py Python CustomModelsAlgorithm.cs C#

     

    11.3.2 Supported Models

    Introduction

    This page describes the pre-built slippage models in LEAN. If none of these models perform exactly how you want, create a custom slippage model .

    Constant Model

    The ConstantSlippageModel applies a constant percentage of slippage to each order. It's the default slippage model of the DefaultBrokerageModel .

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    slippagePercent decimal float The slippage percent for each order. The value must be in the interval (0, 1).

    To view the implementation of this model, see the LEAN GitHub repository .

    Volume Share Model

    The VolumeShareSlippageModel calculates the slippage of each order by multiplying the price impact constant by the square of the ratio of the order to the total volume. If the volume of the current bar is zero, the slippage percent is

    Slippage percent calculation when bar volume is 0

    where volumeLimit and priceImpact are custom input variables. If the volume of the current bar is positive, the slippage percent is

    Slippage percent calculation when bar volume is greater than 0

    where orderQuantity is the quantity of the order and barVolume is the volume of the current bar. If the security subscription provides TradeBar data, the barVolume is the volume of the current bar. If the security subscription provides QuoteBar data, the barVolume is the bid or ask size of the current bar. CFD, Forex, and Crypto data often doesn't include volume. If there is no volume reported for these asset classes, the model returns zero slippage.

    security.SetSlippageModel(new VolumeShareSlippageModel());
    security.SetSlippageModel(VolumeShareSlippageModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    volumeLimit decimal float Maximum percent of historical volume that can fill in each bar. 0.5 means 50% of historical volume. 1.0 means 100%. 0.025
    priceImpact decimal float Scaling coefficient for price impact. Larger values will result in more simulated price impact. Smaller values will result in less simulated price impact. 0.1

    To view the implementation of this model, see the LEAN GitHub repository .

     

    11.4 Transaction Fees

    11.4.1 Key Concepts

    Introduction

    Your orders incur a transaction fee when a brokerage fills them in the market. LEAN uses transaction fee models in backtesting to model the live trading fees you would incur with the strategy. Transaction fee models make backtest results more realistic. To give your backtests the most accurate fees, LEAN contains transaction fee models that model the fee structure of many popular brokerages.

    Set Models

    The brokerage model of your algorithm automatically sets the fee model for each security, but you can override it. To manually set the fee model of a security, call the SetFeeModel method on the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    security.SetFeeModel(new ConstantFeeModel(0));
    # In Initialize
    security = self.AddEquity("SPY")
    security.SetFeeModel(ConstantFeeModel(0))

    You can also set the fee model in a security initializer . If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetFeeModel(new ConstantFeeModel(0));    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetFeeModel(ConstantFeeModel(0))

    In live trading, the SetFeeModel method isn't ignored. If we use order helper methods like SetHoldings , the fee model helps to calculate the order quantity. However, the algorithm doesn't update the cash book with the fee from the fee model. The algorithm uses the actual fee from the brokerage to update the cash book.

    To view all the pre-built fee models, see Supported Models .

    Default Behavior

    The brokerage model of your algorithm automatically sets the fill model for each security. The default brokerage model is the DefaultBrokerageModel , which set the ConstantFeeModel with no fees for Forex, CFD, and Crypto assets and sets the InteractiveBrokersFeeModel for the remaining asset classes.

    Model Structure

    Fee models should extend the FeeModel class. Extensions of the FeeModel class must implement the GetOrderFee method, which receives OrderFeeParameters and returns an OrderFee that represents a cash amount in a currency.

    public class MyFeeModel : FeeModel 
    {
        public override OrderFee GetOrderFee(OrderFeeParameters parameters) 
        {
            return new OrderFee(new CashAmount(0.5m, "USD"));
        }
    }
    class MyFeeModel(FeeModel):
    
        def GetOrderFee(self, parameters: OrderFeeParameters) -> OrderFee:
            return OrderFee(CashAmount(0.5, 'USD'))

    The OrderFeeParameters object has the following members:

    Negative Transaction Fees

    If you short a security and receive interest payments, they are negative transaction fees.

    Examples

    Demonstration Algorithms
    CustomModelsAlgorithm.py Python RawPricesCoarseUniverseAlgorithm.py Python CustomModelsAlgorithm.cs C# RawPricesCoarseUniverseAlgorithm.cs C#

     

    11.4.2 Supported Models

    Introduction

    This page describes some of the pre-built fee models in LEAN. For more brokerage-specific fee models, see the brokerage model documentation . If none of these models perform exactly how you want, create a custom fee model .

    Constant Model

    The ConstantFeeModel applies the absolute value of a constant fee to each order. It's the default fee model of the DefaultBrokerageModel if you trade Forex, CFD, or Crypto assets.

    security.SetFeeModel(new ConstantFeeModel(0.05m));
    security.SetFeeModel(ConstantFeeModel(0.05))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    fee decimal float The order fee quantity
    currency string str The order fee currency
    "USD"

    To view the implementation of this model, see the LEAN GitHub repository .

    Interactive Brokers Model

    The InteractiveBrokersFeeModel models the fees of Interactive Brokers .

    security.SetFeeModel(new InteractiveBrokersFeeModel());
    security.SetFeeModel(InteractiveBrokersFeeModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    monthlyForexTradeAmountInUSDollars decimal float Monthly Forex dollar volume traded 0
    monthlyOptionsTradeAmountInContracts decimal float Monthly Option contracts traded
    0

    The following table describes which currency the InteractiveBrokersFeeModel charges fees in for each asset class:

    Asset Class Fee Currency
    US Equity USD
    India Equity INR
    Equity Options USD
    Forex USD
    US Futures USD
    Hong Kong Futures The contract quote currency (CNH, HKD, or USD)
    US Future Options USD
    Hong Kong Future Options The contract quote currency (CNH, HKD, or USD)
    Index Options USD

    The following sections describe the trading fees of each asset class. To view the implementation of this model, see the LEAN GitHub repository .

    US Equities

    US Equity trades cost $0.005/share with a $1 minimum fee and a 0.5% maximum fee.

    Equity Options and Index Options

    Equity Options and Index Options fees are a function of your monthly volume and the premium of the contract you trade. The following table shows the fees for each volume tier:

    Monthly Volume (Contacts)
    Premium ($) Fee per Contract ($)
    <= 10,000 < 0.05 0.25
    <= 10,000 0.05 <= premium < 0.10 0.50
    <= 10,000 >= 0.10 0.70
    10,000 < volume <= 50,000 < 0.05
    0.25
    10,000 < volume <= 50,000 >= 0.05
    0.50
    50,000 < volume <= 100,000 Any 0.25
    > 100,000 Any 0.15

    By default, LEAN models your fees at the tier with the lowest monthly volume. To adjust the fee tier, manually set the fee model and provide a monthlyOptionsTradeAmountInContracts argument.

    There is no fee to exercise Option contracts.

    Forex

    Forex fees are a function of your monthly Forex trading volume. The following table shows the fee tiers:

    Monthly Volume (USD) Commission Rate (%) Minimum Fee ($)
    <= 1B 0.002 2
    1B < volume <= 2B 0.0015 1.5
    2B < volume <= 5B 0.001 1.25
    > 5B 0.0008 1

    By default, LEAN models your fees at the tier with the lowest monthly volume. To adjust the fee tier, manually set the fee model and provide a monthlyForexTradeAmountInUSDollars argument.

    US Futures

    US Futures fees depend on the contracts you trade. The following table shows the base fee per contract for each Future:

    Contract Symbol Market Name Base Fee Per Contract ($) Exchange Fee Per Contract ($)
    E-mini Futures
    ES CME E-mini S&P 500 Futures 0.85 1.28
    NQ CME E-mini Nasdaq-100 Futures 0.85 1.28
    YM CBOT E-mini Dow ($5) Futures 0.85 1.28
    RTY CME E-mini Russell 2000 Index Futures 0.85 1.28
    EMD CME E-mini S&P MidCap 400 Futures 0.85 1.28
    Micro E-mini Futures
    MYM CBOT Micro E-mini Dow Jones Industrial Average Index Futures 0.25 0.3
    M2K CME Micro E-mini Russell 2000 Index Futures 0.25 0.3
    MES CME Micro E-mini Standard and Poor's 500 Stock Price Index Futures 0.25 0.3
    MNQ CME Micro E-mini Nasdaq-100 Index Futures 0.25 0.3
    2YY CBOT Micro 2-Year Yield Futures 0.25 0.3
    5YY CBOT Micro 5-Year Yield Futures 0.25 0.3
    10Y CBOT Micro 10-Year Yield Futures 0.25 0.3
    30Y CBOT Micro 30-Year Yield Futures 0.25 0.3
    MCL NYMEX Micro WTI Crude Oil Futures 0.25 0.3
    MGC COMEX Micro Gold Futures 0.25 0.3
    SIL COMEX Micro Silver Futures 0.25 0.3
    Cryptocurrency Futures
    BTC CME Bitcoin Futures 5 6
    MIB CME BTIC on Micro Bitcoin Futures 2.25 2.5
    MBT CME Micro Bitcoin Futures 2.25 2.5
    MET CME Micro Ether Futures 0.2 0.2
    MRB CME BTIC on Micro Ether Futures 0.2 0.2
    E-mini FX Futures
    E7 CME E-mini Euro FX Futures 0.5 0.85
    J7 CME E-mini Japanese Yen Futures 0.5 0.85
    Micro E-mini FX Futures
    M6E CME Micro Euro/U.S. Dollar (EUR/USD) Futures 0.15 0.24
    M6A CME Micro Australian Dollar/U.S. Dollar (AUD/USD) Futures 0.15 0.24
    M6B CME Micro British Pound Sterling/U.S. Dollar (GBP/USD) Futures 0.15 0.24
    MCD CME Micro Canadian Dollar/U.S.Dollar(CAD/USD) Futures 0.15 0.24
    MJY CME Micro Japanese Yen/U.S. Dollar (JPY/USD) Futures 0.15 0.24
    MSF CME Micro Swiss Franc/U.S. Dollar (CHF/USD) Futures 0.15 0.24
    M6J CME Micro USD/JPY Futures 0.15 0.24
    MIR CME Micro INR/USD Futures 0.15 0.24
    M6C CME Micro USD/CAD Futures 0.15 0.24
    M6S CME Micro USD/CHF Futures 0.15 0.24
    MNH CME Micro USD/CNH Futures 0.15 0.24

    If you trade a contract that's not in the preceding table, the base fee is $0.85/contract and the exchange fee is $1.60/contract.

    In addition to the base fee and exchange fee, there is a $0.02/contract regulatory fee.

    Futures Options

    Futures Options fees depend on the contracts you trade. The following table shows the base fee per contract for each Future:

    Contract Symbol Market Underlying Futures Name Base Fee Per Contract ($) Exchange Fee Per Contract ($)
    E-mini Futures Options
    ES CME E-mini S&P 500 Futures 0.85 0.55
    NQ CME E-mini Nasdaq-100 Futures 0.85 0.55
    YM CBOT E-mini Dow ($5) Futures 0.85 0.55
    RTY CME E-mini Russell 2000 Index Futures 0.85 0.55
    EMD CME E-mini S&P MidCap 400 Futures 0.85 0.55
    Micro E-mini Futures Options
    MYM CBOT Micro E-mini Dow Jones Industrial Average Index Futures 0.25 0.2
    M2K CME Micro E-mini Russell 2000 Index Futures 0.25 0.2
    MES CME Micro E-mini Standard and Poor's 500 Stock Price Index Futures 0.25 0.2
    MNQ CME Micro E-mini Nasdaq-100 Index Futures 0.25 0.2
    2YY CBOT Micro 2-Year Yield Futures 0.25 0.2
    5YY CBOT Micro 5-Year Yield Futures 0.25 0.2
    10Y CBOT Micro 10-Year Yield Futures 0.25 0.2
    30Y CBOT Micro 30-Year Yield Futures 0.25 0.2
    MCL NYMEX Micro WTI Crude Oil Futures 0.25 0.2
    MGC COMEX Micro Gold Futures 0.25 0.2
    SIL COMEX Micro Silver Futures 0.25 0.2
    Cryptocurrency Futures Options
    BTC CME Bitcoin Futures 5 5
    MIB CME BTIC on Micro Bitcoin Futures 1.25 2.5
    MBT CME Micro Bitcoin Futures 1.25 2.5
    MET CME Micro Ether Futures 0.1 0.2
    MRB CME BTIC on Micro Ether Futures 0.1 0.2

    If you trade a contract that's not in the preceding table, the base fee is $0.85/contract and the exchange fee is $1.60/contract.

    In addition to the base fee and exchange fee, there is a $0.02/contract regulatory fee.

    Binance Model

    The BinanceFeeModel models the fees of spot trades on Binance and Binance US .

    security.SetFeeModel(new BinanceFeeModel());
    security.SetFeeModel(BinanceFeeModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    mFee decimal float Maker fee value 0.001
    tFee decimal float Taker fee value 0.001

    The BinanceFeeModel charges the order fees of Binance and Binance US at the VIP 0 level, which is a 0.1% maker and taker fee. If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Binance adjusts your fees based on your 30-day trading volume and BNB balance, but we don't currently model these metrics to adjust fees.

    The BinanceFeeModel charges fees in the currency you receive from a trade. For example, if you buy ETHBTC, you pay fees in ETH. If you sell ETHBTC, you pay fees in BTC.

    To view the implementation of this model, see the LEAN GitHub repository .

    Binance Futures Model

    The BinanceFuturesFeeModel models the Binance Futures live trading fees .

    security.SetFeeModel(new BinanceFuturesFeeModel());
    security.SetFeeModel(BinanceFuturesFeeModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    mUsdtFee decimal float Maker fee value for USDT pair contracts 0.0002
    tUsdtFee decimal float Taker fee value for USDT pair contracts 0.0004
    mBusdFee decimal float Maker fee value for BUSD pair contracts 0.00012
    tUsdtFee decimal float Taker fee value for BUSD pair contracts 0.00036

    By default, the BinanceFuturesFeeModel charges the order fees of Binance Futures at the Regular User level. If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Binance adjusts your fees based on your 30-day trading volume and BNB balance, but we don't currently model these metrics to adjust fees.

    The BinanceFuturesFeeModel charges fees in the currency you receive from a trade. For example, if you buy BTCUSD, you pay fees in BTC. If you sell BTCUSD, you pay fees in USD.

    To view the implementation of this model, see the LEAN GitHub repository .

    Binance Coin Futures Model

    The BinanceCoinFuturesFeeModel models the Binance Coin Futures live trading fees .

    security.SetFeeModel(new BinanceCoinFuturesFeeModel());
    security.SetFeeModel(BinanceCoinFuturesFeeModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    mFee decimal float Maker fee value 0.0001
    tFee decimal float Taker fee value 0.0005

    By default, the BinanceCoinFuturesFeeModel charges the order fees of Binance Coin Futures at the Regular User level. If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Binance adjusts your fees based on your 30-day trading volume and BNB balance, but we don't currently model these metrics to adjust fees.

    The BinanceCoinFuturesFeeModel charges fees in the currency you receive from a trade. For example, if you buy BTCUSDT, you pay fees in BTC. If you sell BTCUSDT, you pay fees in USDT.

    To view the implementation of this model, see the LEAN GitHub repository .

    Bitfinex Model

    The BitfinexFeeModel models the Bitfinex live trading fees .

    security.SetFeeModel(new BitfinexFeeModel());
    security.SetFeeModel(BitfinexFeeModel())

    The BitfinexFeeModel charges a 0.1% maker fee and a 0.2% taker fee. If you place a limit order that hits a hidden order or you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you place a hidden order or you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Bitfinex adjusts your fees based on your 30-day trading volume and LEO balance, but we don't currently model these metrics to adjust fees.

    The BitfinexFeeModel charges fees in the currency you receive from a trade. For example, if you buy ETHBTC, you pay fees in ETH. If you sell ETHBTC, you pay fees in BTC.

    To view the implementation of this model, see the LEAN GitHub repository .

    GDAX Model

    The GDAXFeeModel models the Coinbase live trading fees .

    security.SetFeeModel(new GDAXFeeModel());
    security.SetFeeModel(GDAXFeeModel())

    The GDAXFeeModel models the order fees of Coinbase at the $50K-100K pricing tier for all Crypto pairs, so it charges a 0.5% maker and taker fee for most pairs. The following table shows the Coinbase Stable Pairs, which charge a 0% maker fee and a 0.1% taker fee:

    Stable Pairs
    DAIUSDC DAIUSD GYENUSD PAXUSD
    PAXUSDT MUSDUSD USDCEUR USDCGBP
    USDTEUR USDTGBP USDTUSD USDTUSDC
    USTEUR USTUSD USTUSDT WBTCBTC

    If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Coinbase adjusts your fees based on your 30-day trading volume, but we don't currently model trading volume to adjust fees.

    The GDAXFeeModel models the adjustments Coinbase has made to their fees over time. The following table shows the fees for each time period:

    Time Period (UTC) Maker Fee (%) Taker Fee (%)
    Time < 3/23/2019 1:30AM 0 0.3
    3/23/2019 1:30AM <= Time < 10/8/2019 12:30AM 0.15 0.25
    10/8/2019 12:30AM <= Time 0.5 0.5

    The GDAXFeeModel charges fees in the quote currency .

    To view the implementation of this model, see the LEAN GitHub repository .

    Kraken Model

    The KrakenFeeModel models the fees of Kraken .

    security.SetFeeModel(new KrakenFeeModel());
    security.SetFeeModel(KrakenFeeModel())

    The KrakenFeeModel model the order fees of Kraken. For trading pairs that contain only Crypto assets, this fee model models the lowest tier in Kraken's tiered fee structure, which is a 0.16% maker fee and a 0.26% taker fee. If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. For trading pairs that have any of the following currencies as the base currency in the pair, the fee is 0.2%:

    The KrakenFeeModel charges fees in the quote currency for buy orders and in the base currency for sell orders. To override these settings, define the KrakenOrderProperties .

    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new KrakenOrderProperties()
        {
            FeeInBase = true,
            FeeInQuote = false
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new KrakenOrderProperties
                   { 
                       FeeInQuote = true, 
                       FeeInBase = false 
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = KrakenOrderProperties()
        self.DefaultOrderProperties.FeeInBase = True
        self.DefaultOrderProperties.FeeInQuote = False
    
    def OnData(self, slice: Slice) -> None:
        # Override the default order properties
        order_properties = KrakenOrderProperties()
        order_properties.FeeInQuote = True
        order_properties.FeeInBase = False
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Kraken adjusts your fees based on your 30-day trading volume, but the KrakenFeeModel don't currently model trading volume to adjust fees.

    To view the implementation of this model, see the LEAN GitHub repository .

    Samco Model

    The SamcoFeeModel models the fees of Samco .

    security.SetFeeModel(new SamcoFeeModel());
    security.SetFeeModel(SamcoFeeModel())

    The SamcoFeeModel models the order fees of Samco by its Equity Intraday fee structure. The following table shows the fees:

    Charge Item Fee
    Brokerage Fee ₹20 per trade or 0.02% (whichever is lower)
    Exchange Transaction Charge 0.00345%
    Securities Transaction Tax 0.025%
    Goods and Services Tax 18%
    SEBI Charges 0.0001%
    Stamp Duty 0.003%

    The SamcoFeeModel charges fees in INR.

    To view the implementation of this model, see the LEAN GitHub repository .

    TD Ameritrade Model

    The TDAmeritradeFeeModel models the fees of TD Ameritrade .

    security.SetFeeModel(new TDAmeritradeFeeModel());
    security.SetFeeModel(TDAmeritradeFeeModel())

    The TDAmeritradeFeeModel charges $0 USD for Equity trades.

    To view the implementation of this model, see the LEAN GitHub repository .

    Wolverine Model

    The WolverineFeeModel models the fees of Wolverine Execution Services.

    security.SetFeeModel(new WolverineFeeModel());
    security.SetFeeModel(WolverineFeeModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    feesPerShare decimal? float / NoneType The fees per share to apply. If null None , it uses 0.005. null None

    The WolverineFeeModel charges fees in USD.

    To view the implementation of this model, see the LEAN GitHub repository .

    Zerodha Model

    The ZerodhaFeeModel models the fees of Zerodha .

    security.SetFeeModel(new ZerodhaFeeModel());
    security.SetFeeModel(ZerodhaFeeModel())

    The ZerodhaFeeModel models the order fees of Zerodha with its Equity Intraday fee structure. The following table shows the fees:

    Charge Item Fee
    Brokerage Fee ₹20 per trade or 0.03% (whichever is lower)
    Exchange Transaction Charge 0.00345%
    Securities Transaction Tax 0.025%
    Goods and Services Tax 18%
    SEBI Charges 0.0001%
    Stamp Duty 0.003%

    The ZerodhaFeeModel charges fees in INR.

    To view the implementation of this model, see the LEAN GitHub repository .

     

    11.5 Brokerages

    11.5.1 Key Concepts

    Introduction

    Brokerages provide you with a connection to the market so you can fill trades. Brokerage models simulate the live behavior of a real brokerage. To avoid sending invalid orders for execution in live trading, the brokerage model validates your orders before LEAN sends them to the real brokerage. Brokerage models combine together all of the models relevant for a brokerage. If you set the appropriate brokerage model, the supported order types, default markets, and some of the security-level models are appropriately set in your algorithm.

    Set Models

    To set a brokerage model, in the Initialize method, call the SetBrokerageModel method with a BrokerageName and an AccountType . If you set a brokerage model, it overrides any security level models you manually set in your algorithm.

    SetBrokerageModel(BrokerageName.OandaBrokerage); // Defaults to margin account
    SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin); // Overrides the default account type
    
    self.SetBrokerageModel(BrokerageName.OandaBrokerage) # Defaults to margin account
    self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin) # Overrides the default account type
    

    In live trading, LEAN doesn't ignore your SetBrokerageModel method calls. LEAN uses some of the brokerage model rules to catch invalid orders before they reach your real brokerage.

    To view all the pre-built brokerage models, see Supported Models .

    Default Behavior

    The default brokerage model is the DefaultBrokerageModel , but LEAN has many other brokerage models you can use in your algorithms. For more information about the DefaultBrokerageModel , see QuantConnect Paper Trading .

    Modeled Properties

    Brokerage models model that following properties:

    Model Structure

    Brokerage models should extend the DefaultBrokerageModel class. Extensions of the DefaultBrokerageModel class should implement the following methods:

    class MyBrokerageModel : DefaultBrokerageModel
    {
        public static new readonly IReadOnlyDictionary<SecurityType, string> DefaultMarketMap;
    
        public override decimal RequiredFreeBuyingPowerPercent { get; }
    
        public override IReadOnlyDictionary<SecurityType, string> DefaultMarkets => DefaultMarketMap;
    
        public MyBrokerageModel(AccountType accountType = AccountType.Margin)
            : base(accountType)
        {
            ShortableProvider = new NullShortableProvider();
        }
    
        public override bool CanSubmitOrder(Security security, Order order,
            out BrokerageMessageEvent message)
        {
            return base.CanSubmitOrder(security, order, out message);
        }
    
        public override bool CanUpdateOrder(Security security, Order order,
            UpdateOrderRequest request, out BrokerageMessageEvent message)
        {
            return base.CanUpdateOrder(security, order, request, out message);
        }
    
        public override bool CanExecuteOrder(Security security, Order order)
        {
            return base.CanExecuteOrder(security, order);
        }
    
        public override void ApplySplit(List<OrderTicket> tickets, Split split)
        {
            base.ApplySplit(tickets, split);
        }
    
        public override decimal GetLeverage(Security security)
        {
            return base.GetLeverage(security);
        }
    
        public override IBenchmark GetBenchmark(SecurityManager securities)
        {
            return base.GetBenchmark(securities);
        }
    
        public override IFillModel GetFillModel(Security security)
        {
            return base.GetFillModel(security);
        }
    
        public override IFeeModel GetFeeModel(Security security)
        {
            return base.GetFeeModel(security);
        }
    
        public override ISlippageModel GetSlippageModel(Security security)
        {
            return base.GetSlippageModel(security);
        }
    
        public override ISettlementModel GetSettlementModel(Security security)
        {
            return base.GetSettlementModel(security);
        }
    
        public override IBuyingPowerModel GetBuyingPowerModel(Security security)
        {
            return base.GetBuyingPowerModel(security);
        }
    
        public override IMarginInterestRateModel GetMarginInterestRateModel(Security security)
        {
            return base.GetMarginInterestRateModel(security);
        }
    
        public override IShortableProvider GetShortableProvider()
        {
            return ShortableProvider;
        }
    }
    
    class MyBrokerageModel(DefaultBrokerageModel):
        DefaultMarkets = {}
        RequiredFreeBuyingPowerPercent = 0
    
        def __init__(self, accountType: AccountType = AccountType.Margin):
            self.AccountType = accountType
            self.ShortableProvider = NullShortableProvider()
        
        def CanSubmitOrder(self, security: Security, order: Order,
             message: BrokerageMessageEvent) -> bool:
            return super().CanSubmitOrder(security, order, message)
    
        def CanUpdateOrder(self, security: Security, order: Order,
             request: UpdateOrderRequest, message: BrokerageMessageEvent) -> bool:
            return super().CanUpdateOrder(security, order, request, message)
    
        def CanExecuteOrder(self, security: Security, order: Order) -> bool:
            return super().CanExecuteOrder(security, order)
    
        def ApplySplit(self, tickets: List[OrderTicket], split: Split) -> None:
            super().ApplySplit(tickets, split)
    
        def GetLeverage(self, security: Security) -> float:
            return super().GetLeverage(security)
    
        def GetBenchmark(self, securities: SecurityManager) -> IBenchmark:
            return super().GetBenchmark(securities)
    
        def GetFillModel(self, security: Security) -> IFillModel:
            return super().GetFillModel(security)
    
        def GetFeeModel(self, security: Security) -> IFeeModel:
            return super().GetFeeModel(security)
    
        def GetSlippageModel(self, security: Security) -> ISlippageModel:
            return super().GetSlippageModel(security)
    
        def GetSettlementModel(self, security: Security) -> ISettlementModel:
            return super().GetSettlementModel(security)
    
        def GetBuyingPowerModel(self, security: Security) -> IBuyingPowerModel:
            return super().GetBuyingPowerModel(security)
    
        def GetMarginInterestRateModel(self, security: Security) -> IMarginInterestRateModel:
            return super().GetMarginInterestRateModel(security)
    
        def GetShortableProvider(self) -> IShortableProvider:
            return self.ShortableProvider

    Custom brokerage models give you enormous control over your algorithm behavior and allow you to model virtually any brokerage in the world.

    Examples

    Demonstration Algorithms
    BrokerageModelAlgorithm.py Python BrokerageModelAlgorithm.cs C# CustomBrokerageMessageHandlerAlgorithm.cs C#

     

    11.5.2 Supported Models

    Brokerage models combine together all of the models relevant for a brokerage. The following brokerage models are available:

    See Also

    Reality Modeling
    Live Trading Brokerages

     

    11.5.2.1 QuantConnect Paper Trading

    Introduction

    This page explains the DefaultBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.QuantConnectBrokerage, AccountType.Cash);
    SetBrokerageModel(BrokerageName.QuantConnectBrokerage, AccountType.Margin); // Overrides the default account type
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage) # Defaults to margin account
    self.SetBrokerageModel(BrokerageName.QuantConnectBrokerage, AccountType.Margin) # Overrides the default account type

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The DefaultBrokerageModel supports trading for all asset classes .

    Orders

    The following sections describe how the DefaultBrokerageModel handles orders.

    Order Types

    The following table describes the available order types for each asset class that the DefaultBrokerageModel supports:

    Order Type US Equity Equity Options Crypto Crypto Futures Forex CFD Futures Futures Options Index Options
    MarketOrder green check green check green check green check green check green check green check green check green check
    LimitOrder green check green check green check green check green check green check green check green check green check
    LimitIfTouchedOrder green check green check green check green check green check green check green check green check green check
    StopMarketOrder green check green check green check green check green check green check green check green check green check
    StopLimitOrder green check green check green check green check green check green check green check green check green check
    MarketOnOpenOrder green check green check green check green check green check green check
    MarketOnCloseOrder green check green check green check green check green check green check green check green check
    ComboMarketOrder green check green check green check
    ComboLimitOrder green check green check green check
    ComboLegLimitOrder green check green check green check
    ExerciseOption green check
    Not supported for cash-settled Options
    green check

    Time In Force

    The DefaultBrokerageModel supports the following TimeInForce instructions:

    Updates

    The DefaultBrokerageModel supports order updates .

    Handling Splits

    If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

    Fills

    The following table shows the fill model that the DefaultBrokerageModel uses for each SecurityType :

    SecurityType Fill Model
    Equity EquityFillModel
    Future FutureFillModel
    FutureOption FutureOptionFillModel
    Remaining SecurityType values ImmediateFillModel

    Slippage

    The DefaultBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The DefaultBrokerageModel uses the ConstantFeeModel with no fees for Forex, CFD, Crypto, and Crypto Future assets and the InteractiveBrokersFeeModel for the remaining asset classes.

    // For Forex, CFD, Crypto, and Crypto Future assets:
    security.SetFeeModel(new ConstantFeeModel(0.0m));
    
    // For the remaining asset classes:
    security.SetFeeModel(new InteractiveBrokersFeeModel());
    
    # For Forex, CFD, Crypto, and Crypto Future assets:
    security.SetFeeModel(ConstantFeeModel(0))
    
    # For the remaining asset classes:
    security.SetFeeModel(InteractiveBrokersFeeModel())

    Buying Power

    The DefaultBrokerageModel sets the buying power model based on the asset class of the security. The following table shows the default buying power model of each asset class:

    Asset Class Model
    Equity Options OptionMarginModel
    Futures FutureMarginModel
    Future Options FuturesOptionsMarginModel
    Index Options OptionMarginModel
    Crypto CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    CryptoFuture CryptoFutureMarginModel
    Forex CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    Other SecurityMarginModel

    If you have a margin account, the DefaultBrokerageModel allows 2x leverage for Equities, 50x leverage for Forex and CFDs, and 1x leverage for the remaining asset classes.

    Settlement

    The following table shows which settlement model the DefaultBrokerageModel uses based on the security type and your account type:

    Security Type Account Type Settlement Model
    Equity Cash DelayedSettlementModel with the default settlement rules
    Option Cash DelayedSettlementModel with the default settlement rules
    Future Any FutureSettlementModel

    For all other cases, the DefaultBrokerageModel uses the ImmediateSettlementModel .

    // For US Equities with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For Equity Options with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime);
    
    // For Futures
    security.SettlementModel = new FutureSettlementModel();
    
    // For remaining cases:
    security.SettlementModel = new ImmediateSettlementModel();
    # For US Equities with a cash account:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For Equity Options with a cash account:
    security.SettlementModel = DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime)
    
    # For Futures
    security.SettlementModel = FutureSettlementModel()
    
    # For remaining cases:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The DefaultBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The following table describes the default markets of each SecurityType for the DefaultBrokerageModel :

    SecurityType Market
    Equity USA
    Option USA
    Future CME
    FutureOption CME
    Index USA
    IndexOption USA
    Forex Oanda
    Cfd Oanda
    Crypto GDAX
    CryptoFuture Binance

     

    11.5.2.2 Binance

    Introduction

    This page explains the Binance brokerage models, including the asset classes they supports, their default security-level models , and their default markets.

    // Binance Spot
    SetBrokerageModel(BrokerageName.Binance, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Binance, AccountType.Margin);
    
    // Binance Futures
    SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin);
    SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin);
    
    // Binance US Spot
    SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash);
    # Binance Spot
    self.SetBrokerageModel(BrokerageName.Binance, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Binance, AccountType.Margin)
    
    # Binance Futures
    self.SetBrokerageModel(BrokerageName.BinanceFutures, AccountType.Margin)
    self.SetBrokerageModel(BrokerageName.BinanceCoinFutures, AccountType.Margin)
    
    # Binance US Spot
    self.SetBrokerageModel(BrokerageName.BinanceUS, AccountType.Cash)

    To view the implementation of these models, see the following pages in the LEAN GitHub repository:

    Asset Classes

    The Binance brokerage models support trading Crypto and Crypto Futures .

    The Binance US brokerage model supports trading Crypto .

    Orders

    The Binance and Binance US brokerage models support several order types and order properties, but don't support order updates.

    Order Types

    The following table describes the available order types for each asset class that the Binance and Binance US brokerage models support:

    Order Type Crypto Crypto Futures
    MarketOrder green check green check
    LimitOrder green check green check
    StopLimitOrder green check

    Order Properties

    The Binance and Binance US brokerage models supports custom order properties. The following table describes the members of the BinanceOrderProperties object that you can set to customize order execution:

    Property Description
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    PostOnly A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new BinanceOrderProperties
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
            PostOnly = false
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new BinanceOrderProperties
                   { 
                       TimeInForce = TimeInForce.Day,
                       PostOnly = false
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new BinanceOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                       PostOnly = true
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = BinanceOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
        self.DefaultOrderProperties.PostOnly = False
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = BinanceOrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        order_properties.PostOnly = True
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The Binance and Binance US brokerage models don't support order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates .

    Fills

    The Binance brokerage models use the ImmediateFillModel .

    Slippage

    The Binance brokerage models use the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The following table shows the fee model that each Binance brokerage model uses:

    Brokerage Model Fee Model
    BinanceBrokerageModel BinanceFeeModel
    BinanceFuturesBrokerageModel BinanceFuturesFeeModel
    BinanceCoinFuturesBrokerageModel BinanceCoinFuturesFeeModel
    BinanceUSBrokerageModel BinanceFeeModel

    The Binance brokerage models use the default argument values for each fee model so that it models the current Binance fee schedule.

    Buying Power

    The Binance brokerage models use the CashBuyingPowerModel for cash accounts and the SecurityMarginModel for margin accounts.

    The following table shows the maximum leverage each brokerage model allows for margin accounts:

    Brokerage Model Maximum Leverage
    BinanceBrokerageModel 3
    BinanceFuturesBrokerageModel 25
    BinanceCoinFuturesBrokerageModel 25

    The BinanceUSBrokerageModel doesn't currently support margin trading.

    Settlement

    The Binance brokerage models use the ImmediateSettlementModel .

    Margin Interest Rate

    The following table shows the margin interest rate model that the Binance brokerages use:

    Brokerage Model Margin Interest Rate Model
    BinanceBrokerageModel NullMarginInterestRateModel
    BinanceFuturesBrokerageModel BinanceFutureMarginInterestRateModel for Crypto Perpetual Futures and NullMarginInterestRateModel for other assets
    BinanceCoinFuturesBrokerageModel BinanceFutureMarginInterestRateModel for Crypto Perpetual Futures and NullMarginInterestRateModel for other assets
    BinanceUSBrokerageModel NullMarginInterestRateModel

    Default Markets

    The following table shows the default market of the Binance brokerage models:

    Brokerage Model Market
    BinanceBrokerageModel Market.Binance
    BinanceFuturesBrokerageModel Market.Binance
    BinanceCoinFuturesBrokerageModel Market.Binance
    BinanceUSBrokerageModel Market.BinanceUS

     

    11.5.2.3 Bitfinex

    Introduction

    This page explains BitfinexBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The BitfinexBrokerageModel supports trading Crypto .

    Orders

    The BitfinexBrokerageModel supports several order types, order properties, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the BitfinexBrokerageModel supports:

    Order Type Crypto
    MarketOrder green check
    LimitOrder green check
    LimitIfTouchedOrder green check
    StopMarketOrder green check
    StopLimitOrder green check
    MarketOnOpenOrder green check
    MarketOnCloseOrder green check

    Order Properties

    The BitfinexBrokerageModel supports custom order properties. The following table describes the members of the BitfinexOrderProperties object that you can set to customize order execution:

    Property Description
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    Hidden A flag to signal that the order should be hidden. Hidden orders do not appear in the order book, so they do not influence other market participants. Hidden orders incur the taker fee.
    PostOnly A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new BitfinexOrderProperties
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
            Hidden = false,
            PostOnly = false
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new BitfinexOrderProperties
                   { 
                       TimeInForce = TimeInForce.Day,
                       Hidden = true,
                       PostOnly = false
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new BitfinexOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                       Hidden = false,
                       PostOnly = true
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = BitfinexOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
        self.DefaultOrderProperties.Hidden = False
        self.DefaultOrderProperties.PostOnly = False
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = BitfinexOrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        order_properties.Hidden = True
        order_properties.PostOnly = False
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        order_properties.Hidden = False
        order_properties.PostOnly = True
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The BitfinexBrokerageModel supports order updates .

    Fills

    The BitfinexBrokerageModel uses the ImmediateFillModel .

    Slippage

    The BitfinexBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The BitfinexBrokerageModel uses the BitfinexFeeModel with the default argument values that models the current Bitfinex fee schedule.

    Buying Power

    The BitfinexBrokerageModel uses the CashBuyingPowerModel for cash accounts and the SecurityMarginModel for margin accounts.

    If you have a margin account, the BitfinexBrokerageModel allows 3.3x leverage.

    Settlement

    The BitfinexBrokerageModel uses the ImmediateSettlementModel .

    Margin Interest Rate

    The BitfinexBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the BitfinexBrokerageModel is Market.Bitfinex .

     

    11.5.2.4 Coinbase

    Introduction

    This page explains GDAXBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash);
    self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The GDAXBrokerageModel supports trading Crypto .

    Orders

    The GDAXBrokerageModel supports several order types and order properties, but it doesn't support order updates.

    Order Types

    The following table describes the available order types for each asset class that the GDAXBrokerageModel supports:

    Order Type Crypto
    MarketOrder green check
    LimitOrder green check
    StopMarketOrder green check
    Supported after 2019-03-23 in backtests. For reference, see the Coinbase Market Structure Update on the Coinbase website.
    StopLimitOrder green check

    Order Properties

    The GDAXBrokerageModel supports custom order properties. The following table describes the members of the GDAXOrderProperties object that you can set to customize order execution:

    Property Description
    TimeInForce A TimeInForce instruction to apply to the order. The GoodTilCanceled TimeInForce is supported.
    PostOnly A flag that signals the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new GDAXOrderProperties
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
            PostOnly = false
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new GDAXOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilCanceled,
                       PostOnly = true
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = GDAXOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
        self.DefaultOrderProperties.PostOnly = False
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = GDAXOrderProperties()
        order_properties.TimeInForce = TimeInForce.GoodTilCanceled
        order_properties.PostOnly = True
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The GDAXBrokerageModel doesn't support order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates .

    Fills

    The GDAXBrokerageModel uses the ImmediateFillModel .

    Slippage

    The GDAXBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The GDAXBrokerageModel uses the GDAXFeeModel .

    Buying Power

    The GDAXBrokerageModel uses the CashBuyingPowerModel . The brokerage model doesn't currently support margin trading.

    Settlement

    The GDAXBrokerageModel uses the ImmediateSettlementModel .

    Margin Interest Rate

    The GDAXBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the GDAXBrokerageModel is Market.GDAX .

     

    11.5.2.5 Interactive Brokers

    Introduction

    This page explains InteractiveBrokersBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash);
    SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The InteractiveBrokersBrokerageModel supports the following asset classes:

    Orders

    The InteractiveBrokersBrokerageModel supports several order types, order properties, and order updates.

    Order Types

    The following table describes the order types that the InteractiveBrokersBrokerageModel supports: supports. For specific details about each order type, refer to the IB documentation.

    Order Type IB Documentation Page
    MarketOrder Market Orders
    LimitOrder Limit Orders
    LimitIfTouchedOrder Limit if Touched Orders
    StopMarketOrder Stop Orders
    StopLimitOrder Stop-Limit Orders
    MarketOnOpenOrder Market-on-Open (MOO) Orders
    MarketOnCloseOrder Market-on-Close (MOC) Orders
    ComboMarketOrder Spread Orders
    ComboLimitOrder Spread Orders
    ComboLegLimitOrder Spread Orders
    ExerciseOption Options Exercise

    The following table describes the available order types for each asset class that the InteractiveBrokersBrokerageModel supports:

    Order Type US Equity Equity Options Forex Futures Futures Options Index Options
    MarketOrder green check green check green check green check green check green check
    LimitOrder green check green check green check green check green check green check
    LimitIfTouchedOrder green check green check green check green check green check green check
    StopMarketOrder green check green check green check green check green check green check
    StopLimitOrder green check green check green check green check green check green check
    MarketOnOpenOrder green check green check green check green check
    MarketOnCloseOrder green check green check green check green check green check green check
    ComboMarketOrder green check green check green check
    ComboLimitOrder green check green check green check
    ComboLegLimitOrder green check green check green check
    ExerciseOption green check
    Not supported for cash-settled Options
    green check

    Order Properties

    The InteractiveBrokersBrokerageModel supports custom order properties. The following table describes the members of the InteractiveBrokersOrderProperties object that you can set to customize order execution. The table does not include the preceding methods for FA accounts.

    Property Description
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    OutsideRegularTradingHours A flag to signal that the order may be triggered and filled outside of regular trading hours.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new InteractiveBrokersOrderProperties
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
            OutsideRegularTradingHours = false
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       TimeInForce = TimeInForce.Day,
                       OutsideRegularTradingHours = false
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                       OutsideRegularTradingHours = true
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
        self.DefaultOrderProperties.OutsideRegularTradingHours = False
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = InteractiveBrokersOrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        order_properties.OutsideRegularTradingHours = True
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The InteractiveBrokersBrokerageModel supports order updates .

    Financial Advisor Group Orders

    To place FA group orders, see Financial Advisors .

    Fractional Trading

    The InteractiveBrokersBrokerageModel doesn't support fractional trading .

    Handling Splits

    If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

    Order Size Limits

    The InteractiveBrokersBrokerageModel enforces the Spot Currency Minimum/Maximum Order Sizes from the IB website.

    Fills

    The following table shows the fill model that the InteractiveBrokersBrokerageModel uses for each SecurityType :

    SecurityType Fill Model
    Equity EquityFillModel
    Future FutureFillModel
    FutureOption FutureOptionFillModel
    Remaining SecurityType values ImmediateFillModel

    Slippage

    The InteractiveBrokersBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The InteractiveBrokersBrokerageModel uses the InteractiveBrokersFeeModel with the default argument values. We model current Interactive Brokers fees on all assets.

    Buying Power

    The InteractiveBrokersBrokerageModel sets the buying power model based on the asset class of the security. The following table shows the default buying power model of each asset class:

    Asset Class Model
    Equity Options OptionMarginModel
    Futures FutureMarginModel
    Future Options FuturesOptionsMarginModel
    Index Options OptionMarginModel
    Crypto CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    CryptoFuture CryptoFutureMarginModel
    Forex CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    Other SecurityMarginModel

    If you have a margin account, the InteractiveBrokersBrokerageModel allows 2x leverage for Equities, 50x leverage for Forex, and 1x leverage for the remaining asset classes.

    Settlement

    The InteractiveBrokersBrokerageModel uses the ImmediateSettlementModel in most cases. If you trade US Equities or Equity Options with a cash account, it uses the DelayedSettlementModel with the default settlement rules .

    The following table shows which settlement model the InteractiveBrokersBrokerageModel uses based on the security type and your account type:

    Security Type Account Type Settlement Model
    Equity Cash DelayedSettlementModel with the default settlement rules
    Option Cash DelayedSettlementModel with the default settlement rules
    Future Any FutureSettlementModel

    For all other cases, the InteractiveBrokersBrokerageModel uses the ImmediateSettlementModel .

    // For US Equities with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For Equity Options with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime);
    
    // For remaining cases:
    security.SettlementModel = new ImmediateSettlementModel();
    # For US Equities with a cash account:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For Equity Options with a cash account:
    security.SettlementModel = DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime)
    
    # For remaining cases:
    security.SettlementModel = ImmediateSettlementModel()

    Interactive Brokers doesn't provide information on which assets aren't settled, so we assume each live trading session starts with its cash fully settled.

    Margin Interest Rate

    The InteractiveBrokersBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The following table describes the default markets of each SecurityType for the InteractiveBrokersBrokerageModel :

    SecurityType Market
    Equity USA
    Option USA
    Future CME
    FutureOption CME
    Index USA
    IndexOption USA
    Forex Oanda

    Financial Advisors

    IB supports FA accounts for Trading Firm and Institution organizations. FA accounts enable certified professionals to use a single trading algorithm to manage several client accounts.

    To place trades using a subset of client accounts, create Account Groups in Trader Workstation and then define the InteractiveBrokersOrderProperties when you create orders.

    DefaultOrderProperties = new InteractiveBrokersOrderProperties
    {
        FaGroup = "TestGroupEQ",
        FaMethod = "EqualQuantity",
        FaProfile = "TestProfileP",
        Account = "DU123456"
    };
    self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
    self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
    self.DefaultOrderProperties.FaMethod = "EqualQuantity"
    self.DefaultOrderProperties.FaProfile = "TestProfileP"
    self.DefaultOrderProperties.Account = "DU123456"

    SecurityHolding objects aggregate your positions across all the account groups. If you have two groups where group A has 10 shares of SPY and group B has -10 shares of SPY, then self.Portfolio["SPY"].Quantity Portfolio["SPY"].Quantity is zero.

    The following table shows the supported allocation methods for FA group orders:

    FaMethod Description
    "EqualQuantity" Distributes shares equally between all accounts in the group. If you use this method, specify an order quantity.
    "NetLiq" Distributes shares based on the net liquidation value of each account. The system calculates ratios based on the net liquidation value in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "AvailableEquity" Distributes shares based on the amount of available equity in each account. The system calculates ratios based on the available equity in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "PctChange" Increases or decreases an already existing position. Positive percents increase positions and negative percents decrease positions. If you use this method, specify a percent instead of an order quantity.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new InteractiveBrokersOrderProperties()
        {
            FaGroup = "TestGroupEQ",
            FaMethod = "EqualQuantity",
            FaProfile = "TestProfileP",
            Account = "DU123456"
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
    
        // Override the default order properties
        // "NetLiq" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "NetLiq" 
                   });
    
        // "AvailableEquity" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "AvailableEquity" 
                   });
        
        // "PctChange" requires a percentage of portfolio input
        SetHoldings(_symbol, pctPortfolio,
                    orderProperties: new InteractiveBrokersOrderProperties
                    { 
                        FaMethod = "PctChange" 
                    });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
        self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
        self.DefaultOrderProperties.FaMethod = "EqualQuantity"
        self.DefaultOrderProperties.FaProfile = "TestProfileP"
        self.DefaultOrderProperties.Account = "DU123456"
    
    def OnData(self, slice: Slice) -> None:
        # Override the default order properties
        # "NetLiq" requires a order size input
        order_properties = InteractiveBrokersOrderProperties()
        order_properties.FaMethod = "NetLiq"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "AvailableEquity" requires a order size input
        order_properties.FaMethod = "AvailableEquity"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "PctChange" requires a percentage of portfolio input
        order_properties.FaMethod = "PctChange"
        self.SetHoldings(self.symbol, pct_portfolio, orderProperties=order_properties)

     

    11.5.2.6 Kraken

    Introduction

    This page explains KrakenBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.Kraken, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Kraken, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The KrakenBrokerageModel supports trading Crypto .

    Orders

    The KrakenBrokerageModel supports several order types and order properties, but it doesn't support order updates.

    Order Types

    The following table describes the available order types for each asset class that the KrakenBrokerageModel supports:

    Order Type Crypto
    MarketOrder green check
    LimitOrder green check
    LimitIfTouchedOrder green check
    StopMarketOrder green check
    StopLimitOrder green check

    Order Properties

    The KrakenBrokerageModel supports custom order properties. The following table describes the members of the KrakenOrderProperties object that you can set to customize order execution:

    Property Description
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    PostOnly A flag to signal that the order must only add liquidity to the order book and not take liquidity from the order book. If part of the order results in taking liquidity rather than providing liquidity, the order is rejected without any part of it being filled.
    FeeInBase A flag to signal that the order fees should be paid in the base currency, which is the default behavior when selling. This flag must be the opposite of the FeeInQuote flag.
    FeeInQuote A flag to signal that the order fees should be paid in the quote currency, which is the default behavior when buying. This flag must be the opposite of the FeeInBase flag.
    NoMarketPriceProtection A flag to signal that no Market Price Protection should be used.
    ConditionalOrder An Order that's submitted when the primary order is executed. The ConditionalOrder quantity must match the primary order quantity and the ConditionalOrder direction must be the opposite of the primary order direction. This order property is only available for live algorithms.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new KrakenOrderProperties
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
            PostOnly = false,
            FeeInBase = true,
            FeeInQuote = false,
            NoMarketPriceProtection = true
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new KrakenOrderProperties
                   { 
                       TimeInForce = TimeInForce.Day,
                       PostOnly = true,
                       FeeInBase = false,
                       FeeInQuote = true,
                       NoMarketPriceProtection = true
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new KrakenOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)),
                       PostOnly = false,
                       FeeInBase = true,
                       FeeInQuote = false,
                       NoMarketPriceProtection = false,
                       ConditionalOrder = StopLimitOrder(_symbol, -quantity, stopLimitPrice, stopPrice)
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = KrakenOrderProperties()
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
        self.DefaultOrderProperties.PostOnly = False
        self.DefaultOrderProperties.FeeInBase = True
        self.DefaultOrderProperties.FeeInQuote = False
        self.DefaultOrderProperties.NoMarketPriceProtection = True
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = KrakenOrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        order_properties.PostOnly = True
        order_properties.FeeInBase = False
        order_properties.FeeInQuote = True
        order_properties.NoMarketPriceProtection = True
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        order_properties.PostOnly = False
        order_properties.FeeInBase = True
        order_properties.FeeInQuote = False
        order_properties.NoMarketPriceProtection = False
        order_properties.ConditionalOrder = StopLimitOrder(self.symbol, -quantity, stop_limit_price, stop_price)
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The KrakenBrokerageModel doesn't support order updates, but you can cancel an existing order and then create a new order with the desired arguments. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates .

    Fills

    The KrakenBrokerageModel uses the ImmediateFillModel .

    Slippage

    The KrakenBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The KrakenBrokerageModel uses the KrakenFeeModel .

    Buying Power

    The KrakenBrokerageModel uses the CashBuyingPowerModel for cash accounts and the SecurityMarginModel for margin accounts.

    If you have a margin account, the KrakenBrokerageModel allows 1x leverage for most Crypto pairs. The following table shows pairs that have additional leverage available:

    Quote Currency Base Currencies Leverage
    ADA BTC, ETH, USD, EUR 3
    BCH BTC, USD, EUR 2
    BTC USD, EUR
    5
    DASH BTC, USD, EUR 3
    EOS BTC, ETH, USD, EUR 3
    ETH BTC, USD, EUR 5
    LINK BTC, ETH, USD, EUR 3
    LTC BTC, USD, EUR 3
    REP BTC, ETH, USD, EUR 2
    TRX BTC, ETH, USD, EUR 3
    USDC USD, EUR 3
    USDT USD, EUR 2
    XMR BTC, USD, EUR 2
    XRP BTC, USD, EUR 3
    XTZ BTC, ETH, USD, EUR 2

    Settlement

    The KrakenBrokerageModel uses the ImmediateSettlementModel .

    Margin Interest Rate

    The KrakenBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the KrakenBrokerageModel is Market.Kraken .

     

    11.5.2.7 Oanda

    Introduction

    This page explains OandaBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The OandaBrokerageModel supports trading Forex and CFDs .

    Orders

    The OandaBrokerageModel supports several order types, the TimeInForce order property, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the OandaBrokerageModel supports:

    Order Type Forex CFD
    MarketOrder green check green check
    LimitOrder green check green check
    StopMarketOrder green check green check

    Time In Force

    The OandaBrokerageModel the GoodTilCanceled TimeInForce .

    DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
    LimitOrder(_symbol, quantity, limitPrice);
    self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    self.LimitOrder(self.symbol, quantity, limit_price)

    Updates

    The OandaBrokerageModel supports order updates .

    Fills

    The OandaBrokerageModel uses the ImmediateFillModel .

    Slippage

    The OandaBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The OandaBrokerageModel uses the ConstantFeeModel with zero fees. OANDA offers "Spread" and "Core + Commission" pricing models. Our data is the spread dataset, so we model the spread pricing. To estimate OANDA Core+Commission data, use a custom fee model and a custom fill model .

    security.SetFeeModel(new ConstantFeeModel(0.0m));
    security.SetFeeModel(ConstantFeeModel(0))

    Buying Power

    The OandaBrokerageModel uses the SecurityMarginModel and allows up to 50x leverage.

    Settlement

    The OandaBrokerageModel uses the ImmediateSettlementModel for Forex trades and the AccountCurrencyImmediateSettlementModel for CFD trades.

    Margin Interest Rate

    The OandaBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the OandaBrokerageModel is Market.Oanda .

     

    11.5.2.8 Samco

    Introduction

    This page explains SamcoBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.Samco, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Samco, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.Samco, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Samco, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The SamcoBrokerageModel supports trading the following asset classes:

    Orders

    The SamcoBrokerageModel supports several order types, order properties, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the SamcoBrokerageModel supports:

    Order Type India Equity
    MarketOrder green check
    LimitOrder green check
    StopMarketOrder green check

    Order Properties

    The SamcoBrokerageModel supports custom order properties. The following table describes the members of the IndiaOrderProperties object that you can set to customize order execution:

    Property Description
    Exchange Select the exchange for sending the order to. The following instructions are available:
    • NSE
    • BSE
    ProductType A ProductType instruction to apply to the order. The IndiaProductType enumeration has the following members:
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are available:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    public override void Initialize()
    {
        // Set default order properties
        DefaultOrderProperties = new IndiaOrderProperties(Exchange.NSE, IndiaOrderProperties.IndiaProductType.NRML)
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.MIS)
                   {
                       TimeInForce = TimeInForce.Day,
                   };
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.CNC)
                   {
                       TimeInForce = TimeInForce.GoodTilDate,
                   };
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = IndiaOrderProperties(Exchange.NSE, IndiaOrderProperties.IndiaProductType.NRML)
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.MIS)
        order_properties.TimeInForce = TimeInForce.Day
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties = IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.CNC)
        order_properties.TimeInForce = TimeInForce.GoodTilDate
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The SamcoBrokerageModel supports order updates .

    Handling Splits

    If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

    Fills

    The SamcoBrokerageModel uses the EquityFillModel .

    Slippage

    The SamcoBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The SamcoBrokerageModel uses the SamcoFeeModel .

    Buying Power

    The SamcoBrokerageModel uses the SecurityMarginModel . If you have a margin account, the SamcoBrokerageModel allows up to 5x leverage.

    Settlement

    The SamcoBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

    // For cash accounts:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For margin accounts:
    security.SettlementModel = new ImmediateSettlementModel();
    # For cash accounts:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For margin accounts:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The SamcoBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the SamcoBrokerageModel is Market.India .

     

    11.5.2.9 TD Ameritrade

    Introduction

    This page explains TDAmeritradeBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Cash);
    SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.TDAmeritrade, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The TDAmeritradeBrokerageModel supports trading US Equities .

    Orders

    The TDAmeritradeBrokerageModel supports several order types, order properties, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the TDAmeritradeBrokerageModel supports:

    Order Type Equity
    MarketOrder green check
    LimitOrder green check
    StopMarketOrder green check
    StopLimitOrder green check

    Time In Force

    The TDAmeritradeBrokerageModel supports the following TimeInForce instructions:

    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new TDAmeritradeOrderProperties
                   { 
                       TimeInForce = TimeInForce.Day
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new TDAmeritradeOrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day))
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = TDAmeritradeOrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The TDAmeritradeBrokerageModel supports order updates .

    Handling Splits

    If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

    Fills

    The TDAmeritradeBrokerageModel uses the EquityFillModel .

    Slippage

    The TDAmeritradeBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The TDAmeritradeBrokerageModel uses the TDAmeritradeFeeModel .

    Buying Power

    The TDAmeritradeBrokerageModel uses the SecurityMarginModel . If you have a margin account, the TDAmeritradeBrokerageModel allows up to 2x leverage.

    Settlement

    The TDAmeritradeBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

    // For cash accounts:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For margin accounts:
    security.SettlementModel = new ImmediateSettlementModel();
    # For cash accounts:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For margin accounts:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The TDAmeritradeBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the TDAmeritradeBrokerageModel is Market.USA .

     

    11.5.2.10 Tradier

    Introduction

    This page explains TradierBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Cash);
    SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.TradierBrokerage, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The TradierBrokerageModel supports trading US Equities and Equity Options .

    Orders

    The TradierBrokerageModel supports several order types, order properties, and most order updates.

    Order Types

    The following table describes the available order types for each asset class that the TradierBrokerageModel supports:

    Order Type Equity Equity Options
    MarketOrder green check green check
    LimitOrder green check green check
    StopMarketOrder green check green check
    StopLimitOrder green check green check

    Time In Force

    The TradierBrokerageModel supports the following TimeInForce instructions:

    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new OrderProperties
                   { 
                       TimeInForce = TimeInForce.Day 
                   });
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new OrderProperties
                   { 
                       TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day)) 
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = OrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties.TimeInForce = TimeInForce.GoodTilDate(datetime(year, month, day))
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The TradierBrokerageModel supports most order updates . To update the quantity of an order, cancel the order and then submit a new order with the desired quantity. For more information about this workaround, see the Workaround for Brokerages That Don’t Support Updates .

    Extended Market Hours

    The TradierBrokerageModel doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order will be processed at market open.

    Automatic Cancellations

    If you have open orders for a security when it performs a reverse split, the TradierBrokerageModel automatically cancels your orders.

    Errors

    To view the order-related error codes from Tradier, see Error Responses in their documentation.

    Fills

    The TradierBrokerageModel uses the EquityFillModel for Equity trades and the ImmediateFillModel for Option trades.

    Slippage

    The TradierBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The TradierBrokerageModel uses the ConstantFeeModel with zero fees.

    security.SetFeeModel(new ConstantFeeModel(0.0m));
    security.SetFeeModel(ConstantFeeModel(0))

    Buying Power

    The TradierBrokerageModel uses the OptionMarginModel for Option trades and the SecurityMarginModel for Equity trades.

    If you have a margin account, the TradierBrokerageModel allows 2x leverage for Equities.

    Settlement

    The TradierBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

    // For US Equities with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For Equity Options with a cash account:
    security.SettlementModel = new DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime);
    
    // For remaining cases:
    security.SettlementModel = new ImmediateSettlementModel();
    # For US Equities with a cash account:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For Equity Options with a cash account:
    security.SettlementModel = DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime)
    
    # For remaining cases:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The TradierBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the TradierBrokerageModel is Market.USA .

     

    11.5.2.11 Trading Technologies

    Introduction

    This page explains TradingTechnologiesBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Cash);
    SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.TradingTechnologies, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The TradingTechnologiesBrokerageModel supports trading Futures .

    Orders

    The TradingTechnologiesBrokerageModel supports several order types, some TimeInForce order properties, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the TradingTechnologiesBrokerageModel supports:

    Order Type Futures
    MarketOrder green check
    LimitOrder green check
    StopMarketOrder green check
    StopLimitOrder green check

    The TradingTechnologiesBrokerageModel enforces the following order rules:

    Time In Force

    The TradingTechnologiesBrokerageModel supports the Day and GoodTilCanceled TimeInForce order properties.

    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new OrderProperties
                   { 
                       TimeInForce = TimeInForce.Day 
                   });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = OrderProperties()
        order_properties.TimeInForce = TimeInForce.Day
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The TradingTechnologiesBrokerageModel supports order updates .

    Fills

    The TradingTechnologiesBrokerageModel uses the FutureFillModel .

    Slippage

    The TradingTechnologiesBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The TradingTechnologiesBrokerageModel uses the ConstantFeeModel with zero fees.

    security.SetFeeModel(new ConstantFeeModel(0.0m));
    security.SetFeeModel(ConstantFeeModel(0))

    Buying Power

    The TradingTechnologiesBrokerageModel uses the FutureMarginModel .

    Settlement

    The TradingTechnologiesBrokerageModel uses the FutureSettlementModel .

    Margin Interest Rate

    The TradingTechnologiesBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the TradierBrokerageModel is Market.CME .

     

    11.5.2.12 Wolverine

    Introduction

    This page explains WolverineBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.Wolverine, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Wolverine, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.Wolverine, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Wolverine, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The WolverineBrokerageModel supports trading US Equities .

    Orders

    The WolverineBrokerageModel supports one order type, but doesn't support order updates or extended market hours trading.

    Order Types

    The WolverineBrokerageModel supports market orders .

    Updates

    The WolverineBrokerageModel doesn't support order updates.

    Extended Market Hours

    The WolverineBrokerageModel doesn't support extended market hours trading. If you place an order outside of regular trading hours, the order is invalid.

    Fills

    The WolverineBrokerageModel uses the EquityFillModel for Equity trades.

    Slippage

    The WolverineBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The WolverineBrokerageModel uses the WolverineFeeModel .

    Buying Power

    The WolverineBrokerageModel uses the SecurityMarginModel . If you have a margin account, the WolverineBrokerageModel allows up to 2x leverage.

    Settlement

    The WolverineBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

    // For cash accounts:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For margin accounts:
    security.SettlementModel = new ImmediateSettlementModel();
    # For cash accounts:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For margin accounts:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The WolverineBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the WolverineBrokerageModel is Market.USA .

     

    11.5.2.13 Zerodha

    Introduction

    This page explains ZerodhaBrokerageModel , including the asset classes it supports, its default security-level models , and it's default markets.

    SetBrokerageModel(BrokerageName.Zerodha, AccountType.Cash);
    SetBrokerageModel(BrokerageName.Zerodha, AccountType.Margin);
    self.SetBrokerageModel(BrokerageName.Zerodha, AccountType.Cash)
    self.SetBrokerageModel(BrokerageName.Zerodha, AccountType.Margin)

    To view the implementation of this model, see the LEAN GitHub repository .

    Asset Classes

    The ZerodhaBrokerageModel supports trading Indian Equities .

    Orders

    We model the Zerodha API by supporting several order types, order properties, and order updates.

    Order Types

    The following table describes the available order types for each asset class that the ZerodhaBrokerageModel supports:

    Order Type India Equity
    MarketOrder green check
    LimitOrder green check
    StopMarketOrder green check
    StopLimitOrder green check

    Order Properties

    The ZerodhaBrokerageModel supports custom order properties. The following table describes the members of the IndiaOrderProperties object that you can set to customize order execution:

    Property Description
    Exchange Select the exchange for sending the order to. The following instructions are supported:
    • NSE
    • BSE
    ProductType A ProductType instruction to apply to the order. The IndiaProductType enumeration has the following members:
    TimeInForce A TimeInForce instruction to apply to the order. The following instructions are supported:
    • Day
    • GoodTilCanceled
    • GoodTilDate
    public override void Initialize()
    {
        // Set default order properties
        DefaultOrderProperties = new IndiaOrderProperties(Exchange.NSE, IndiaOrderProperties.IndiaProductType.NRML)
        {
            TimeInForce = TimeInForce.GoodTilCanceled,
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
        
        // Override the default order properties
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.MIS)
                   {
                       TimeInForce = TimeInForce.Day,
                   };
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.CNC)
                   {
                       TimeInForce = TimeInForce.GoodTilDate,
                   };
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = IndiaOrderProperties(Exchange.NSE, IndiaOrderProperties.IndiaProductType.NRML)
        self.DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled
    
    def OnData(self, slice: Slice) -> None:
        # Use default order order properties
        self.LimitOrder(self.symbol, quantity, limit_price)
        
        # Override the default order properties
        order_properties = IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.MIS)
        order_properties.TimeInForce = TimeInForce.Day
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        order_properties = IndiaOrderProperties(Exchange.BSE, IndiaOrderProperties.IndiaProductType.CNC)
        order_properties.TimeInForce = TimeInForce.GoodTilDate
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)

    Updates

    The ZerodhaBrokerageModel supports order updates .

    Handling Splits

    If you're using raw data normalization and you have active orders with a limit, stop, or trigger price in the market for a US Equity when a stock split occurs, the following properties of your orders automatically adjust to reflect the stock split:

    Fills

    The ZerodhaBrokerageModel uses the EquityFillModel .

    Slippage

    The ZerodhaBrokerageModel uses the ConstantSlippageModel with zero slippage.

    security.SetSlippageModel(new ConstantSlippageModel(0));
    security.SetSlippageModel(ConstantSlippageModel(0))

    Fees

    The ZerodhaBrokerageModel uses the ZerodhaFeeModel .

    Buying Power

    The ZerodhaBrokerageModel uses the SecurityMarginModel . If you have a margin account, the ZerodhaBrokerageModel allows up to 5x leverage.

    Settlement

    The ZerodhaBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts.

    // For cash accounts:
    security.SettlementModel = new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime);
    
    // For margin accounts:
    security.SettlementModel = new ImmediateSettlementModel();
    # For cash accounts:
    security.SettlementModel = DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)
    
    # For margin accounts:
    security.SettlementModel = ImmediateSettlementModel()

    Margin Interest Rate

    The ZerodhaBrokerageModel uses the NullMarginInterestRateModel .

    Default Markets

    The default market of the ZerodhaBrokerageModel is Market.India .

     

    11.6 Buying Power

    Introduction

    Buying power models (also known as margin models) control how much buying power or leverage your portfolio has to make trades. When you place an order, LEAN uses the buying power model to determine whether the order should be submitted so you avoid placing orders that would be rejected by the brokerage. Buying power calculations can be very complex and depend on many factors, including the brokerage or even the time of day. For example, the PatternDayTradingMarginModel lets you have 4x leverage during regular trading hours and 2x leverage during pre-market and post-market trading hours.

    What is Buying Power?

    Buying power is the total amount of money you can spend in your brokerage account. It depends on the security type and account type. On one hand, Option and Future contracts are leveraged securities with specific buying power rules. On the other hand, the buying power of cash accounts is just the cash in the account while the buying power of margin accounts is leveraged by the brokerage credit.

    What is Margin?

    Margin is a credit loan from your brokerage you receive after you deposit collateral into your margin account. You need margin to place short-biased trades and you can use margin to increase your buying power, but you incur interest fees. Margin is the dollar value of the loan that the brokerage gives you. A margin requirement of 25% means that to purchase $10,000 worth of securities, you need at least $2,500 worth of collateral in your brokerage account to open the trade and you can borrow the rest on margin. Maintenance margin is the minimum equity (equity = total portfolio value - borrowed funds) you must have in your brokerage account to stay in your positions. If the value of your portfolio falls below the maintenance margin, you receive a margin call. If you receive a margin call, you either need to add more capital to your brokerage account or the brokerage will liquidate some of your holdings to reduce your exposure and their risk.

    What is Leverage?

    Leverage is using borrowed money to increase your buying power. Leverage has an inverse relationship with your margin requirement and maintenance margin. If you have a margin requirement of 50%, you can use up to 1 / 50% = 2 leverage. Trading with leverage can be risky. It can boost your returns on profitable trades but can make your losing trades more expensive. If you have $10,000 in your brokerage margin account and purchase $20,000 worth of securities, you are trading with 2x leverage. If the value of the securities in your portfolio drops by 50% when you have a 2x leverage position, you lose all of your equity.

    Set Models

    The brokerage model of your algorithm automatically sets the buying power model for each security, but you can override it. To manually set the buying power model of a security, call the SetBuyingPowerModel method on the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    security.SetBuyingPowerModel(new SecurityMarginModel(3m));
    # In Initialize
    security = self.AddEquity("SPY")
    security.SetFeeModel(SecurityMarginModel(3))

    You can also set the buying power model in a security initializer . If your algorithm has a universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetBuyingPowerModel(new SecurityMarginModel(3m));    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetBuyingPowerModel(SecurityMarginModel(3))

    Supported Models

    The following buying power models are available:

    Default Behavior

    The brokerage model of your algorithm automatically sets the buying power model of each security. The default brokerage model is the DefaultBrokerageModel , which sets the buying power model based on the asset class of the security. The following table shows the default buying power model of each asset class:

    Asset Class Model
    Equity Options OptionMarginModel
    Futures FutureMarginModel
    Future Options FuturesOptionsMarginModel
    Index Options OptionMarginModel
    Crypto CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    CryptoFuture CryptoFutureMarginModel
    Forex CashBuyingPowerModel for cash accounts or SecurityMarginModel for margin accounts
    Other SecurityMarginModel

    Model Structure

    Buying power models should extend the BuyingPowerModel class. Extensions of the BuyingPowerModel class should implement the following methods:

    class MyBuyingPowerModel : BuyingPowerModel
    {
        public MyBuyingPowerModel(
            decimal leverage = 2m,
            decimal requiredFreeBuyingPowerPercent = 0m)
            : base(leverage, requiredFreeBuyingPowerPercent)
        {
        }
    
        public override decimal GetLeverage(Security security)
        {
           return base.GetLeverage(security);
        }
    
        public override void SetLeverage(Security security, decimal leverage)
        {
            base.SetLeverage(security, leverage);
        }
    
        public override InitialMargin GetInitialMarginRequiredForOrder(
            InitialMarginRequiredForOrderParameters parameters)
        {
            return base.GetInitialMarginRequiredForOrder(parameters);
        }
    
        public override MaintenanceMargin GetMaintenanceMargin(
            MaintenanceMarginParameters parameters)
        {
            return base.GetMaintenanceMargin(parameters);
        }
    
        protected override decimal GetMarginRemaining(
            SecurityPortfolioManager portfolio,
            Security security,
            OrderDirection direction)
        {
            return base.GetMarginRemaining(portfolio, security, direction);
        }
    
        public override InitialMargin GetInitialMarginRequirement(
            InitialMarginParameters parameters)
        {
            return base.GetInitialMarginRequirement(parameters);
        }
    
        public override HasSufficientBuyingPowerForOrderResult HasSufficientBuyingPowerForOrder(HasSufficientBuyingPowerForOrderParameters parameters)
        {
            return base.HasSufficientBuyingPowerForOrder(parameters);
        }
    
        public override GetMaximumOrderQuantityResult GetMaximumOrderQuantityForDeltaBuyingPower(GetMaximumOrderQuantityForDeltaBuyingPowerParameters parameters)
        {
            return base.GetMaximumOrderQuantityForDeltaBuyingPower(parameters);
        }
    
        public override GetMaximumOrderQuantityResult GetMaximumOrderQuantityForTargetBuyingPower(GetMaximumOrderQuantityForTargetBuyingPowerParameters parameters)
        {
            return base.GetMaximumOrderQuantityForTargetBuyingPower(parameters);
        }
    
        public override ReservedBuyingPowerForPosition GetReservedBuyingPowerForPosition(
            ReservedBuyingPowerForPositionParameters parameters)
        {
            return base.GetReservedBuyingPowerForPosition(parameters);
        }
    
        public override BuyingPower GetBuyingPower(BuyingPowerParameters parameters)
        {
            return base.GetBuyingPower(parameters);
        }
    }
    class MyBuyingPowerModel(BuyingPowerModel):
        def __init__(self,
             leverage = 2: float,
             requiredFreeBuyingPowerPercent = 0: float):
            super().__init__(leverage, requiredFreeBuyingPowerPercent)
    
        def GetLeverage(self, security: Security) -> float: 
            return super().GetLeverage(security)
    
        def SetLeverage(self, security: Security, leverage: float) -> None: 
            super().SetLeverage(security, leverage)
    
        def GetInitialMarginRequiredForOrder(self,
             parameters: InitialMarginRequiredForOrderParameters) -> InitialMargin:
            return super().GetInitialMarginRequiredForOrder(parameters)
    
        def GetMaintenanceMargin(self,
             parameters: MaintenanceMarginParameters) -> MaintenanceMargin: 
            return super().GetMaintenanceMargin(parameters)
    
        def GetMarginRemaining(self,
             portfolio: SecurityPortfolioManager,
             security: Security,
             direction: OrderDirection) -> float: 
            return super().GetMarginRemaining(portfolio, security, direction)
    
        def GetInitialMarginRequirement(self,
             parameters: InitialMarginParameters) -> InitialMargin:
            return super().GetInitialMarginRequirement(parameters)
    
        def HasSufficientBuyingPowerForOrder(self, 
             parameters: HasSufficientBuyingPowerForOrderParameters
            ) -> HasSufficientBuyingPowerForOrderResult: 
            return super().HasSufficientBuyingPowerForOrder(parameters)
    
        def GetMaximumOrderQuantityForDeltaBuyingPower(self, 
             parameters: GetMaximumOrderQuantityForDeltaBuyingPowerParameters
            ) -> GetMaximumOrderQuantityResult:
            return super().GetMaximumOrderQuantityForDeltaBuyingPower(parameters)
    
        def GetMaximumOrderQuantityForTargetBuyingPower(self, 
             parameters: GetMaximumOrderQuantityForTargetBuyingPowerParameters
            ) -> GetMaximumOrderQuantityResult:
            return super().GetMaximumOrderQuantityForTargetBuyingPower(parameters)
    
        def GetReservedBuyingPowerForPosition(self, 
             parameters: ReservedBuyingPowerForPositionParameters
            ) -> ReservedBuyingPowerForPosition:
            return super().GetReservedBuyingPowerForPosition(parameters)
    
        def GetBuyingPower(self,
             parameters: BuyingPowerParameters) -> BuyingPower:
            return super().GetBuyingPower(parameters)
    

    Disable Buying Power

    In live trading, orders can pass the validations associated with buying power in LEAN and let your brokerage decide to accept or reject them. To disable the validations of the default buying power model , use the NullBuyingPowerModel .

    To set the NullBuyingPowerModel for a security subscription, call the SetBuyingPowerModel method with the BuyingPowerModel.Null argument.

    // In Initialize
    var equity = AddEquity("SPY");
    equity.SetBuyingPowerModel(BuyingPowerModel.Null);
    # In Initialize
    equity = self.AddEquity("SPY")
    equity.SetBuyingPowerModel(BuyingPowerModel.Null)

    You can call the SetMarginModel method with the SecurityMarginModel.Null argument to achive the same result.

    You can also set the asset NullBuyingPowerModel in a security initializer. In order to set the buying power of securities in the security initializer, call SetSecurityInitializer before you create security subscriptions and after you call SetBrokerageModel .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the security buying power        
            security.SetBuyingPowerModel(BuyingPowerModel.Null);    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the security buying power        
            security.SetBuyingPowerModel(BuyingPowerModel.Null)

    Set Asset Leverage

    The buying power model sets the leverage for each security in your algorithm, but you can override its leverage settings after the buying power model is set.

    To set the leverage when you create a security subscription, pass in a leverage argument.

    // In Initialize
    AddEquity("SPY", leverage: 3);
    # In Initialize
    AddEquity("SPY", leverage=3)

    You can also set the asset leverage in a security initializer. In order to set the leverage of securities in the security initializer, call SetSecurityInitializer before you create security subscriptions and before you call SetBrokerageModel . If you pass in a leverage argument when you create the security subscription, the leverage argument takes precedence over the SetLeverage call in the security initializer.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the security leverage        
            security.SetLeverage(3);    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the security leverage        
            security.SetLeverage(3)

    To set the leverage for all securities in a universe, set the UniverseSettings.Leverage property.

    // In Initialize
    UniverseSettings.Leverage = 3;
    # In Initialize
    self.UniverseSettings.Leverage = 3

    In live trading, LEAN doesn't ignore the leverage you set. However, if you set a different leverage from what your brokerage provides, it creates a mismatch between the buying power in your algorithm and the buying power the brokerage gives you. In this case, orders can pass the validations in LEAN but your brokerage may reject them.

    PDT Rule

    If all of the following statements are true, you are classified as a pattern day trader:

    Pattern day traders must maintain a minimum equity of $25,000 in their margin account to continue trading. For more information about pattern day trading, see Am I a Pattern Day Trader? on the FINRA website.

    The PatternDayTradingMarginModel doesn't enforce minimum equity rules and doesn't limit your trades, but it adjusts your available leverage based on the market state. During regular market hours, you can use up to 4x leverage. During extended market hours, you can use up to 2x leverage.

    security.MarginModel = new PatternDayTradingMarginModel();
    security.MarginModel = PatternDayTradingMarginModel()

    Examples

    Demonstration Algorithms
    CustomBuyingPowerModelAlgorithm.py Python CustomModelsAlgorithm.py Python NullBuyingPowerOptionBullCallSpreadAlgorithm.py Python CustomBuyingPowerModelAlgorithm.cs C# CustomModelsAlgorithm.cs C# NullBuyingPowerOptionBullCallSpreadAlgorithm.cs C#

     

    11.7 Settlement

    11.7.1 Key Concepts

    Introduction

    After you trade an asset, the brokerage needs to settle the funds in your account. The most common type of settlement is immediate, where the funds are immediately available for trading after the transaction. In some cases, you may have delayed settlement, where you sell an asset and need to wait a few days to spend the cash you receive from the sale. A settlement model simulates these settlement rules.

    Set Models

    The brokerage model of your algorithm automatically sets the settlement model for each security, but you can override it. To manually set the settlement model of a security, set the SettlementModel property on the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    // Set a delayed settlement model that settles 7 days after the trade at 8 AM
    security.SettlementModel = new DelayedSettlementModel(7, TimeSpan.FromHours(8));
    # In Initialize
    security = self.AddEquity("SPY")
    # Set a delayed settlement model that settles 7 days after the trade at 8 AM
    security.SettlementModel = DelayedSettlementModel(7, timedelta(hours=8))

    You can also set the settlement model in a security initializer . If your algorithm has a universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SettlementModel = new DelayedSettlementModel(7, TimeSpan.FromHours(8));    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SettlementModel = DelayedSettlementModel(7, timedelta(hours=8))

    To view all the pre-built settlement models, see Supported Models .

    Default Behavior

    The brokerage model of your algorithm automatically sets the settlement model for each security. The default brokerage model is the DefaultBrokerageModel , which sets the settlement model based on the security type and your account type. The following table shows how it sets the settlement models:

    Security Type Account Type Settlement Model
    Equity Cash DelayedSettlementModel with the default settlement rules
    Option Cash DelayedSettlementModel with the default settlement rules
    Future Any FutureSettlementModel

    For all other cases, the DefaultBrokerageModel uses the ImmediateSettlementModel .

    The default delayed settlement rule for US Equity trades is T+2 at 8 AM Eastern Time (ET). For example, if you sell on Monday, the trade settles on Wednesday at 8 AM. The default delayed settlement rule for Future and Option contracts is T+1 at 8 AM.

    Model Structure

    Settlement models must extend the ISettlementModel interface. Extensions of the ISettlementModel interface must implement the Scan and ApplyFunds methods. The Scan method is automatically called at the top of each hour and it receives a ScanSettlementModelParameters object. The ApplyFunds method receives an ApplyFundsSettlementModelParameters object and applies the settlement rules. The ApplyFunds method is also automatically called, but its frequency depends on the security type.

    public interface ISettlementModel
    {
        void ApplyFunds(ApplyFundsSettlementModelParameters applyFundsParameters);
    
        void Scan(ScanSettlementModelParameters settlementParameters);
    }

    The ApplyFunds method is automatically called when you fill an order for the following security types:

    The ApplyFunds method is automatically called when you close a position for the following security types:

    ApplyFundsSettlementModelParameters objects have the following properties:

    ScanSettlementModelParameters objects have the following properties:

    You likely don't need to create a custom settlement model because the supported models already implement immediate and delayed settlement rules.

     

    11.7.2 Supported Models

    Introduction

    This page describes all of the pre-built settlement models in LEAN. For more brokerage-specific settlement models, see the brokerage model documentation . If none of these models perform exactly how you want, create a custom settlement model .

    Immediate Model

    The ImmediateSettlementModel immediately adds or removes the cash from your portfolio when your transactions fill.

    security.SettlementModel = new ImmediateSettlementModel();
    security.SettlementModel = ImmediateSettlementModel()

    To view the implementation of this model, see the LEAN GitHub repository .

    Delayed Model

    The DelayedSettlementModel immediately removes the cash from your portfolio when your buy orders fill. When your sell orders fill, it adds the cash to your unsettled cash book . When the settlement period ends, the unsettled cash is added to your portfolio.

    security.SettlementModel = new DelayedSettlementModel(7, TimeSpan.FromHours(8));
    security.SettlementModel = DelayedSettlementModel(7, timedelta(hours=8))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    numberOfDays int The number of days required for settlement
    timeOfDay TimeSpan timedelta The time of day used for settlement

    To view the implementation of this model, see the LEAN GitHub repository .

    Account Currency Immediate Model

    The AccountCurrencyImmediateSettlementModel applies cash settlement immediately and automatically converts the settlement cash into the account currency.

    security.SettlementModel = new AccountCurrencyImmediateSettlementModel();
    security.SettlementModel = AccountCurrencyImmediateSettlementModel()

    To view the implementation of this model, see the LEAN GitHub repository .

    Future Model

    The FutureSettlementModel settles the daily profit and loss at the start of each day.

    security.SettlementModel = new FutureSettlementModel();
    security.SettlementModel = FutureSettlementModel()

    To view the implementation of this model, see the LEAN GitHub repository .

     

    11.8 Options Models

    11.8.1 Pricing

    Introduction

    Option price models compute the theoretical price of Option contracts, their implied volatility, and their Greek values. Theoretical prices can help you detect undervalued and overvalued contracts, implied volatility can provide you insight into the upcoming volatility of the underlying security, and Greek values can help you hedge your portfolio.

    What are Greeks?

    Option Greeks measure the exposure of Option price or Option delta to the movement of different factors such as the underlying price, time, and volatility. The Greeks are a function of implied volatility. For more information about them, see The Greek Letters .

    What Is Implied Volatility?

    Implied volatility is the forecasted future volatility of a security. The Option price model uses the realized volatility to calculate the implied volatility. By default, it uses the formula from Brenner and Subrahmanyam (1988) as the initial guess for implied volatility.

    \[ \frac{P}{S} \sqrt{\frac{2\pi}{T}} \]

    where \(P\) is the Option contract price, \(S\) is the underlying price, and \(T\) is the time until Option expiration.

    If the volatility model of the underlying security is ready , the price model uses its value as the initial guess for implied volatility and as an input to calculate the theoretical contract prices.

    Set Models

    To set the pricing model of an Option, set its PriceModel property.

    If you have access to the Option object when you subscribe to the Option universe or contract, you can set the price model immediately after you create the subscription.

    // In Initialize
    var option = AddOption("SPY");
    option.PriceModel = OptionPriceModels.CrankNicolsonFD();
    # In Initialize
    option = self.AddOption("SPY")
    option.PriceModel = OptionPriceModels.CrankNicolsonFD()

    Otherwise, set the price model in a security initializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the price model        
            if (security.Type == SecurityType.Option) // Option type
            {
                security.PriceModel = OptionPriceModels.CrankNicolsonFD();
            }    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the price model        
            if security.Type == SecurityType.Option: # Option type
                security.PriceModel = OptionPriceModels.CrankNicolsonFD()

    Supported Models

    LEAN supports the following Option price models. QLNet provides the underlying implementation of these models.

    Model American Style European Style
    AdditiveEquiprobabilities green check green check
    BaroneAdesiWhaley green check
    BinomialCoxRossRubinstein green check green check
    BinomialJarrowRudd green check green check
    BinomialJoshi green check green check
    BinomialLeisenReimer green check green check
    BinomialTian green check green check
    BinomialTrigeorgis green check green check
    BjerksundStensland green check
    BlackScholes
    green check
    CrankNicolsonFD green check green check
    Integral
    green check

    If you set the price model of an Option to a model with an incompatible style, LEAN throws an exception.

    Default Behavior

    The default Option pricing model is the BjerksundStensland for American Options or BlackScholes for European Options.

    Disable Pricing

    To turn off the Option price model, use the CurrentPriceOptionPriceModel . This model sets the Greeks to 0, sets the implied volatility to 0, and sets the theoretical price to the current price.

    option.PriceModel = new CurrentPriceOptionPriceModel();
    option.PriceModel = CurrentPriceOptionPriceModel()

    Examples

    Demonstration Algorithms
    BasicTemplateOptionsHistoryAlgorithm.py Python BasicTemplateOptionsPriceModel.py Python BasicTemplateMultiAssetAlgorithm.cs C# BasicTemplateOptionsHistoryAlgorithm.cs C#

     

    11.8.2 Volatility

    11.8.2.1 Key Concepts

    Introduction

    Volatility models measure the historical volatility of an asset. They are mostly used to calculate the volatility of the underlying security of an Option because the implied volatility of an Option contract needs an initial guess. The historical volatility doesn't need to be the standard deviation of the asset prices. The various volatility models in LEAN each have a unique methodology to calculate volatility.

    Set Models

    To set the volatility model of the underlying security of an Option, set the VolatilityModel property of the Security object. The volatility model can have a different resolution than the underlying asset subscription.

    // In Initialize
    var underlyingSecurity= AddEquity("SPY");
    underlyingSecurity.VolatilityModel = new StandardDeviationOfReturnsVolatilityModel(30);
    # In Initialize
    underlying_security = self.AddEquity("SPY")
    underlying_security.VolatilityModel = StandardDeviationOfReturnsVolatilityModel(30)

    You can also set the volatility model in a security initializer . If your algorithm has a universe of underlying assets, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the volatility model        
            if (security.Type == SecurityType.Equity)
            {
                security.VolatilityModel = new StandardDeviationOfReturnsVolatilityModel(30);
            }    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the volatility model        
            if security.Type == SecurityType.Equity:
                security.VolatilityModel = StandardDeviationOfReturnsVolatilityModel(30)

    To view all the pre-built volatility models, see Supported Models .

    Default Behavior

    The default underlying volatility model for Equity Options and Index Options is the StandardDeviationOfReturnsVolatilityModel based on 30 days of daily resolution data. The default underlying volatility model for Future Options is the NullVolatilityModel .

    Model Structure

    Volatility models should extend the BaseVolatilityModel class. Extensions of the BaseVolatilityModel class must have Update and GetHistoryRequirements methods and a Volatility property. The Update method receives Security and BaseData objects and then updates the Volatility . The GetHistoryRequirements method receives Security and DateTime datetime objects and then returns a list of HistoryRequest objects that represent the history requests to warm up the model. Volatility models receive data at each time step in the algorithm to update their state.

    public class MyVolatilityModel : BaseVolatilityModel
    {
        public override decimal Volatility { get; }
    
        public override void SetSubscriptionDataConfigProvider(
            ISubscriptionDataConfigProvider subscriptionDataConfigProvider)
        {
            SubscriptionDataConfigProvider = subscriptionDataConfigProvider;
        }
    
        public override void Update(Security security, BaseData data)
        {
        }
    
        public override IEnumerable<HistoryRequest> GetHistoryRequirements(
            Security security,
            DateTime utcTime)
        {
            return base.GetHistoryRequirements(security, utcTime);
        }
    
        public IEnumerable<HistoryRequest> GetHistoryRequirements(
            Security security, 
            DateTime utcTime,
            Resolution? resolution,
            int barCount)
        {
            return base.GetHistoryRequirements(security, utcTime, resolution, barCount);
        }
    }
    class MyVolatilityModel(BaseVolatilityModel):
        Volatility: float = 0
    
        def SetSubscriptionDataConfigProvider(self,
             subscriptionDataConfigProvider: ISubscriptionDataConfigProvider) -> None:
            SubscriptionDataConfigProvider = subscriptionDataConfigProvider
    
        def Update(self, security: Security, data: BaseData) -> None:
            pass
    
        def GetHistoryRequirements(self,
             security: Security,
             utcTime: datetime,
             resolution: Resolution = None,
             barCount: int = None) -> List[HistoryRequest]:
            return super().GetHistoryRequirements(security, utcTime, resolution, barCount)

    Warm Up Models

    To use your volatility model as the inital guess for the implied volatility , warm up the volatility model of the underlying security. If you subscribe to all the Options in the Initialize method, set a warm-up period to warm up their volatility models. The warm-up period should provide the volatility models with enough data to compute their values.

    // In Initialize
    SetWarmUp(30, Resolution.Daily);
    
    // In OnData
    if (IsWarmingUp) return;
    # In Initialize
    self.SetWarmUp(30, Resolution.Daily)
    
    # In OnData
    if self.IsWarmingUp:
        return

    If you have a dynamic universe of underlying assets and add Option contracts to your algorithm with the AddOptionContract , AddIndexOptionContract , or AddFutureOptionContract methods, warm up the volatility model when the underlying asset enters your universe. We recommend you do this inside a security initializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices), this));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        private QCAlgorithm _algorithm;
    
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder, QCAlgorithm algorithm)
            : base(brokerageModel, securitySeeder) 
        {
            _algorithm = algorithm;
        }    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite and warm up the volatility model        
            if (security.Type == SecurityType.Equity) // Underlying asset type
            {
                security.VolatilityModel = new StandardDeviationOfReturnsVolatilityModel(30);
                foreach (var tradeBar in _algorithm.History(security.Symbol, 30, Resolution.Daily))
                {
                    security.VolatilityModel.Update(security, tradeBar);
                }
            }    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices), self))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder, algorithm: QCAlgorithm) -> None:
            super().__init__(brokerage_model, security_seeder)
            self.algorithm = algorithm
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite and warm up the volatility model        
            if security.Type == SecurityType.Equity:  # Underlying asset type
                security.VolatilityModel = StandardDeviationOfReturnsVolatilityModel(30)
                trade_bars = self.algorithm.History[TradeBar](security.Symbol, 30, Resolution.Daily)
                for trade_bar in trade_bars:
                    security.VolatilityModel.Update(security, trade_bar)

    Examples

    Demonstration Algorithms
    CustomVolatilityModelAlgorithm.py Python CustomVolatilityModelAlgorithm.cs C#

     

    11.8.2.2 Supported Models

    Introduction

    This page describes all of the pre-built volatility models in LEAN. If none of these models perform exactly how you want, create a custom volatility model .

    Null Model

    The NullVolatilityModel sets the volatility of the security to zero. It's the default volatility model for the underlying asset of Future Options.

    underlyingSecurity.VolatilityModel = VolatilityModel.Null;
    underlying_security.VolatilityModel = VolatilityModel.Null

    To view the implementation of this model, see the LEAN GitHub repository .

    Standard Deviation of Returns Model

    The StandardDeviationOfReturnsVolatilityModel sets the volatility of the security to the annualized sample standard deviation of trailing returns. It's the default volatility model for the underlying asset of Equity Options and Index Options.

    underlyingSecurity.VolatilityModel = new StandardDeviationOfReturnsVolatilityModel(30);
    underlying_security.VolatilityModel = StandardDeviationOfReturnsVolatilityModel(30)

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    periods int The max number of samples to use when calculating the standard deviation of returns. This value must be greater than two.
    resolution Resolution? Resolution / NoneType The resolution of the price data used to calculate the standard deviation. This only has a material effect in live mode. For backtesting, this value does not cause any behavioral changes.
    null None
    updateFrequency TimeSpan? timedelta / NoneType The frequency at which new values are inserted into the rolling window for the standard deviation calculation. If the value is null None , it defaults to the TimeSpan timedelta representation of resolution . If the value and resolution are null None , it defaults to a TimeSpan timedelta of one day. null None

    To view the implementation of this model, see the LEAN GitHub repository .

    Relative Standard Deviation Model

    The RelativeStandardDeviationVolatilityModel sets the volatility of the security to the relative standard deviation of its price. In symbols, the value is

    $$ \frac{|\mu|}{\sigma} $$

    where $\mu$ is the average of the samples and $\sigma$ is the standard deviation of the samples.

    underlyingSecurity.VolatilityModel = new RelativeStandardDeviationVolatilityModel(TimeSpan.FromDays(1), 10);
    underlying_security.VolatilityModel = RelativeStandardDeviationVolatilityModel(timedelta(days=1), 10)

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    periodSpan TimeSpan timedelta The period of time to wait between each sample of the security price
    periods int The number of samples to use to calculate the volatility value

    To view the implementation of this model, see the LEAN GitHub repository .

     

    11.8.3 Exercise

    Introduction

    If you exercise a long Option position or are assigned on your short Option position, LEAN processes an Option exercise order. The Option exercise model converts the Option exercise order into an OrderEvent .

    Set Models

    To set the exercise model of an Option, call the SetOptionExerciseModel method of the Option object.

    If you have access to the Option object when you subscribe to the Option universe or contract, you can set the exercise model immediately after you create the subscription.

    // In Initialize
    var option = AddOption("SPY");
    option.SetOptionExerciseModel(new DefaultExerciseModel());
    # In Initialize
    option = AddOption("SPY")
    option.SetOptionExerciseModel(DefaultExerciseModel())

    Otherwise, set the assignment model in a security initializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the exercise model        
            if (security.Type == SecurityType.Option) // Option type
            {
                option.SetOptionExerciseModel(new DefaultExerciseModel());
            }    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the exercise model        
            if security.Type == SecurityType.Option: # Option type
                option.SetOptionExerciseModel(DefaultExerciseModel())

    Default Behavior

    The default Option exercise model is the DefaultExerciseModel . The DefaultExerciseModel fills exercise orders to the full quantity with zero fees and applies an order tag to represent if the order is an exercise or assignment. To view the implementation of this model, see the LEAN GitHub repository .

    Model Structure

    Option exercise models should implement the IOptionExerciseModel interface. The IOptionExerciseModel interface must implement the OptionExercise method, which receives Option and OptionExerciseOrder objects and then returns a list of OrderEvent objects that contain the order fill information.

    Option exercise models must implement the OptionExercise method, which receives Option and OptionExerciseOrder objects and then returns a list of OrderEvent objects that contain the order fill information.

    public class MyExerciseModel : IOptionExerciseModel
    {
        public override IEnumerable<OrderEvent> OptionExercise(Option option, OptionExerciseOrder order)
        {
            var inTheMoney = option.IsAutoExercised(option.Underlying.Close);
            var isAssignment = inTheMoney && option.Holdings.IsShort;
    
            yield return new OrderEvent(
                order.Id,
                option.Symbol,
                option.LocalTime.ConvertToUtc(option.Exchange.TimeZone),
                OrderStatus.Filled,
                Extensions.GetOrderDirection(order.Quantity),
                0.0m,
                order.Quantity,
                OrderFee.Zero,
                "Tag"
            ) { IsAssignment = isAssignment };
        }
    }
    class MyExerciseModel:
        def OptionExercise(self, option: Option, order: OptionExerciseOrder) -> List[OrderEvent]:
            in_the_money = option.IsAutoExercised(option.Underlying.Close)
            is_assignment = in_the_money and option.Holdings.IsShort
    
            order_event = OrderEvent(
                order.Id,
                option.Symbol,
                Extensions.ConvertToUtc(option.LocalTime, option.Exchange.TimeZone),
                OrderStatus.Filled,
                Extensions.GetOrderDirection(order.Quantity),
                0.0,
                order.Quantity,
                OrderFee.Zero,
                "Tag"
            )
            order_event.IsAssignment = is_assignment
            return [ order_event ]

    OptionExerciseOrder objects have the following properties:

    The following table describes the arguments of the OrderEvent constructor:

    Argument Details

    Argument: orderId

    Id of the parent order

    Data Type: int | Default Value: -

    Argument: symbol

    Asset Symbol

    Data Type: Symbol | Default Value: -

    Argument: utcTime

    Date/time of this event

    Data Type: DateTime datetime | Default Value: -

    Argument: direction

    The direction of the order. The OrderDirection enumeration has the following members:

    Data Type: OrderDirection | Default Value: Hold

    Argument: fillPrice

    Fill price information if applicable

    Data Type: decimal float | Default Value: 0

    Argument: fillQuantity

    Fill quantity

    Data Type: decimal float | Default Value: 0

    Argument: orderFee

    The order fee. You can use OrderFee.Zero or create an OrderFee object with a custom fee.

    new OrderFee(new CashAmount(0.5m, "USD")); OrderFee(CashAmount(0.5, 'USD'))

    Data Type: OrderFee | Default Value: -

    Argument: message

    Message from the exchange

    Data Type: string str | Default Value: ""

    OrderEvent objects have the following attributes:

    Examples

    Demonstration Algorithms
    CustomOptionExerciseModelRegressionAlgorithm.py Python CustomOptionExerciseModelRegressionAlgorithm.cs C#

     

    11.8.4 Assignment

    Introduction

    If you sell an Option in a backtest, an assignment model can simulate an Option exercise order on behalf of the buyer and assign you to complete the requirements of the contract.

    Set Models

    To set the assignment model of an Option, call the SetOptionAssignmentModel method of the Option object.

    If you have access to the Option object when you subscribe to the Option universe or contract, you can set the assignment model immediately after you create the subscription.

    // In Initialize
    var option = AddOption("SPY");
    option.SetOptionAssignmentModel(new DefaultOptionAssignmentModel());
    # In Initialize
    option = AddOption("SPY")
    option.SetOptionAssignmentModel(DefaultOptionAssignmentModel())

    Otherwise, set the assignment model in a security initializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the assignment model        
            if (security.Type == SecurityType.Option) // Option type
            {
                option.SetOptionAssignmentModel(new DefaultOptionAssignmentModel());
            }    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the assignment model        
            if security.Type == SecurityType.Option: # Option type
                option.SetOptionAssignmentModel(DefaultOptionAssignmentModel())

    Default Behavior

    The default Option assignment model is the DefaultOptionAssignmentModel . The DefaultOptionAssignmentModel scans your portfolio every hour. It considers exercising American-style Options if they are within 4 days of their expiration and it considers exercising European-style Options on their day of expiration. If you have sold an Option that's 5% in-the-money and the Option exercise order is profitable after the cost of fees, this model exercises the Option.

    To view the implementation of this model, see the LEAN GitHub repository .

    Model Structure

    Option assignment models should implement the IOptionAssignmentModel interface. Extensions of the IOptionAssignmentModel interface must implement the GetAssignment method, which automatically fires at the top of each hour and returns the Option assignments to generate.

    public class MyOptionAssignmentModel : IOptionAssignmentModel 
    {
        public OptionAssignmentResult GetAssignment(OptionAssignmentParameters parameters)
        {
            var option = parameters.Option;
            if (IsInTheMoney(option))
            {
                return new OptionAssignmentResult(option.Holdings.AbsoluteQuantity, "tag");
            }
            return OptionAssignmentResult.Null;
        }
    }
    class MyOptionAssignmentModel:
    
        def GetAssignment(self, parameters: OptionAssignmentParameters) -> OptionAssignmentResult:
            option = parameters.Option
            if self.IsInTheMoney(option):
                return OptionAssignmentResult(option.Holdings.AbsoluteQuantity, "tag")
            return OptionAssignmentResult.Null

    The OptionAssignmentParameters object has the following members:

    To exercise the Option, return an OptionAssignmentResult with a positive quantity. Otherwise, return OptionAssignmentResult.Null . The OptionAssignmentResult constructor accepts the following arguments:

    Argument Data Type Description Default Value
    quantity decimal float The quantity to assign
    tag string str The order tag to use

    Disable Assignments

    To disable Option assignments, set the Option assignment model to the NullOptionAssignmentModel .

    option.SetOptionAssignmentModel(new NullOptionAssignmentModel());
    option.SetOptionAssignmentModel(NullOptionAssignmentModel())

    Examples

    Demonstration Algorithms
    CustomOptionAssignmentRegressionAlgorithm.py Python CustomOptionAssignmentRegressionAlgorithm.cs C#

     

    11.9 Margin Interest Rate

    11.9.1 Key Concepts

    Introduction

    Margin interest is a cost associated with trading on margin. Margin interest rate models model margin interest cash flows by directly adding or removing cash from your portfolio.

    Set Models

    The brokerage model of your algorithm automatically sets the margin interest rate model for each security, but you can override it. To manually set the margin interest rate model of a security, assign a model to the MarginInterestRateModel property of the Security object.

    // In Initialize
    var security = AddEquity("SPY");
    security.MarginInterestRateModel = MarginInterestRateModel.Null;
    # In Initialize
    security = self.AddEquity("SPY")
    security.SetMarginInterestRateModel(MarginInterestRateModel.Null)

    You can also set the margin interest rate model in a security initializer . If your algorithm has a dynamic universe, use the security initializer technique. In order to initialize single security subscriptions with the security initializer, call SetSecurityInitializer before you create the subscriptions.

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.MarginInterestRateModel = MarginInterestRateModel.Null;    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetMarginInterestRateModel(MarginInterestRateModel.Null)

    To view all the pre-built margin interest rate models, see Supported Models .

    Default Behavior

    The brokerage model of your algorithm automatically sets the margin interest rate model of each security. The default brokerage model is the DefaultBrokerageModel , which sets the NullMarginInterestRateModel .

    Model Structure

    Margin interest rate models should implement the IMarginInterestRateModel interface. Extensions of the IMarginInterestRateModel interface must implement the ApplyMarginInterestRate method, which applies margin interest payments to the portfolio.

    public class MyMarginInterestRateModel : IMarginInterestRateModel 
    {
        public void ApplyMarginInterestRate(MarginInterestRateParameters marginInterestRateParameters) 
        {
            var holdings = marginInterestRateParameters.Security.Holdings;
            var positionValue = holdings.GetQuantityValue(holdings.Quantity);
            positionValue.Cash.AddAmount(-1);
        }
    }
    class MyMarginInterestRateModel:
    
        def ApplyMarginInterestRate(self, marginInterestRateParameters: MarginInterestRateParameters) -> None:
            holdings = marginInterestRateParameters.Security.Holdings
            position_value = holdings.GetQuantityValue(holdings.Quantity)
            position_value.Cash.AddAmount(-1)

    The ApplyMarginInterestRate method is automatically called at the top of each hour.

     

    11.9.2 Supported Models

    Introduction

    This page describes the pre-built margin interest rate models in LEAN. If none of these models perform exactly how you want, create a custom margin interest rate model .

    Null Model

    The NullMarginInterestRateModel doesn't charge any margin interest. It's the default margin interest rate of the DefaultBrokerageModel .

    security.MarginInterestRateModel = MarginInterestRateModel.Null;
    security.MarginInterestRateModel = MarginInterestRateModel.Null

    To view the implementation of this model, see the LEAN GitHub repository .

    Binance Futures Model

    The BinanceFutureMarginInterestRateModel simulates the margin cost and payments of your Crypto Future holdings. When the funding rate is positive, the price of the perpetual contract is higher than the mark price, so traders who are long pay for short positions. Conversely, a negative funding rate indicates that perpetual prices are below the mark price, so traders who are short pay for long positions. The interest amount is

    $$ Nominal \ Value \ of \ Positions * Funding \ Rate $$

    The interest amount is periodically credited or debited from your currency holdings while you hold open positions. The interest amount is charged at 12 AM, 8 AM, 4 PM in your algorithm time zone .

    security.MarginInterestRateModel = new BinanceFutureMarginInterestRateModel();
    security.MarginInterestRateModel = BinanceFutureMarginInterestRateModel()

    To view the implementation of this model, see the LEAN GitHub repository .

     

    11.10 Margin Calls

    Introduction

    If the value of your portfolio falls below the maintenance margin, you receive a margin call. If you receive a margin call, you either need to add more capital to your brokerage account or the brokerage will liquidate some of your holdings to reduce your exposure and their risk. A margin call model monitors the margin levels of your portfolio, issues margin call warnings, and submits orders when margin calls occur.

    Set Models

    To set the margin call model, set the MarginCallModel property of the Portfolio object.

    // In Initialize
    Portfolio.MarginCallModel = new DefaultMarginCallModel(Portfolio, DefaultOrderProperties);
    
    # In Initialize
    self.Portfolio.MarginCallModel = DefaultMarginCallModel(self.Portfolio, self.DefaultOrderProperties)
    

    Default Behavior

    The brokerage model of your algorithm automatically sets the margin call model for the portfolio. The default brokerage model is the DefaultBrokerageModel , which sets the DefaultMarginCallModel . The DefaultMarginCallModel issues margin call warnings when the margin remaining in your portfolio is less than or equal to 5% of the total portfolio value. When a margin call occurs, this model sorts the generated margin call orders in ascending order by their unrealized profit and then executes each order synchronously until your portfolio is within the margin requirements.

    Model Structure

    Margin call models must extend the DefaultMarginCallModel class. Extensions of the DefaultMarginCallModel class can override the GetMarginCallOrders and ExecuteMarginCall methods.

    The GetMarginCallOrders method scans the portfolio and the updated data for a potential margin call situation that may get the holdings below zero. The method must return a list of SubmitOrderRequest objects that represent the margin call orders. To issue a margin call warning during this method, set the issueMarginCallWarning argument of the method to true.

    The ExecuteMarginCall method receives the list of SubmitOrderRequest objects from the GetMarginCallOrders method, executes some of them, and returns a list of OrderTicket objects.

    public class MyMarginCallModel : DefaultMarginCallModel
    {
        public MyMarginCallModel(
            SecurityPortfolioManager portfolio,
            IOrderProperties defaultOrderProperties)
            : base(portfolio, defaultOrderProperties)
        {
        }
    
        public override List<OrderTicket> ExecuteMarginCall(
            IEnumerable<SubmitOrderRequest> generatedMarginCallOrders)
        {
            return base.ExecuteMarginCall(generatedMarginCallOrders)
        }
    
        public List<SubmitOrderRequest> GetMarginCallOrders(out bool issueMarginCallWarning)
        {
            return base.GetMarginCallOrders(issueMarginCallWarning)
        }
    }
    class MyMarginCallModel(DefaultMarginCallModel):
        def __init__(self,
             portfolio: SecurityPortfolioManager,
             defaultOrderProperties: IOrderProperties):
            super().__init__(portfolio, defaultOrderProperties)
    
        def ExecuteMarginCall(self,
             generatedMarginCallOrders: List[SubmitOrderRequest]) -> List[OrderTicket]:
            return super().ExecuteMarginCall(generatedMarginCallOrders)
    
        def GetMarginCallOrders(self,
             issueMarginCallWarning: bool) -> List[SubmitOrderRequest]:
            return super().GetMarginCallOrders(issueMarginCallWarning)

    Disable Margin Calls

    To disable margin calls, set the margin call model to the NullMarginCallModel .

    Portfolio.MarginCallModel = MarginCallModel.Null;
    
    self.Portfolio.MarginCallModel = MarginCallModel.Null
    

    Monitor Margin Call Events

    When the margin call model of your portfolio issues a margin call warning, we notify your algorithm through the OnMarginCallWarning event handler.

    public override void OnMarginCallWarning()
    {
        Debug("Warning: Close to margin call");
    }
    def OnMarginCallWarning(self) -> None:
        self.Debug(f"Warning: Close to margin call")

    Before we send the orders that the margin call model produces, we notify your algorithm through the OnMarginCall event handler. This notification gives your algorithm a chance to liquidate some positions or modify the margin call orders. To modify the orders, adjust the list of SubmitOrderRequest objects the event handler receives.

    public override void OnMarginCall(List<SubmitOrderRequest> requests)
    {
        for (var i = 0; i < requests.Count; i++)
        {
            var order = requests[i];
            // liquidate an extra 10% each time you get a margin call to give yourself more padding
            var newQuantity = (int)(order.Quantity * 1.1m);
            requests[i] = new SubmitOrderRequest(order.OrderType, order.SecurityType, 
                                                order.Symbol, newQuantity, order.StopPrice, 
                                                order.LimitPrice, 0, Time, "OnMarginCall");
        }
    }
    def OnMarginCall(self, requests: List[SubmitOrderRequest]) -> List[SubmitOrderRequest]:
        for i, order in enumerate(requests):
            # liquidate an extra 10% each time you get a margin call to give yourself more padding
            new_quantity = int(order.Quantity * 1.1)
            requests[i] = SubmitOrderRequest(order.OrderType, order.SecurityType, 
                                            order.Symbol, new_quantity, order.StopPrice, 
                                            order.LimitPrice, 0, self.Time, "OnMarginCall")
        return requests

    Submit Order Request

    If you receive a margin call or create a margin call model, you'll need to work with SubmitOrderRequest objects. These objects have the following properties:

    The following table describes the arguments of the SubmitOrderRequest constructor:

    Argument Data Type Description Default Value
    orderType OrderType The order type to be submitted
    securityType SecurityType The security type of the asset
    symbol Symbol The symbol to be traded
    quantity decimal float The number of units to order
    stopPrice decimal float The stop price for stop orders
    limitPrice decimal float The limit price for limit orders
    triggerPrice decimal float The trigger price for limit if touched orders
    time DateTime datetime The time this request was created
    tag string str A custom tag for this request
    properties IOrderProperties The order properties for this request null None

    Examples

    Demonstration Algorithms
    MarginCallEventsAlgorithm.py Python MarginCallEventsAlgorithm.cs C#

     

    12 Scheduled Events

    Introduction

    Scheduled Events let you trigger code to run at specific times of day, regardless of your algorithm's data subscriptions. It's easier and more reliable to execute time-based events with Scheduled Events than checking the current algorithm time in the OnData event handler.

    Create Scheduled Events

    To create a Scheduled Event, call the Schedule.On method. The method expects a DateRules object, a TimeRules object, and a function to execute. The following examples demonstrate some common Scheduled Events.

    Schedule Events Before Market Open

    You may want to train a model or fetch historical data before the market opens. The following example demonstrates how to set a Scheduled Event for 10 minutes before the market opens.

    Schedule.On(DateRules.EveryDay("SPY"),
                TimeRules.AfterMarketOpen("SPY", -10),
                BeforeMarketOpen);
    self.Schedule.On(self.DateRules.EveryDay("SPY"),
                     self.TimeRules.AfterMarketOpen("SPY", -10),
                     self.BeforeMarketOpen)

    Schedule Events on the Last Trading Day of the Week

    You may want to rebalance your portfolio on the last trading day of each week and factor in market holidays. The following example demonstrates how to set a Scheduled Event for the last trading day of each week 30 minutes before the market closes.

    Schedule.On(DateRules.WeekEnd("SPY"),
                TimeRules.BeforeMarketClose("SPY", 30),
                Rebalance);
    self.Schedule.On(self.DateRules.WeekEnd("SPY"),
                     self.TimeRules.BeforeMarketClose("SPY", 30),
                     self.Rebalance)

    Schedule Events on Regular Intervals Throughout the Trading Day

    You may want to perform some action on a regular interval through each trading day. The following example demonstrates how to set a Scheduled Event for every 30 minutes through the trading day for SPY.

    Schedule.On(DateRules.EveryDay("SPY"),
                TimeRules.Every(TimeSpan.FromMinutes(30)),
                SomeAction);
    self.Schedule.On(self.DateRules.EveryDay("SPY"),
                     self.TimeRules.Every(timedelta(minutes=30)),
                     self.SomeAction)

    Date Rules

    The following table describes the supported DateRules :

    Member Description
    self.DateRules.SetDefaultTimeZone(time_zone: DateTimeZone) DateRules.SetDefaultTimeZone(DateTimeZone timeZone); Sets the time zone for the DateRules object used in all methods in this table. The default time zone is the algorithm time zone .
    self.DateRules.On(year: int, month: int, day: int) DateRules.On(int year, int month, int day) Trigger an event on a specific date.
    self. DateRules.EveryDay() Trigger an event every day.
    self.DateRules.EveryDay(symbol: Symbol) DateRules.EveryDay(Symbol symbol) Trigger an event every day a specific symbol is trading.
    self.DateRules.Every(days: List[DayOfWeek]) DateRules.Every(params DayOfWeek[] days) Trigger an event on specific days throughout the week. To view the DayOfWeek enum members, see DayOfWeek Enum in the .NET documentation.
    self.DateRules.MonthStart(daysOffset: int = 0) DateRules.MonthStart(int daysOffset = 0) Trigger an event on the first day of each month plus an offset.
    self.DateRules.MonthStart(symbol: Symbol, daysOffset: int = 0) DateRules.MonthStart(Symbol symbol, int daysOffset = 0) Trigger an event on the first tradable date of each month for a specific symbol plus an offset.
    self.DateRules.MonthEnd(daysOffset: int = 0) DateRules.MonthEnd(int daysOffset = 0) Trigger an event on the last day of each month minus an offset.
    self.DateRules.MonthEnd(symbol: Symbol, daysOffset: int = 0) DateRules.MonthEnd(Symbol symbol, int daysOffset = 0) Trigger an event on the last tradable date of each month for a specific symbol minus an offset.
    self.DateRules.WeekStart(daysOffset: int = 0) DateRules.WeekStart(int daysOffset = 0) Trigger an event on the first day of each week plus an offset.
    self.DateRules.WeekStart(symbol: Symbol, daysOffset: int = 0) DateRules.WeekStart(Symbol symbol, int daysOffset = 0) Trigger an event on the first tradable date of each week for a specific symbol plus an offset.
    self.DateRules.WeekEnd(daysOffset: int = 0) DateRules.WeekEnd(int daysOffset = 0) Trigger an event on the last day of each week minus an offset.
    self.DateRules.WeekEnd(symbol: Symbol, daysOffset: int = 0) DateRules.WeekEnd(Symbol symbol, int daysOffset = 0) Trigger an event on the last tradable date of each week for a specific symbol minus an offset.
    self. DateRules.Today Trigger an event once today.
    self. DateRules.Tomorrow Trigger an event once tomorrow.

    Time Rules

    The following table describes the supported TimeRules :

    Member Description
    self.TimeRules.SetDefaultTimeZone(time_zone: DateTimeZone) TimeRules.SetDefaultTimeZone(DateTimeZone timeZone) Sets the time zone for the TimeRules object used in all methods in this table, except when a different time zone is given. The default time zone is the algorithm time zone .
    self.TimeRules.AfterMarketOpen(symbol: Symbol, minutesAfterOpen: float = 0, extendedMarketOpen: bool = False) TimeRules.AfterMarketOpen(Symbol symbol, double minutesAfterOpen = 0, bool extendedMarketOpen = false) Trigger an event a few minutes after market open for a specific symbol (default is 0). This rule doesn't work for Crypto securities or custom data.
    self.TimeRules.BeforeMarketClose(symbol: Symbol, minutesBeforeClose: float = 0, extendedMarketOpen: bool = False) TimeRules.BeforeMarketClose(Symbol symbol, double minutesBeforeClose = 0, bool extendedMarketOpen = false) Trigger an event a few minutes before market close for a specific symbol (default is 0). This rule doesn't work for Crypto securities or custom data.
    self.TimeRules.Every(interval: timedelta) TimeRules.Every(TimeSpan interval) Trigger an event every period interval starting at midnight.
    self. TimeRules.Now Trigger an event at the current time of day.
    self. TimeRules.Midnight Trigger an event at midnight.
    self. TimeRules.Noon Trigger an event at noon.
    self.TimeRules.At(hour: int, minute: int, second: int = 0) TimeRules.At(int hour, int minute, int second = 0) Trigger an event at a specific time of day (e.g. 13:10).
    self.TimeRules.At(hour: int, minute: int, second: int, time_zone: DateTimeZone) TimeRules.At(int hour, int minute, int second, DateTimeZone timeZone) Trigger an event at a specific time of day in the given time zone (e.g. 13:10 UTC).

    Remove Scheduled Events

    If you no longer need a Scheduled Event in your algorithm, remove it so your algorithm doesn't execute unnecessary functions. To remove a Scheduled Event, save a reference to the Scheduled Event when you create it and then call the Remove method to remove it.

    // Create a Scheduled Event
    var scheduledEvent = Schedule.On(DateRules.EveryDay("SPY"),
                                     TimeRules.AfterMarketOpen("SPY", 10),
                                     tenMinutesAfterOpen);
    
    // Remove the Scheduled Event
    Schedule.Remove(scheduledEvent);
    
    # Create a Scheduled Event
    scheduled_event = self.Schedule.On(self.DateRules.EveryDay("SPY"),
                                       self.TimeRules.AfterMarketOpen("SPY", 10),       
                                       self.ten_minutes_after_open)
    
    # Remove the Scheduled Event
    self.Schedule.Remove(scheduled_event)

    Common Errors

    Common errors with Scheduled Events include stale fills and execution timeouts.

    Stale Fills

    A common error is to subscribe to daily resolution data and set a Scheduled Event intraday to place trades. If you trade intraday with daily data, you get stale fills.

    Another common error is to set a Scheduled Event to trade immediately after the market open on illiquid securities. Illiquid securities can have no trades for the first few minutes after the market open. If you trade during this time, you get stale fills.

    Execution Timeouts

    If your Scheduled Event takes longer than 10 minutes to execute, your algorithm will timeout. To increase the amount of time that your Scheduled Event can run, replace your Scheduled Event with a training session .

    Execution Sequence

    The algorithm manager calls events in the following order:

    1. Scheduled Events
    2. Consolidation event handlers
    3. OnData event handler

    This event flow is important to note. For instance, if your consolidation handlers or OnData event handler appends data to a RollingWindow and you use that RollingWindow in your Scheduled Event, when the Scheduled Event executes, the RollingWindow won't contain the most recent data.

    Live Trading Considerations

    In live trading, Scheduled Events execute in a parallel thread based on a real-time clock. If you set a Scheduled Event to fire at 10:00 AM, it executes at exactly 10:00 AM. In backtesting, Scheduled Events are part of the main algorithm manager loop, so they may not execute exactly when you set them. For example, if your algorithm subscribes to minute resolution US Equity data with regular trading hours and you set a Scheduled Event to occur at 2:00 AM, your Scheduled Event will execute at 9:31 AM when the next bar is fed into your algorithm.

    The difference between live trading and backtesting is important to note because it can affect your algorithm's behavior. There are two common scenarios to consider.

    Execution Timing and Backtest Timeouts

    Take the following scenario:

    In this scenario, the Scheduled Events each fire at the correct time and execute without error in live trading. In backtesting, all of the Scheduled Events execute at 9:31 AM when your algorithm receives the first bar of the trading day. Since all the Scheduled Events take eight minutes to execute, the algorithm tries to execute all the Scheduled Events but reaches the 10-minute timeout and the backtest stops execution.

    Live Data Delays

    In backtests, your algorithm receives data at perfect timing. If you request minute resolution data, your algorithm receives the bars at the top of each minute. In live trading, bars have a slight delay, so you may receive them milliseconds after the top of each minute. Take the following scenario:

    In live trading, the Scheduled Event executes at exactly 10:00 AM but your algorithm may receive the 9:59-10:00 AM bar at 10:00:00.01 AM. Therefore, when you check the price in the Scheduled Event, the price from the 9:58-9:59 AM bar is the latest price. In backtesting, the Scheduled Event gets the price from the 9:59-10:00 AM bar since your algorithm receives the bar at perfect timing.

    Examples

    // Schedule an event to fire at a specific date/time
    Schedule.On(DateRules.On(2013, 10, 7),
                TimeRules.At(13, 0),
                () => Log($"SpecificTime: Fired at : {Time}"));
    
    // Schedule an event to fire every trading day for a security
    // The time rule here tells it to fire at 13:00:00 UTC
    Schedule.On(DateRules.EveryDay("SPY"),
                TimeRules.At(13, 0, 0, TimeZones.Utc),
                () => Log($"EveryDay.SPY SpecificTime: Fired at: {Time}"));
                
    // Schedule an event to fire every trading day for a security
    // The time rule here tells it to fire 10 minutes after SPY's market open
    Schedule.On(DateRules.EveryDay("SPY"),
                TimeRules.AfterMarketOpen("SPY", 10),
                () => Log($"EveryDay.SPY 10 min after open: Fired at: {Time}"));
    
    // Schedule an event to fire every trading day for a security
    // The time rule here tells it to fire 10 minutes before SPY's market close
    Schedule.On(DateRules.EveryDay("SPY"),
                TimeRules.BeforeMarketClose("SPY", 10),
                () => Log($"EveryDay.SPY 10 min before close: Fired at: {Time}"));
    
    // Schedule an event to fire on certain days of the week
    Schedule.On(DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday),
                TimeRules.At(12, 0),
                () => Log($"Mon/Fri at 12pm: Fired at: {Time}"));
    
    // Schedule an event to fire once today at when this method is called (now)
    Schedule.On(DateRules.Today,
                TimeRules.Now,
                () => Log($"Now: Fired at: {Time}"));
    
    // Schedule an event to fire once tomorrow at midnight
    Schedule.On(DateRules.Tomorrow,
                TimeRules.Midnight,
                () => Log($"Tomorrow at midnight: Fired at: {Time}"));
    
    // Schedule an event to fire once today at noon
    Schedule.On(DateRules.Today,
                TimeRules.Noon,
                () => Log($"Today at noon: Fired at: {Time}"));
    
    // The scheduling methods return the ScheduledEvent object which can be used 
    // for other things here I set the event up to check the portfolio value every
    // 10 minutes, and liquidate if we have too many losses
    Schedule.On(DateRules.EveryDay(), 
                TimeRules.Every(TimeSpan.FromMinutes(10)),
                LiquidateUnrealizedLosses);
                
    // Schedule an event to fire at the beginning of the month, the symbol is optional. 
    // if specified, it will fire the first trading day for that symbol of the month,
    // if not specified it will fire on the first day of the month
    Schedule.On(DateRules.MonthStart("SPY"),
                TimeRules.AfterMarketOpen("SPY"),
                RebalancingCode);
    
    // Schedule an event to fire at the end of the month, the symbol is optional. 
    // if specified, it will fire the last trading day for that symbol of the month,
    // if not specified it will fire on the first day of the month
    Schedule.On(DateRules.MonthEnd("SPY"),
                TimeRules.BeforeMarketClose("SPY"),
                RebalancingCode);
    
    // Schedule an event to fire at the beginning of the week, the symbol is optional. 
    // if specified, it will fire the first trading day for that symbol of the week,
    // if not specified it will fire on the first day of the week
    Schedule.On(DateRules.WeekStart("SPY"),
                TimeRules.AfterMarketOpen("SPY", 5),
                RebalancingCode);
    
    // Schedule an event to fire at the end of the week, the symbol is optional. 
    // if specified, it will fire the last trading day for that symbol of the week,
    // if not specified it will fire on the first day of the week
    Schedule.On(DateRules.WeekEnd("SPY"),
                TimeRules.BeforeMarketClose("SPY", 5),
                RebalancingCode);
    
    
    // The following methods are not defined in Initialize:
    private void LiquidateUnrealizedLosses()
    {
        // if we have over 1000 dollars in unrealized losses, liquidate
        if (Portfolio.TotalUnrealizedProfit < -1000)
        {
            Log($"Liquidated due to unrealized losses at: {Time}");
            Liquidate();
        }
    }
    
    private void RebalancingCode()
    {
        // Good spot for rebalancing code?
    }            
    
    # Schedule an event to fire at a specific date/time
    self.Schedule.On(self.DateRules.On(2013, 10, 7), 
                     self.TimeRules.At(13, 0), 
                     lambda: self.Log(f"SpecificTime: Fired at : {self.Time}"))
    
    # Schedule an event to fire every trading day for a security the
    # The time rule here tells it to fire at 13:00:00 UTC
    self.Schedule.On(self.DateRules.EveryDay("SPY"), 
                     self.TimeRules.At(13, 0, 0, TimeZones.Utc),
                     lambda: self.Log(f"EveryDay.SPY SpecificTime: Fired at: {self.Time}"))
    
    # Schedule an event to fire every trading day for a security the
    # The time rule here tells it to fire 10 minutes after SPY's market open
    self.Schedule.On(self.DateRules.EveryDay("SPY"), 
                     self.TimeRules.AfterMarketOpen("SPY", 10),
                     lambda: self.Log(f"EveryDay.SPY 10 min after open: Fired at: {self.Time}"))
    
    # Schedule an event to fire every trading day for a security the
    # The time rule here tells it to fire 10 minutes before SPY's market close
    self.Schedule.On(self.DateRules.EveryDay("SPY"),
                     self.TimeRules.BeforeMarketClose("SPY", 10),
                     lambda: self.Log(f"EveryDay.SPY 10 min before close: Fired at: {self.Time}"))
    
    # Schedule an event to fire on certain days of the week
    self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday),
                     self.TimeRules.At(12, 0),
                     lambda: self.Log(f"Mon/Fri at 12pm: Fired at: {self.Time}"))
    
    # Schedule an event to fire once today at when this method is called (now)
    self.Schedule.On(self.DateRules.Today,
                     self.TimeRules.Now,
                     lambda: self.Log(f"Now: Fired at: {self.Time}"))
    
    # Schedule an event to fire once tomorrow at midnight
    self.Schedule.On(self.DateRules.Tomorrow,
                     self.TimeRules.Midnight,
                     lambda: self.Log(f"Tomorrow at midnight: Fired at: {self.Time}"))
    
    # Schedule an event to fire once today at noon
    self.Schedule.On(self.DateRules.Today,
                     self.TimeRules.Noon,
                     lambda: self.Log(f"Today at noon: Fired at: {self.Time}"))
    
    # the scheduling methods return the ScheduledEvent object which can be used 
    # for other things here I set the event up to check the portfolio value every
    # 10 minutes, and liquidate if we have too many losses
    self.Schedule.On(self.DateRules.EveryDay(), 
                     self.TimeRules.Every(timedelta(minutes=10)),
                     self.LiquidateUnrealizedLosses)
    
    # Schedule an event to fire at the beginning of the month, the symbol is optional. 
    # if specified, it will fire the first trading day for that symbol of the month,
    # if not specified it will fire on the first day of the month
    self.Schedule.On(self.DateRules.MonthStart("SPY"),
                     self.TimeRules.AfterMarketOpen("SPY"),
                     self.RebalancingCode)
    
    # Schedule an event to fire at the end of the month, the symbol is optional. 
    # if specified, it will fire the last trading day for that symbol of the month,
    # if not specified it will fire on the first day of the month
    self.Schedule.On(self.DateRules.MonthEnd("SPY"),
                     self.TimeRules.BeforeMarketClose("SPY"),
                     self.RebalancingCode)
    
    # Schedule an event to fire at the beginning of the week, the symbol is optional. 
    # if specified, it will fire the first trading day for that symbol of the week,
    # if not specified it will fire on the first day of the week
    self.Schedule.On(self.DateRules.WeekStart("SPY"),
                     self.TimeRules.AfterMarketOpen("SPY", 5),
                     self.RebalancingCode)
    
    # Schedule an event to fire at the end of the week, the symbol is optional.
    # if specified, it will fire the last trading day for that symbol of the week,
    # if not specified it will fire on the first day of the week
    self.Schedule.On(self.DateRules.WeekEnd("SPY"),
                     self.TimeRules.BeforeMarketClose("SPY", 5),
                     self.RebalancingCode)
    
    
    # The following methods are not defined in Initialize:
    def LiquidateUnrealizedLosses(self) -> None:
        ''' if we have over 1000 dollars in unrealized losses, liquidate'''
        if self.Portfolio.TotalUnrealizedProfit < -1000:
            self.Log(f"Liquidated due to unrealized losses at: {self.Time}")
            self.Liquidate()
    
    def RebalancingCode(self) -> None:
        ''' Good spot for rebalancing code?'''
        pass
    
    Demonstration Algorithm
    ScheduledEventsAlgorithm.py Python ScheduledEventsAlgorithm.cs C#

     

    13 Indicators

    13.1 Supported Indicators

    Indicators translate a stream of data points into a numerical value you can use to detect trading opportunities. LEAN provides more than 100 pre-built technical indicators and candlestick patterns you can use in your algorithms. You can use any of the following indicators. Click one to learn more.

     

    13.1.1 Candlestick Patterns

    You can use any of the following candlestick patterns. Click one to learn more.

     

    13.1.1.1 Abandoned Baby

    Introduction

    Create a new Abandoned Baby candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using AbandonedBaby Indicator

    To create an automatic indicators for AbandonedBaby , call the AbandonedBaby helper method from the QCAlgorithm class. The AbandonedBaby method creates a AbandonedBaby object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AbandonedBabyAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbandonedBaby _abandonedbaby;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abandonedbaby = AbandonedBaby(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_abandonedbaby.IsReady)
            {
                // The current value of _abandonedbaby is represented by itself (_abandonedbaby)
                // or _abandonedbaby.Current.Value
                Plot("AbandonedBaby", "abandonedbaby", _abandonedbaby);
                
            }
        }
    }
    class AbandonedBabyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abandonedbaby = self.AbandonedBaby(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.abandonedbaby.IsReady:
                # The current value of self.abandonedbaby is represented by self.abandonedbaby.Current.Value
                self.Plot("AbandonedBaby", "abandonedbaby", self.abandonedbaby.Current.Value)
                
    

    The following reference table describes the AbandonedBaby method:

    AbandonedBaby() 1/1

                AbandonedBaby QuantConnect.Algorithm.CandlestickPatterns.AbandonedBaby (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AbandonedBaby pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AbandonedBaby indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AbandonedBabyAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbandonedBaby _abandonedbaby;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abandonedbaby = new AbandonedBaby(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _abandonedbaby.Update(bar);
            }
    
            if (_abandonedbaby.IsReady)
            {
                // The current value of _abandonedbaby is represented by itself (_abandonedbaby)
                // or _abandonedbaby.Current.Value
                Plot("AbandonedBaby", "abandonedbaby", _abandonedbaby);
                
            }
        }
    }
    class AbandonedBabyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abandonedbaby = AbandonedBaby(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.abandonedbaby.Update(bar)
    
            if self.abandonedbaby.IsReady:
                # The current value of self.abandonedbaby is represented by self.abandonedbaby.Current.Value
                self.Plot("AbandonedBaby", "abandonedbaby", self.abandonedbaby.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AbandonedBabyAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbandonedBaby _abandonedbaby;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abandonedbaby = new AbandonedBaby(SPY);
            RegisterIndicator(_symbol, _abandonedbaby, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_abandonedbaby.IsReady)
            {
                // The current value of _abandonedbaby is represented by itself (_abandonedbaby)
                // or _abandonedbaby.Current.Value
                Plot("AbandonedBaby", "abandonedbaby", _abandonedbaby);
                
            }
        }
    }
    class AbandonedBabyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abandonedbaby = AbandonedBaby(SPY)
            self.RegisterIndicator(self.symbol, self.abandonedbaby, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.abandonedbaby.IsReady:
                # The current value of self.abandonedbaby is represented by self.abandonedbaby.Current.Value
                self.Plot("AbandonedBaby", "abandonedbaby", self.abandonedbaby.Current.Value)
                
    

    The following reference table describes the AbandonedBaby constructor:

    AbandonedBaby() 1/3

                AbandonedBaby QuantConnect.Indicators.CandlestickPatterns.AbandonedBaby (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the AbandonedBab class using the specified name.

    AbandonedBaby() 2/3

                AbandonedBaby QuantConnect.Indicators.CandlestickPatterns.AbandonedBaby (
        decimal  penetration
       )
            

    Initializes a new instance of the AbandonedBab class.

    AbandonedBaby() 3/3

                AbandonedBaby QuantConnect.Indicators.CandlestickPatterns.AbandonedBaby (
        
       )
            

    Initializes a new instance of the AbandonedBab class.

     

    13.1.1.2 Advance Block

    Introduction

    Create a new Advance Block candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using AdvanceBlock Indicator

    To create an automatic indicators for AdvanceBlock , call the AdvanceBlock helper method from the QCAlgorithm class. The AdvanceBlock method creates a AdvanceBlock object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AdvanceBlockAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceBlock _advanceblock;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advanceblock = AdvanceBlock(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_advanceblock.IsReady)
            {
                // The current value of _advanceblock is represented by itself (_advanceblock)
                // or _advanceblock.Current.Value
                Plot("AdvanceBlock", "advanceblock", _advanceblock);
                
            }
        }
    }
    class AdvanceBlockAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advanceblock = self.AdvanceBlock(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.advanceblock.IsReady:
                # The current value of self.advanceblock is represented by self.advanceblock.Current.Value
                self.Plot("AdvanceBlock", "advanceblock", self.advanceblock.Current.Value)
                
    

    The following reference table describes the AdvanceBlock method:

    AdvanceBlock() 1/1

                AdvanceBlock QuantConnect.Algorithm.CandlestickPatterns.AdvanceBlock (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AdvanceBlock pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AdvanceBlock indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AdvanceBlockAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceBlock _advanceblock;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advanceblock = new AdvanceBlock(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _advanceblock.Update(bar);
            }
    
            if (_advanceblock.IsReady)
            {
                // The current value of _advanceblock is represented by itself (_advanceblock)
                // or _advanceblock.Current.Value
                Plot("AdvanceBlock", "advanceblock", _advanceblock);
                
            }
        }
    }
    class AdvanceBlockAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advanceblock = AdvanceBlock(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.advanceblock.Update(bar)
    
            if self.advanceblock.IsReady:
                # The current value of self.advanceblock is represented by self.advanceblock.Current.Value
                self.Plot("AdvanceBlock", "advanceblock", self.advanceblock.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AdvanceBlockAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceBlock _advanceblock;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advanceblock = new AdvanceBlock(SPY);
            RegisterIndicator(_symbol, _advanceblock, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_advanceblock.IsReady)
            {
                // The current value of _advanceblock is represented by itself (_advanceblock)
                // or _advanceblock.Current.Value
                Plot("AdvanceBlock", "advanceblock", _advanceblock);
                
            }
        }
    }
    class AdvanceBlockAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advanceblock = AdvanceBlock(SPY)
            self.RegisterIndicator(self.symbol, self.advanceblock, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.advanceblock.IsReady:
                # The current value of self.advanceblock is represented by self.advanceblock.Current.Value
                self.Plot("AdvanceBlock", "advanceblock", self.advanceblock.Current.Value)
                
    

    The following reference table describes the AdvanceBlock constructor:

    AdvanceBlock() 1/2

                AdvanceBlock QuantConnect.Indicators.CandlestickPatterns.AdvanceBlock (
        string  name
       )
            

    Initializes a new instance of the AdvanceBloc class using the specified name.

    AdvanceBlock() 2/2

                AdvanceBlock QuantConnect.Indicators.CandlestickPatterns.AdvanceBlock (
        
       )
            

    Initializes a new instance of the AdvanceBloc class.

     

    13.1.1.3 Belt Hold

    Introduction

    Create a new Belt-hold candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using BeltHold Indicator

    To create an automatic indicators for BeltHold , call the BeltHold helper method from the QCAlgorithm class. The BeltHold method creates a BeltHold object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class BeltHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BeltHold _belthold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _belthold = BeltHold(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_belthold.IsReady)
            {
                // The current value of _belthold is represented by itself (_belthold)
                // or _belthold.Current.Value
                Plot("BeltHold", "belthold", _belthold);
                
            }
        }
    }
    class BeltHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.belthold = self.BeltHold(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.belthold.IsReady:
                # The current value of self.belthold is represented by self.belthold.Current.Value
                self.Plot("BeltHold", "belthold", self.belthold.Current.Value)
                
    

    The following reference table describes the BeltHold method:

    BeltHold() 1/1

                BeltHold QuantConnect.Algorithm.CandlestickPatterns.BeltHold (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new BeltHold pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a BeltHold indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class BeltHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BeltHold _belthold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _belthold = new BeltHold(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _belthold.Update(bar);
            }
    
            if (_belthold.IsReady)
            {
                // The current value of _belthold is represented by itself (_belthold)
                // or _belthold.Current.Value
                Plot("BeltHold", "belthold", _belthold);
                
            }
        }
    }
    class BeltHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.belthold = BeltHold(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.belthold.Update(bar)
    
            if self.belthold.IsReady:
                # The current value of self.belthold is represented by self.belthold.Current.Value
                self.Plot("BeltHold", "belthold", self.belthold.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class BeltHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BeltHold _belthold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _belthold = new BeltHold(SPY);
            RegisterIndicator(_symbol, _belthold, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_belthold.IsReady)
            {
                // The current value of _belthold is represented by itself (_belthold)
                // or _belthold.Current.Value
                Plot("BeltHold", "belthold", _belthold);
                
            }
        }
    }
    class BeltHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.belthold = BeltHold(SPY)
            self.RegisterIndicator(self.symbol, self.belthold, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.belthold.IsReady:
                # The current value of self.belthold is represented by self.belthold.Current.Value
                self.Plot("BeltHold", "belthold", self.belthold.Current.Value)
                
    

    The following reference table describes the BeltHold constructor:

    BeltHold() 1/2

                BeltHold QuantConnect.Indicators.CandlestickPatterns.BeltHold (
        string  name
       )
            

    Initializes a new instance of the BeltHol class using the specified name.

    BeltHold() 2/2

                BeltHold QuantConnect.Indicators.CandlestickPatterns.BeltHold (
        
       )
            

    Initializes a new instance of the BeltHol class.

     

    13.1.1.4 Breakaway

    Introduction

    Create a new Breakaway candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Breakaway Indicator

    To create an automatic indicators for Breakaway , call the Breakaway helper method from the QCAlgorithm class. The Breakaway method creates a Breakaway object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class BreakawayAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Breakaway _breakaway;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _breakaway = Breakaway(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_breakaway.IsReady)
            {
                // The current value of _breakaway is represented by itself (_breakaway)
                // or _breakaway.Current.Value
                Plot("Breakaway", "breakaway", _breakaway);
                
            }
        }
    }
    class BreakawayAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.breakaway = self.Breakaway(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.breakaway.IsReady:
                # The current value of self.breakaway is represented by self.breakaway.Current.Value
                self.Plot("Breakaway", "breakaway", self.breakaway.Current.Value)
                
    

    The following reference table describes the Breakaway method:

    Breakaway() 1/1

                Breakaway QuantConnect.Algorithm.CandlestickPatterns.Breakaway (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Breakaway pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Breakaway indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class BreakawayAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Breakaway _breakaway;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _breakaway = new Breakaway(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _breakaway.Update(bar);
            }
    
            if (_breakaway.IsReady)
            {
                // The current value of _breakaway is represented by itself (_breakaway)
                // or _breakaway.Current.Value
                Plot("Breakaway", "breakaway", _breakaway);
                
            }
        }
    }
    class BreakawayAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.breakaway = Breakaway(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.breakaway.Update(bar)
    
            if self.breakaway.IsReady:
                # The current value of self.breakaway is represented by self.breakaway.Current.Value
                self.Plot("Breakaway", "breakaway", self.breakaway.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class BreakawayAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Breakaway _breakaway;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _breakaway = new Breakaway(SPY);
            RegisterIndicator(_symbol, _breakaway, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_breakaway.IsReady)
            {
                // The current value of _breakaway is represented by itself (_breakaway)
                // or _breakaway.Current.Value
                Plot("Breakaway", "breakaway", _breakaway);
                
            }
        }
    }
    class BreakawayAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.breakaway = Breakaway(SPY)
            self.RegisterIndicator(self.symbol, self.breakaway, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.breakaway.IsReady:
                # The current value of self.breakaway is represented by self.breakaway.Current.Value
                self.Plot("Breakaway", "breakaway", self.breakaway.Current.Value)
                
    

    The following reference table describes the Breakaway constructor:

    Breakaway() 1/2

                Breakaway QuantConnect.Indicators.CandlestickPatterns.Breakaway (
        string  name
       )
            

    Initializes a new instance of the Breakawa class using the specified name.

    Breakaway() 2/2

                Breakaway QuantConnect.Indicators.CandlestickPatterns.Breakaway (
        
       )
            

    Initializes a new instance of the Breakawa class.

     

    13.1.1.5 Closing Marubozu

    Introduction

    Create a new Closing Marubozu candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ClosingMarubozu Indicator

    To create an automatic indicators for ClosingMarubozu , call the ClosingMarubozu helper method from the QCAlgorithm class. The ClosingMarubozu method creates a ClosingMarubozu object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ClosingMarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ClosingMarubozu _closingmarubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _closingmarubozu = ClosingMarubozu(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_closingmarubozu.IsReady)
            {
                // The current value of _closingmarubozu is represented by itself (_closingmarubozu)
                // or _closingmarubozu.Current.Value
                Plot("ClosingMarubozu", "closingmarubozu", _closingmarubozu);
                
            }
        }
    }
    class ClosingMarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.closingmarubozu = self.ClosingMarubozu(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.closingmarubozu.IsReady:
                # The current value of self.closingmarubozu is represented by self.closingmarubozu.Current.Value
                self.Plot("ClosingMarubozu", "closingmarubozu", self.closingmarubozu.Current.Value)
                
    

    The following reference table describes the ClosingMarubozu method:

    ClosingMarubozu() 1/1

                ClosingMarubozu QuantConnect.Algorithm.CandlestickPatterns.ClosingMarubozu (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ClosingMarubozu pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ClosingMarubozu indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ClosingMarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ClosingMarubozu _closingmarubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _closingmarubozu = new ClosingMarubozu(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _closingmarubozu.Update(bar);
            }
    
            if (_closingmarubozu.IsReady)
            {
                // The current value of _closingmarubozu is represented by itself (_closingmarubozu)
                // or _closingmarubozu.Current.Value
                Plot("ClosingMarubozu", "closingmarubozu", _closingmarubozu);
                
            }
        }
    }
    class ClosingMarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.closingmarubozu = ClosingMarubozu(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.closingmarubozu.Update(bar)
    
            if self.closingmarubozu.IsReady:
                # The current value of self.closingmarubozu is represented by self.closingmarubozu.Current.Value
                self.Plot("ClosingMarubozu", "closingmarubozu", self.closingmarubozu.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ClosingMarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ClosingMarubozu _closingmarubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _closingmarubozu = new ClosingMarubozu(SPY);
            RegisterIndicator(_symbol, _closingmarubozu, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_closingmarubozu.IsReady)
            {
                // The current value of _closingmarubozu is represented by itself (_closingmarubozu)
                // or _closingmarubozu.Current.Value
                Plot("ClosingMarubozu", "closingmarubozu", _closingmarubozu);
                
            }
        }
    }
    class ClosingMarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.closingmarubozu = ClosingMarubozu(SPY)
            self.RegisterIndicator(self.symbol, self.closingmarubozu, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.closingmarubozu.IsReady:
                # The current value of self.closingmarubozu is represented by self.closingmarubozu.Current.Value
                self.Plot("ClosingMarubozu", "closingmarubozu", self.closingmarubozu.Current.Value)
                
    

    The following reference table describes the ClosingMarubozu constructor:

    ClosingMarubozu() 1/2

                ClosingMarubozu QuantConnect.Indicators.CandlestickPatterns.ClosingMarubozu (
        string  name
       )
            

    Initializes a new instance of the ClosingMaruboz class using the specified name.

    ClosingMarubozu() 2/2

                ClosingMarubozu QuantConnect.Indicators.CandlestickPatterns.ClosingMarubozu (
        
       )
            

    Initializes a new instance of the ClosingMaruboz class.

     

    13.1.1.6 Concealed Baby Swallow

    Introduction

    Create a new Concealed Baby Swallow candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ConcealedBabySwallow Indicator

    To create an automatic indicators for ConcealedBabySwallow , call the ConcealedBabySwallow helper method from the QCAlgorithm class. The ConcealedBabySwallow method creates a ConcealedBabySwallow object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ConcealedBabySwallowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ConcealedBabySwallow _concealedbabyswallow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _concealedbabyswallow = ConcealedBabySwallow(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_concealedbabyswallow.IsReady)
            {
                // The current value of _concealedbabyswallow is represented by itself (_concealedbabyswallow)
                // or _concealedbabyswallow.Current.Value
                Plot("ConcealedBabySwallow", "concealedbabyswallow", _concealedbabyswallow);
                
            }
        }
    }
    class ConcealedBabySwallowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.concealedbabyswallow = self.ConcealedBabySwallow(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.concealedbabyswallow.IsReady:
                # The current value of self.concealedbabyswallow is represented by self.concealedbabyswallow.Current.Value
                self.Plot("ConcealedBabySwallow", "concealedbabyswallow", self.concealedbabyswallow.Current.Value)
                
    

    The following reference table describes the ConcealedBabySwallow method:

    ConcealedBabySwallow() 1/1

                ConcealedBabySwallow QuantConnect.Algorithm.CandlestickPatterns.ConcealedBabySwallow (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ConcealedBabySwallow pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ConcealedBabySwallow indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ConcealedBabySwallowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ConcealedBabySwallow _concealedbabyswallow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _concealedbabyswallow = new ConcealedBabySwallow(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _concealedbabyswallow.Update(bar);
            }
    
            if (_concealedbabyswallow.IsReady)
            {
                // The current value of _concealedbabyswallow is represented by itself (_concealedbabyswallow)
                // or _concealedbabyswallow.Current.Value
                Plot("ConcealedBabySwallow", "concealedbabyswallow", _concealedbabyswallow);
                
            }
        }
    }
    class ConcealedBabySwallowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.concealedbabyswallow = ConcealedBabySwallow(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.concealedbabyswallow.Update(bar)
    
            if self.concealedbabyswallow.IsReady:
                # The current value of self.concealedbabyswallow is represented by self.concealedbabyswallow.Current.Value
                self.Plot("ConcealedBabySwallow", "concealedbabyswallow", self.concealedbabyswallow.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ConcealedBabySwallowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ConcealedBabySwallow _concealedbabyswallow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _concealedbabyswallow = new ConcealedBabySwallow(SPY);
            RegisterIndicator(_symbol, _concealedbabyswallow, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_concealedbabyswallow.IsReady)
            {
                // The current value of _concealedbabyswallow is represented by itself (_concealedbabyswallow)
                // or _concealedbabyswallow.Current.Value
                Plot("ConcealedBabySwallow", "concealedbabyswallow", _concealedbabyswallow);
                
            }
        }
    }
    class ConcealedBabySwallowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.concealedbabyswallow = ConcealedBabySwallow(SPY)
            self.RegisterIndicator(self.symbol, self.concealedbabyswallow, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.concealedbabyswallow.IsReady:
                # The current value of self.concealedbabyswallow is represented by self.concealedbabyswallow.Current.Value
                self.Plot("ConcealedBabySwallow", "concealedbabyswallow", self.concealedbabyswallow.Current.Value)
                
    

    The following reference table describes the ConcealedBabySwallow constructor:

    ConcealedBabySwallow() 1/2

                ConcealedBabySwallow QuantConnect.Indicators.CandlestickPatterns.ConcealedBabySwallow (
        string  name
       )
            

    Initializes a new instance of the ConcealedBabySwallo class using the specified name.

    ConcealedBabySwallow() 2/2

                ConcealedBabySwallow QuantConnect.Indicators.CandlestickPatterns.ConcealedBabySwallow (
        
       )
            

    Initializes a new instance of the ConcealedBabySwallo class.

     

    13.1.1.7 Counterattack

    Introduction

    Create a new Counterattack candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Counterattack Indicator

    To create an automatic indicators for Counterattack , call the Counterattack helper method from the QCAlgorithm class. The Counterattack method creates a Counterattack object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class CounterattackAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Counterattack _counterattack;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _counterattack = Counterattack(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_counterattack.IsReady)
            {
                // The current value of _counterattack is represented by itself (_counterattack)
                // or _counterattack.Current.Value
                Plot("Counterattack", "counterattack", _counterattack);
                
            }
        }
    }
    class CounterattackAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.counterattack = self.Counterattack(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.counterattack.IsReady:
                # The current value of self.counterattack is represented by self.counterattack.Current.Value
                self.Plot("Counterattack", "counterattack", self.counterattack.Current.Value)
                
    

    The following reference table describes the Counterattack method:

    Counterattack() 1/1

                Counterattack QuantConnect.Algorithm.CandlestickPatterns.Counterattack (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Counterattack pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Counterattack indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class CounterattackAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Counterattack _counterattack;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _counterattack = new Counterattack(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _counterattack.Update(bar);
            }
    
            if (_counterattack.IsReady)
            {
                // The current value of _counterattack is represented by itself (_counterattack)
                // or _counterattack.Current.Value
                Plot("Counterattack", "counterattack", _counterattack);
                
            }
        }
    }
    class CounterattackAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.counterattack = Counterattack(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.counterattack.Update(bar)
    
            if self.counterattack.IsReady:
                # The current value of self.counterattack is represented by self.counterattack.Current.Value
                self.Plot("Counterattack", "counterattack", self.counterattack.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class CounterattackAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Counterattack _counterattack;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _counterattack = new Counterattack(SPY);
            RegisterIndicator(_symbol, _counterattack, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_counterattack.IsReady)
            {
                // The current value of _counterattack is represented by itself (_counterattack)
                // or _counterattack.Current.Value
                Plot("Counterattack", "counterattack", _counterattack);
                
            }
        }
    }
    class CounterattackAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.counterattack = Counterattack(SPY)
            self.RegisterIndicator(self.symbol, self.counterattack, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.counterattack.IsReady:
                # The current value of self.counterattack is represented by self.counterattack.Current.Value
                self.Plot("Counterattack", "counterattack", self.counterattack.Current.Value)
                
    

    The following reference table describes the Counterattack constructor:

    Counterattack() 1/2

                Counterattack QuantConnect.Indicators.CandlestickPatterns.Counterattack (
        string  name
       )
            

    Initializes a new instance of the Counterattac class using the specified name.

    Counterattack() 2/2

                Counterattack QuantConnect.Indicators.CandlestickPatterns.Counterattack (
        
       )
            

    Initializes a new instance of the Counterattac class.

     

    13.1.1.8 Dark Cloud Cover

    Introduction

    Create a new Dark Cloud Cover candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using DarkCloudCover Indicator

    To create an automatic indicators for DarkCloudCover , call the DarkCloudCover helper method from the QCAlgorithm class. The DarkCloudCover method creates a DarkCloudCover object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DarkCloudCoverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DarkCloudCover _darkcloudcover;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _darkcloudcover = DarkCloudCover(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_darkcloudcover.IsReady)
            {
                // The current value of _darkcloudcover is represented by itself (_darkcloudcover)
                // or _darkcloudcover.Current.Value
                Plot("DarkCloudCover", "darkcloudcover", _darkcloudcover);
                
            }
        }
    }
    class DarkCloudCoverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.darkcloudcover = self.DarkCloudCover(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.darkcloudcover.IsReady:
                # The current value of self.darkcloudcover is represented by self.darkcloudcover.Current.Value
                self.Plot("DarkCloudCover", "darkcloudcover", self.darkcloudcover.Current.Value)
                
    

    The following reference table describes the DarkCloudCover method:

    DarkCloudCover() 1/1

                DarkCloudCover QuantConnect.Algorithm.CandlestickPatterns.DarkCloudCover (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new DarkCloudCover pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DarkCloudCover indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class DarkCloudCoverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DarkCloudCover _darkcloudcover;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _darkcloudcover = new DarkCloudCover(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _darkcloudcover.Update(bar);
            }
    
            if (_darkcloudcover.IsReady)
            {
                // The current value of _darkcloudcover is represented by itself (_darkcloudcover)
                // or _darkcloudcover.Current.Value
                Plot("DarkCloudCover", "darkcloudcover", _darkcloudcover);
                
            }
        }
    }
    class DarkCloudCoverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.darkcloudcover = DarkCloudCover(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.darkcloudcover.Update(bar)
    
            if self.darkcloudcover.IsReady:
                # The current value of self.darkcloudcover is represented by self.darkcloudcover.Current.Value
                self.Plot("DarkCloudCover", "darkcloudcover", self.darkcloudcover.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DarkCloudCoverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DarkCloudCover _darkcloudcover;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _darkcloudcover = new DarkCloudCover(SPY);
            RegisterIndicator(_symbol, _darkcloudcover, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_darkcloudcover.IsReady)
            {
                // The current value of _darkcloudcover is represented by itself (_darkcloudcover)
                // or _darkcloudcover.Current.Value
                Plot("DarkCloudCover", "darkcloudcover", _darkcloudcover);
                
            }
        }
    }
    class DarkCloudCoverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.darkcloudcover = DarkCloudCover(SPY)
            self.RegisterIndicator(self.symbol, self.darkcloudcover, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.darkcloudcover.IsReady:
                # The current value of self.darkcloudcover is represented by self.darkcloudcover.Current.Value
                self.Plot("DarkCloudCover", "darkcloudcover", self.darkcloudcover.Current.Value)
                
    

    The following reference table describes the DarkCloudCover constructor:

    DarkCloudCover() 1/3

                DarkCloudCover QuantConnect.Indicators.CandlestickPatterns.DarkCloudCover (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the DarkCloudCove class using the specified name.

    DarkCloudCover() 2/3

                DarkCloudCover QuantConnect.Indicators.CandlestickPatterns.DarkCloudCover (
        decimal  penetration
       )
            

    Initializes a new instance of the DarkCloudCove class.

    DarkCloudCover() 3/3

                DarkCloudCover QuantConnect.Indicators.CandlestickPatterns.DarkCloudCover (
        
       )
            

    Initializes a new instance of the DarkCloudCove class.

     

    13.1.1.9 Doji

    Introduction

    Create a new Doji candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Doji Indicator

    To create an automatic indicators for Doji , call the Doji helper method from the QCAlgorithm class. The Doji method creates a Doji object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Doji _doji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _doji = Doji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_doji.IsReady)
            {
                // The current value of _doji is represented by itself (_doji)
                // or _doji.Current.Value
                Plot("Doji", "doji", _doji);
                
            }
        }
    }
    class DojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.doji = self.Doji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.doji.IsReady:
                # The current value of self.doji is represented by self.doji.Current.Value
                self.Plot("Doji", "doji", self.doji.Current.Value)
                
    

    The following reference table describes the Doji method:

    Doji() 1/1

                Doji QuantConnect.Algorithm.CandlestickPatterns.Doji (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Doji pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Doji indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class DojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Doji _doji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _doji = new Doji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _doji.Update(bar);
            }
    
            if (_doji.IsReady)
            {
                // The current value of _doji is represented by itself (_doji)
                // or _doji.Current.Value
                Plot("Doji", "doji", _doji);
                
            }
        }
    }
    class DojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.doji = Doji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.doji.Update(bar)
    
            if self.doji.IsReady:
                # The current value of self.doji is represented by self.doji.Current.Value
                self.Plot("Doji", "doji", self.doji.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Doji _doji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _doji = new Doji(SPY);
            RegisterIndicator(_symbol, _doji, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_doji.IsReady)
            {
                // The current value of _doji is represented by itself (_doji)
                // or _doji.Current.Value
                Plot("Doji", "doji", _doji);
                
            }
        }
    }
    class DojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.doji = Doji(SPY)
            self.RegisterIndicator(self.symbol, self.doji, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.doji.IsReady:
                # The current value of self.doji is represented by self.doji.Current.Value
                self.Plot("Doji", "doji", self.doji.Current.Value)
                
    

    The following reference table describes the Doji constructor:

    Doji() 1/2

                Doji QuantConnect.Indicators.CandlestickPatterns.Doji (
        string  name
       )
            

    Initializes a new instance of the Doj class using the specified name.

    Doji() 2/2

                Doji QuantConnect.Indicators.CandlestickPatterns.Doji (
        
       )
            

    Initializes a new instance of the Doj class.

     

    13.1.1.10 Doji Star

    Introduction

    Create a new Doji Star candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using DojiStar Indicator

    To create an automatic indicators for DojiStar , call the DojiStar helper method from the QCAlgorithm class. The DojiStar method creates a DojiStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DojiStar _dojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dojistar = DojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_dojistar.IsReady)
            {
                // The current value of _dojistar is represented by itself (_dojistar)
                // or _dojistar.Current.Value
                Plot("DojiStar", "dojistar", _dojistar);
                
            }
        }
    }
    class DojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dojistar = self.DojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.dojistar.IsReady:
                # The current value of self.dojistar is represented by self.dojistar.Current.Value
                self.Plot("DojiStar", "dojistar", self.dojistar.Current.Value)
                
    

    The following reference table describes the DojiStar method:

    DojiStar() 1/1

                DojiStar QuantConnect.Algorithm.CandlestickPatterns.DojiStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new DojiStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DojiStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class DojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DojiStar _dojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dojistar = new DojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dojistar.Update(bar);
            }
    
            if (_dojistar.IsReady)
            {
                // The current value of _dojistar is represented by itself (_dojistar)
                // or _dojistar.Current.Value
                Plot("DojiStar", "dojistar", _dojistar);
                
            }
        }
    }
    class DojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dojistar = DojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dojistar.Update(bar)
    
            if self.dojistar.IsReady:
                # The current value of self.dojistar is represented by self.dojistar.Current.Value
                self.Plot("DojiStar", "dojistar", self.dojistar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DojiStar _dojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dojistar = new DojiStar(SPY);
            RegisterIndicator(_symbol, _dojistar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dojistar.IsReady)
            {
                // The current value of _dojistar is represented by itself (_dojistar)
                // or _dojistar.Current.Value
                Plot("DojiStar", "dojistar", _dojistar);
                
            }
        }
    }
    class DojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dojistar = DojiStar(SPY)
            self.RegisterIndicator(self.symbol, self.dojistar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dojistar.IsReady:
                # The current value of self.dojistar is represented by self.dojistar.Current.Value
                self.Plot("DojiStar", "dojistar", self.dojistar.Current.Value)
                
    

    The following reference table describes the DojiStar constructor:

    DojiStar() 1/2

                DojiStar QuantConnect.Indicators.CandlestickPatterns.DojiStar (
        string  name
       )
            

    Initializes a new instance of the DojiSta class using the specified name.

    DojiStar() 2/2

                DojiStar QuantConnect.Indicators.CandlestickPatterns.DojiStar (
        
       )
            

    Initializes a new instance of the DojiSta class.

     

    13.1.1.11 Dragonfly Doji

    Introduction

    Create a new Dragonfly Doji candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using DragonflyDoji Indicator

    To create an automatic indicators for DragonflyDoji , call the DragonflyDoji helper method from the QCAlgorithm class. The DragonflyDoji method creates a DragonflyDoji object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DragonflyDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DragonflyDoji _dragonflydoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dragonflydoji = DragonflyDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_dragonflydoji.IsReady)
            {
                // The current value of _dragonflydoji is represented by itself (_dragonflydoji)
                // or _dragonflydoji.Current.Value
                Plot("DragonflyDoji", "dragonflydoji", _dragonflydoji);
                
            }
        }
    }
    class DragonflyDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dragonflydoji = self.DragonflyDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.dragonflydoji.IsReady:
                # The current value of self.dragonflydoji is represented by self.dragonflydoji.Current.Value
                self.Plot("DragonflyDoji", "dragonflydoji", self.dragonflydoji.Current.Value)
                
    

    The following reference table describes the DragonflyDoji method:

    DragonflyDoji() 1/1

                DragonflyDoji QuantConnect.Algorithm.CandlestickPatterns.DragonflyDoji (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new DragonflyDoji pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DragonflyDoji indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class DragonflyDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DragonflyDoji _dragonflydoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dragonflydoji = new DragonflyDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dragonflydoji.Update(bar);
            }
    
            if (_dragonflydoji.IsReady)
            {
                // The current value of _dragonflydoji is represented by itself (_dragonflydoji)
                // or _dragonflydoji.Current.Value
                Plot("DragonflyDoji", "dragonflydoji", _dragonflydoji);
                
            }
        }
    }
    class DragonflyDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dragonflydoji = DragonflyDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dragonflydoji.Update(bar)
    
            if self.dragonflydoji.IsReady:
                # The current value of self.dragonflydoji is represented by self.dragonflydoji.Current.Value
                self.Plot("DragonflyDoji", "dragonflydoji", self.dragonflydoji.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DragonflyDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DragonflyDoji _dragonflydoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dragonflydoji = new DragonflyDoji(SPY);
            RegisterIndicator(_symbol, _dragonflydoji, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dragonflydoji.IsReady)
            {
                // The current value of _dragonflydoji is represented by itself (_dragonflydoji)
                // or _dragonflydoji.Current.Value
                Plot("DragonflyDoji", "dragonflydoji", _dragonflydoji);
                
            }
        }
    }
    class DragonflyDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dragonflydoji = DragonflyDoji(SPY)
            self.RegisterIndicator(self.symbol, self.dragonflydoji, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dragonflydoji.IsReady:
                # The current value of self.dragonflydoji is represented by self.dragonflydoji.Current.Value
                self.Plot("DragonflyDoji", "dragonflydoji", self.dragonflydoji.Current.Value)
                
    

    The following reference table describes the DragonflyDoji constructor:

    DragonflyDoji() 1/2

                DragonflyDoji QuantConnect.Indicators.CandlestickPatterns.DragonflyDoji (
        string  name
       )
            

    Initializes a new instance of the DragonflyDoj class using the specified name.

    DragonflyDoji() 2/2

                DragonflyDoji QuantConnect.Indicators.CandlestickPatterns.DragonflyDoji (
        
       )
            

    Initializes a new instance of the DragonflyDoj class.

     

    13.1.1.12 Engulfing

    Introduction

    Create a new Engulfing candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Engulfing Indicator

    To create an automatic indicators for Engulfing , call the Engulfing helper method from the QCAlgorithm class. The Engulfing method creates a Engulfing object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class EngulfingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Engulfing _engulfing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _engulfing = Engulfing(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_engulfing.IsReady)
            {
                // The current value of _engulfing is represented by itself (_engulfing)
                // or _engulfing.Current.Value
                Plot("Engulfing", "engulfing", _engulfing);
                
            }
        }
    }
    class EngulfingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.engulfing = self.Engulfing(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.engulfing.IsReady:
                # The current value of self.engulfing is represented by self.engulfing.Current.Value
                self.Plot("Engulfing", "engulfing", self.engulfing.Current.Value)
                
    

    The following reference table describes the Engulfing method:

    Engulfing() 1/1

                Engulfing QuantConnect.Algorithm.CandlestickPatterns.Engulfing (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Engulfing pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Engulfing indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class EngulfingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Engulfing _engulfing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _engulfing = new Engulfing(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _engulfing.Update(bar);
            }
    
            if (_engulfing.IsReady)
            {
                // The current value of _engulfing is represented by itself (_engulfing)
                // or _engulfing.Current.Value
                Plot("Engulfing", "engulfing", _engulfing);
                
            }
        }
    }
    class EngulfingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.engulfing = Engulfing(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.engulfing.Update(bar)
    
            if self.engulfing.IsReady:
                # The current value of self.engulfing is represented by self.engulfing.Current.Value
                self.Plot("Engulfing", "engulfing", self.engulfing.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class EngulfingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Engulfing _engulfing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _engulfing = new Engulfing(SPY);
            RegisterIndicator(_symbol, _engulfing, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_engulfing.IsReady)
            {
                // The current value of _engulfing is represented by itself (_engulfing)
                // or _engulfing.Current.Value
                Plot("Engulfing", "engulfing", _engulfing);
                
            }
        }
    }
    class EngulfingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.engulfing = Engulfing(SPY)
            self.RegisterIndicator(self.symbol, self.engulfing, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.engulfing.IsReady:
                # The current value of self.engulfing is represented by self.engulfing.Current.Value
                self.Plot("Engulfing", "engulfing", self.engulfing.Current.Value)
                
    

    The following reference table describes the Engulfing constructor:

    Engulfing() 1/2

                Engulfing QuantConnect.Indicators.CandlestickPatterns.Engulfing (
        string  name
       )
            

    Initializes a new instance of the Engulfin class using the specified name.

    Engulfing() 2/2

                Engulfing QuantConnect.Indicators.CandlestickPatterns.Engulfing (
        
       )
            

    Initializes a new instance of the Engulfin class.

     

    13.1.1.13 Evening Doji Star

    Introduction

    Create a new Evening Doji Star candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using EveningDojiStar Indicator

    To create an automatic indicators for EveningDojiStar , call the EveningDojiStar helper method from the QCAlgorithm class. The EveningDojiStar method creates a EveningDojiStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class EveningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningDojiStar _eveningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningdojistar = EveningDojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_eveningdojistar.IsReady)
            {
                // The current value of _eveningdojistar is represented by itself (_eveningdojistar)
                // or _eveningdojistar.Current.Value
                Plot("EveningDojiStar", "eveningdojistar", _eveningdojistar);
                
            }
        }
    }
    class EveningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningdojistar = self.EveningDojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.eveningdojistar.IsReady:
                # The current value of self.eveningdojistar is represented by self.eveningdojistar.Current.Value
                self.Plot("EveningDojiStar", "eveningdojistar", self.eveningdojistar.Current.Value)
                
    

    The following reference table describes the EveningDojiStar method:

    EveningDojiStar() 1/1

                EveningDojiStar QuantConnect.Algorithm.CandlestickPatterns.EveningDojiStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new EveningDojiStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a EveningDojiStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class EveningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningDojiStar _eveningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningdojistar = new EveningDojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _eveningdojistar.Update(bar);
            }
    
            if (_eveningdojistar.IsReady)
            {
                // The current value of _eveningdojistar is represented by itself (_eveningdojistar)
                // or _eveningdojistar.Current.Value
                Plot("EveningDojiStar", "eveningdojistar", _eveningdojistar);
                
            }
        }
    }
    class EveningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningdojistar = EveningDojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.eveningdojistar.Update(bar)
    
            if self.eveningdojistar.IsReady:
                # The current value of self.eveningdojistar is represented by self.eveningdojistar.Current.Value
                self.Plot("EveningDojiStar", "eveningdojistar", self.eveningdojistar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class EveningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningDojiStar _eveningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningdojistar = new EveningDojiStar(SPY);
            RegisterIndicator(_symbol, _eveningdojistar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_eveningdojistar.IsReady)
            {
                // The current value of _eveningdojistar is represented by itself (_eveningdojistar)
                // or _eveningdojistar.Current.Value
                Plot("EveningDojiStar", "eveningdojistar", _eveningdojistar);
                
            }
        }
    }
    class EveningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningdojistar = EveningDojiStar(SPY)
            self.RegisterIndicator(self.symbol, self.eveningdojistar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.eveningdojistar.IsReady:
                # The current value of self.eveningdojistar is represented by self.eveningdojistar.Current.Value
                self.Plot("EveningDojiStar", "eveningdojistar", self.eveningdojistar.Current.Value)
                
    

    The following reference table describes the EveningDojiStar constructor:

    EveningDojiStar() 1/3

                EveningDojiStar QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the EveningDojiSta class using the specified name.

    EveningDojiStar() 2/3

                EveningDojiStar QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar (
        decimal  penetration
       )
            

    Initializes a new instance of the EveningDojiSta class.

    EveningDojiStar() 3/3

                EveningDojiStar QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar (
        
       )
            

    Initializes a new instance of the EveningDojiSta class.

     

    13.1.1.14 Evening Star

    Introduction

    Create a new Evening Star candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using EveningStar Indicator

    To create an automatic indicators for EveningStar , call the EveningStar helper method from the QCAlgorithm class. The EveningStar method creates a EveningStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class EveningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningStar _eveningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningstar = EveningStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_eveningstar.IsReady)
            {
                // The current value of _eveningstar is represented by itself (_eveningstar)
                // or _eveningstar.Current.Value
                Plot("EveningStar", "eveningstar", _eveningstar);
                
            }
        }
    }
    class EveningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningstar = self.EveningStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.eveningstar.IsReady:
                # The current value of self.eveningstar is represented by self.eveningstar.Current.Value
                self.Plot("EveningStar", "eveningstar", self.eveningstar.Current.Value)
                
    

    The following reference table describes the EveningStar method:

    EveningStar() 1/1

                EveningStar QuantConnect.Algorithm.CandlestickPatterns.EveningStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new EveningStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a EveningStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class EveningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningStar _eveningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningstar = new EveningStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _eveningstar.Update(bar);
            }
    
            if (_eveningstar.IsReady)
            {
                // The current value of _eveningstar is represented by itself (_eveningstar)
                // or _eveningstar.Current.Value
                Plot("EveningStar", "eveningstar", _eveningstar);
                
            }
        }
    }
    class EveningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningstar = EveningStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.eveningstar.Update(bar)
    
            if self.eveningstar.IsReady:
                # The current value of self.eveningstar is represented by self.eveningstar.Current.Value
                self.Plot("EveningStar", "eveningstar", self.eveningstar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class EveningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EveningStar _eveningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _eveningstar = new EveningStar(SPY);
            RegisterIndicator(_symbol, _eveningstar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_eveningstar.IsReady)
            {
                // The current value of _eveningstar is represented by itself (_eveningstar)
                // or _eveningstar.Current.Value
                Plot("EveningStar", "eveningstar", _eveningstar);
                
            }
        }
    }
    class EveningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.eveningstar = EveningStar(SPY)
            self.RegisterIndicator(self.symbol, self.eveningstar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.eveningstar.IsReady:
                # The current value of self.eveningstar is represented by self.eveningstar.Current.Value
                self.Plot("EveningStar", "eveningstar", self.eveningstar.Current.Value)
                
    

    The following reference table describes the EveningStar constructor:

    EveningStar() 1/3

                EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the EveningSta class using the specified name.

    EveningStar() 2/3

                EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
        decimal  penetration
       )
            

    Initializes a new instance of the EveningSta class.

    EveningStar() 3/3

                EveningStar QuantConnect.Indicators.CandlestickPatterns.EveningStar (
        
       )
            

    Initializes a new instance of the EveningSta class.

     

    13.1.1.15 Gap Side By Side White

    Introduction

    Create a new Up/Down-gap side-by-side white lines candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using GapSideBySideWhite Indicator

    To create an automatic indicators for GapSideBySideWhite , call the GapSideBySideWhite helper method from the QCAlgorithm class. The GapSideBySideWhite method creates a GapSideBySideWhite object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class GapSideBySideWhiteAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GapSideBySideWhite _gapsidebysidewhite;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gapsidebysidewhite = GapSideBySideWhite(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_gapsidebysidewhite.IsReady)
            {
                // The current value of _gapsidebysidewhite is represented by itself (_gapsidebysidewhite)
                // or _gapsidebysidewhite.Current.Value
                Plot("GapSideBySideWhite", "gapsidebysidewhite", _gapsidebysidewhite);
                
            }
        }
    }
    class GapSideBySideWhiteAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gapsidebysidewhite = self.GapSideBySideWhite(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.gapsidebysidewhite.IsReady:
                # The current value of self.gapsidebysidewhite is represented by self.gapsidebysidewhite.Current.Value
                self.Plot("GapSideBySideWhite", "gapsidebysidewhite", self.gapsidebysidewhite.Current.Value)
                
    

    The following reference table describes the GapSideBySideWhite method:

    GapSideBySideWhite() 1/1

                GapSideBySideWhite QuantConnect.Algorithm.CandlestickPatterns.GapSideBySideWhite (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new GapSideBySideWhite pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a GapSideBySideWhite indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class GapSideBySideWhiteAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GapSideBySideWhite _gapsidebysidewhite;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gapsidebysidewhite = new GapSideBySideWhite(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _gapsidebysidewhite.Update(bar);
            }
    
            if (_gapsidebysidewhite.IsReady)
            {
                // The current value of _gapsidebysidewhite is represented by itself (_gapsidebysidewhite)
                // or _gapsidebysidewhite.Current.Value
                Plot("GapSideBySideWhite", "gapsidebysidewhite", _gapsidebysidewhite);
                
            }
        }
    }
    class GapSideBySideWhiteAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gapsidebysidewhite = GapSideBySideWhite(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.gapsidebysidewhite.Update(bar)
    
            if self.gapsidebysidewhite.IsReady:
                # The current value of self.gapsidebysidewhite is represented by self.gapsidebysidewhite.Current.Value
                self.Plot("GapSideBySideWhite", "gapsidebysidewhite", self.gapsidebysidewhite.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class GapSideBySideWhiteAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GapSideBySideWhite _gapsidebysidewhite;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gapsidebysidewhite = new GapSideBySideWhite(SPY);
            RegisterIndicator(_symbol, _gapsidebysidewhite, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_gapsidebysidewhite.IsReady)
            {
                // The current value of _gapsidebysidewhite is represented by itself (_gapsidebysidewhite)
                // or _gapsidebysidewhite.Current.Value
                Plot("GapSideBySideWhite", "gapsidebysidewhite", _gapsidebysidewhite);
                
            }
        }
    }
    class GapSideBySideWhiteAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gapsidebysidewhite = GapSideBySideWhite(SPY)
            self.RegisterIndicator(self.symbol, self.gapsidebysidewhite, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.gapsidebysidewhite.IsReady:
                # The current value of self.gapsidebysidewhite is represented by self.gapsidebysidewhite.Current.Value
                self.Plot("GapSideBySideWhite", "gapsidebysidewhite", self.gapsidebysidewhite.Current.Value)
                
    

    The following reference table describes the GapSideBySideWhite constructor:

    GapSideBySideWhite() 1/2

                GapSideBySideWhite QuantConnect.Indicators.CandlestickPatterns.GapSideBySideWhite (
        string  name
       )
            

    Initializes a new instance of the GapSideBySideWhit class using the specified name.

    GapSideBySideWhite() 2/2

                GapSideBySideWhite QuantConnect.Indicators.CandlestickPatterns.GapSideBySideWhite (
        
       )
            

    Initializes a new instance of the GapSideBySideWhit class.

     

    13.1.1.16 Gravestone Doji

    Introduction

    Create a new Gravestone Doji candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using GravestoneDoji Indicator

    To create an automatic indicators for GravestoneDoji , call the GravestoneDoji helper method from the QCAlgorithm class. The GravestoneDoji method creates a GravestoneDoji object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class GravestoneDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GravestoneDoji _gravestonedoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gravestonedoji = GravestoneDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_gravestonedoji.IsReady)
            {
                // The current value of _gravestonedoji is represented by itself (_gravestonedoji)
                // or _gravestonedoji.Current.Value
                Plot("GravestoneDoji", "gravestonedoji", _gravestonedoji);
                
            }
        }
    }
    class GravestoneDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gravestonedoji = self.GravestoneDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.gravestonedoji.IsReady:
                # The current value of self.gravestonedoji is represented by self.gravestonedoji.Current.Value
                self.Plot("GravestoneDoji", "gravestonedoji", self.gravestonedoji.Current.Value)
                
    

    The following reference table describes the GravestoneDoji method:

    GravestoneDoji() 1/1

                GravestoneDoji QuantConnect.Algorithm.CandlestickPatterns.GravestoneDoji (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new GravestoneDoji pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a GravestoneDoji indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class GravestoneDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GravestoneDoji _gravestonedoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gravestonedoji = new GravestoneDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _gravestonedoji.Update(bar);
            }
    
            if (_gravestonedoji.IsReady)
            {
                // The current value of _gravestonedoji is represented by itself (_gravestonedoji)
                // or _gravestonedoji.Current.Value
                Plot("GravestoneDoji", "gravestonedoji", _gravestonedoji);
                
            }
        }
    }
    class GravestoneDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gravestonedoji = GravestoneDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.gravestonedoji.Update(bar)
    
            if self.gravestonedoji.IsReady:
                # The current value of self.gravestonedoji is represented by self.gravestonedoji.Current.Value
                self.Plot("GravestoneDoji", "gravestonedoji", self.gravestonedoji.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class GravestoneDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private GravestoneDoji _gravestonedoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _gravestonedoji = new GravestoneDoji(SPY);
            RegisterIndicator(_symbol, _gravestonedoji, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_gravestonedoji.IsReady)
            {
                // The current value of _gravestonedoji is represented by itself (_gravestonedoji)
                // or _gravestonedoji.Current.Value
                Plot("GravestoneDoji", "gravestonedoji", _gravestonedoji);
                
            }
        }
    }
    class GravestoneDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.gravestonedoji = GravestoneDoji(SPY)
            self.RegisterIndicator(self.symbol, self.gravestonedoji, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.gravestonedoji.IsReady:
                # The current value of self.gravestonedoji is represented by self.gravestonedoji.Current.Value
                self.Plot("GravestoneDoji", "gravestonedoji", self.gravestonedoji.Current.Value)
                
    

    The following reference table describes the GravestoneDoji constructor:

    GravestoneDoji() 1/2

                GravestoneDoji QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji (
        string  name
       )
            

    Initializes a new instance of the GravestoneDoj class using the specified name.

    GravestoneDoji() 2/2

                GravestoneDoji QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji (
        
       )
            

    Initializes a new instance of the GravestoneDoj class.

     

    13.1.1.17 Hammer

    Introduction

    Create a new Hammer candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Hammer Indicator

    To create an automatic indicators for Hammer , call the Hammer helper method from the QCAlgorithm class. The Hammer method creates a Hammer object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hammer _hammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hammer = Hammer(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_hammer.IsReady)
            {
                // The current value of _hammer is represented by itself (_hammer)
                // or _hammer.Current.Value
                Plot("Hammer", "hammer", _hammer);
                
            }
        }
    }
    class HammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hammer = self.Hammer(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.hammer.IsReady:
                # The current value of self.hammer is represented by self.hammer.Current.Value
                self.Plot("Hammer", "hammer", self.hammer.Current.Value)
                
    

    The following reference table describes the Hammer method:

    Hammer() 1/1

                Hammer QuantConnect.Algorithm.CandlestickPatterns.Hammer (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Hammer pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Hammer indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hammer _hammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hammer = new Hammer(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hammer.Update(bar);
            }
    
            if (_hammer.IsReady)
            {
                // The current value of _hammer is represented by itself (_hammer)
                // or _hammer.Current.Value
                Plot("Hammer", "hammer", _hammer);
                
            }
        }
    }
    class HammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hammer = Hammer(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hammer.Update(bar)
    
            if self.hammer.IsReady:
                # The current value of self.hammer is represented by self.hammer.Current.Value
                self.Plot("Hammer", "hammer", self.hammer.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hammer _hammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hammer = new Hammer(SPY);
            RegisterIndicator(_symbol, _hammer, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hammer.IsReady)
            {
                // The current value of _hammer is represented by itself (_hammer)
                // or _hammer.Current.Value
                Plot("Hammer", "hammer", _hammer);
                
            }
        }
    }
    class HammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hammer = Hammer(SPY)
            self.RegisterIndicator(self.symbol, self.hammer, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hammer.IsReady:
                # The current value of self.hammer is represented by self.hammer.Current.Value
                self.Plot("Hammer", "hammer", self.hammer.Current.Value)
                
    

    The following reference table describes the Hammer constructor:

    Hammer() 1/2

                Hammer QuantConnect.Indicators.CandlestickPatterns.Hammer (
        string  name
       )
            

    Initializes a new instance of the Hamme class using the specified name.

    Hammer() 2/2

                Hammer QuantConnect.Indicators.CandlestickPatterns.Hammer (
        
       )
            

    Initializes a new instance of the Hamme class.

     

    13.1.1.18 Hanging Man

    Introduction

    Create a new Hanging Man candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using HangingMan Indicator

    To create an automatic indicators for HangingMan , call the HangingMan helper method from the QCAlgorithm class. The HangingMan method creates a HangingMan object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HangingManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HangingMan _hangingman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hangingman = HangingMan(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_hangingman.IsReady)
            {
                // The current value of _hangingman is represented by itself (_hangingman)
                // or _hangingman.Current.Value
                Plot("HangingMan", "hangingman", _hangingman);
                
            }
        }
    }
    class HangingManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hangingman = self.HangingMan(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.hangingman.IsReady:
                # The current value of self.hangingman is represented by self.hangingman.Current.Value
                self.Plot("HangingMan", "hangingman", self.hangingman.Current.Value)
                
    

    The following reference table describes the HangingMan method:

    HangingMan() 1/1

                HangingMan QuantConnect.Algorithm.CandlestickPatterns.HangingMan (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new HangingMan pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HangingMan indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HangingManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HangingMan _hangingman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hangingman = new HangingMan(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hangingman.Update(bar);
            }
    
            if (_hangingman.IsReady)
            {
                // The current value of _hangingman is represented by itself (_hangingman)
                // or _hangingman.Current.Value
                Plot("HangingMan", "hangingman", _hangingman);
                
            }
        }
    }
    class HangingManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hangingman = HangingMan(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hangingman.Update(bar)
    
            if self.hangingman.IsReady:
                # The current value of self.hangingman is represented by self.hangingman.Current.Value
                self.Plot("HangingMan", "hangingman", self.hangingman.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HangingManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HangingMan _hangingman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hangingman = new HangingMan(SPY);
            RegisterIndicator(_symbol, _hangingman, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hangingman.IsReady)
            {
                // The current value of _hangingman is represented by itself (_hangingman)
                // or _hangingman.Current.Value
                Plot("HangingMan", "hangingman", _hangingman);
                
            }
        }
    }
    class HangingManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hangingman = HangingMan(SPY)
            self.RegisterIndicator(self.symbol, self.hangingman, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hangingman.IsReady:
                # The current value of self.hangingman is represented by self.hangingman.Current.Value
                self.Plot("HangingMan", "hangingman", self.hangingman.Current.Value)
                
    

    The following reference table describes the HangingMan constructor:

    HangingMan() 1/2

                HangingMan QuantConnect.Indicators.CandlestickPatterns.HangingMan (
        string  name
       )
            

    Initializes a new instance of the HangingMa class using the specified name.

    HangingMan() 2/2

                HangingMan QuantConnect.Indicators.CandlestickPatterns.HangingMan (
        
       )
            

    Initializes a new instance of the HangingMa class.

     

    13.1.1.19 Harami

    Introduction

    Create a new Harami candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Harami Indicator

    To create an automatic indicators for Harami , call the Harami helper method from the QCAlgorithm class. The Harami method creates a Harami object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HaramiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Harami _harami;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _harami = Harami(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_harami.IsReady)
            {
                // The current value of _harami is represented by itself (_harami)
                // or _harami.Current.Value
                Plot("Harami", "harami", _harami);
                
            }
        }
    }
    class HaramiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.harami = self.Harami(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.harami.IsReady:
                # The current value of self.harami is represented by self.harami.Current.Value
                self.Plot("Harami", "harami", self.harami.Current.Value)
                
    

    The following reference table describes the Harami method:

    Harami() 1/1

                Harami QuantConnect.Algorithm.CandlestickPatterns.Harami (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Harami pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Harami indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HaramiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Harami _harami;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _harami = new Harami(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _harami.Update(bar);
            }
    
            if (_harami.IsReady)
            {
                // The current value of _harami is represented by itself (_harami)
                // or _harami.Current.Value
                Plot("Harami", "harami", _harami);
                
            }
        }
    }
    class HaramiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.harami = Harami(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.harami.Update(bar)
    
            if self.harami.IsReady:
                # The current value of self.harami is represented by self.harami.Current.Value
                self.Plot("Harami", "harami", self.harami.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HaramiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Harami _harami;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _harami = new Harami(SPY);
            RegisterIndicator(_symbol, _harami, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_harami.IsReady)
            {
                // The current value of _harami is represented by itself (_harami)
                // or _harami.Current.Value
                Plot("Harami", "harami", _harami);
                
            }
        }
    }
    class HaramiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.harami = Harami(SPY)
            self.RegisterIndicator(self.symbol, self.harami, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.harami.IsReady:
                # The current value of self.harami is represented by self.harami.Current.Value
                self.Plot("Harami", "harami", self.harami.Current.Value)
                
    

    The following reference table describes the Harami constructor:

    Harami() 1/2

                Harami QuantConnect.Indicators.CandlestickPatterns.Harami (
        string  name
       )
            

    Initializes a new instance of the Haram class using the specified name.

    Harami() 2/2

                Harami QuantConnect.Indicators.CandlestickPatterns.Harami (
        
       )
            

    Initializes a new instance of the Haram class.

     

    13.1.1.20 Harami Cross

    Introduction

    Create a new Harami Cross candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using HaramiCross Indicator

    To create an automatic indicators for HaramiCross , call the HaramiCross helper method from the QCAlgorithm class. The HaramiCross method creates a HaramiCross object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HaramiCrossAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HaramiCross _haramicross;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _haramicross = HaramiCross(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_haramicross.IsReady)
            {
                // The current value of _haramicross is represented by itself (_haramicross)
                // or _haramicross.Current.Value
                Plot("HaramiCross", "haramicross", _haramicross);
                
            }
        }
    }
    class HaramiCrossAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.haramicross = self.HaramiCross(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.haramicross.IsReady:
                # The current value of self.haramicross is represented by self.haramicross.Current.Value
                self.Plot("HaramiCross", "haramicross", self.haramicross.Current.Value)
                
    

    The following reference table describes the HaramiCross method:

    HaramiCross() 1/1

                HaramiCross QuantConnect.Algorithm.CandlestickPatterns.HaramiCross (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new HaramiCross pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HaramiCross indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HaramiCrossAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HaramiCross _haramicross;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _haramicross = new HaramiCross(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _haramicross.Update(bar);
            }
    
            if (_haramicross.IsReady)
            {
                // The current value of _haramicross is represented by itself (_haramicross)
                // or _haramicross.Current.Value
                Plot("HaramiCross", "haramicross", _haramicross);
                
            }
        }
    }
    class HaramiCrossAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.haramicross = HaramiCross(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.haramicross.Update(bar)
    
            if self.haramicross.IsReady:
                # The current value of self.haramicross is represented by self.haramicross.Current.Value
                self.Plot("HaramiCross", "haramicross", self.haramicross.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HaramiCrossAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HaramiCross _haramicross;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _haramicross = new HaramiCross(SPY);
            RegisterIndicator(_symbol, _haramicross, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_haramicross.IsReady)
            {
                // The current value of _haramicross is represented by itself (_haramicross)
                // or _haramicross.Current.Value
                Plot("HaramiCross", "haramicross", _haramicross);
                
            }
        }
    }
    class HaramiCrossAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.haramicross = HaramiCross(SPY)
            self.RegisterIndicator(self.symbol, self.haramicross, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.haramicross.IsReady:
                # The current value of self.haramicross is represented by self.haramicross.Current.Value
                self.Plot("HaramiCross", "haramicross", self.haramicross.Current.Value)
                
    

    The following reference table describes the HaramiCross constructor:

    HaramiCross() 1/2

                HaramiCross QuantConnect.Indicators.CandlestickPatterns.HaramiCross (
        string  name
       )
            

    Initializes a new instance of the HaramiCros class using the specified name.

    HaramiCross() 2/2

                HaramiCross QuantConnect.Indicators.CandlestickPatterns.HaramiCross (
        
       )
            

    Initializes a new instance of the HaramiCros class.

     

    13.1.1.21 High Wave Candle

    Introduction

    Create a new High-Wave Candle candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using HighWaveCandle Indicator

    To create an automatic indicators for HighWaveCandle , call the HighWaveCandle helper method from the QCAlgorithm class. The HighWaveCandle method creates a HighWaveCandle object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HighWaveCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HighWaveCandle _highwavecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _highwavecandle = HighWaveCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_highwavecandle.IsReady)
            {
                // The current value of _highwavecandle is represented by itself (_highwavecandle)
                // or _highwavecandle.Current.Value
                Plot("HighWaveCandle", "highwavecandle", _highwavecandle);
                
            }
        }
    }
    class HighWaveCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.highwavecandle = self.HighWaveCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.highwavecandle.IsReady:
                # The current value of self.highwavecandle is represented by self.highwavecandle.Current.Value
                self.Plot("HighWaveCandle", "highwavecandle", self.highwavecandle.Current.Value)
                
    

    The following reference table describes the HighWaveCandle method:

    HighWaveCandle() 1/1

                HighWaveCandle QuantConnect.Algorithm.CandlestickPatterns.HighWaveCandle (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new HighWaveCandle pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HighWaveCandle indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HighWaveCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HighWaveCandle _highwavecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _highwavecandle = new HighWaveCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _highwavecandle.Update(bar);
            }
    
            if (_highwavecandle.IsReady)
            {
                // The current value of _highwavecandle is represented by itself (_highwavecandle)
                // or _highwavecandle.Current.Value
                Plot("HighWaveCandle", "highwavecandle", _highwavecandle);
                
            }
        }
    }
    class HighWaveCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.highwavecandle = HighWaveCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.highwavecandle.Update(bar)
    
            if self.highwavecandle.IsReady:
                # The current value of self.highwavecandle is represented by self.highwavecandle.Current.Value
                self.Plot("HighWaveCandle", "highwavecandle", self.highwavecandle.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HighWaveCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HighWaveCandle _highwavecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _highwavecandle = new HighWaveCandle(SPY);
            RegisterIndicator(_symbol, _highwavecandle, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_highwavecandle.IsReady)
            {
                // The current value of _highwavecandle is represented by itself (_highwavecandle)
                // or _highwavecandle.Current.Value
                Plot("HighWaveCandle", "highwavecandle", _highwavecandle);
                
            }
        }
    }
    class HighWaveCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.highwavecandle = HighWaveCandle(SPY)
            self.RegisterIndicator(self.symbol, self.highwavecandle, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.highwavecandle.IsReady:
                # The current value of self.highwavecandle is represented by self.highwavecandle.Current.Value
                self.Plot("HighWaveCandle", "highwavecandle", self.highwavecandle.Current.Value)
                
    

    The following reference table describes the HighWaveCandle constructor:

    HighWaveCandle() 1/2

                HighWaveCandle QuantConnect.Indicators.CandlestickPatterns.HighWaveCandle (
        string  name
       )
            

    Initializes a new instance of the HighWaveCandl class using the specified name.

    HighWaveCandle() 2/2

                HighWaveCandle QuantConnect.Indicators.CandlestickPatterns.HighWaveCandle (
        
       )
            

    Initializes a new instance of the HighWaveCandl class.

     

    13.1.1.22 Hikkake

    Introduction

    Create a new Hikkake candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Hikkake Indicator

    To create an automatic indicators for Hikkake , call the Hikkake helper method from the QCAlgorithm class. The Hikkake method creates a Hikkake object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HikkakeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hikkake _hikkake;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkake = Hikkake(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_hikkake.IsReady)
            {
                // The current value of _hikkake is represented by itself (_hikkake)
                // or _hikkake.Current.Value
                Plot("Hikkake", "hikkake", _hikkake);
                
            }
        }
    }
    class HikkakeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkake = self.Hikkake(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.hikkake.IsReady:
                # The current value of self.hikkake is represented by self.hikkake.Current.Value
                self.Plot("Hikkake", "hikkake", self.hikkake.Current.Value)
                
    

    The following reference table describes the Hikkake method:

    Hikkake() 1/1

                Hikkake QuantConnect.Algorithm.CandlestickPatterns.Hikkake (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Hikkake pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Hikkake indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HikkakeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hikkake _hikkake;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkake = new Hikkake(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hikkake.Update(bar);
            }
    
            if (_hikkake.IsReady)
            {
                // The current value of _hikkake is represented by itself (_hikkake)
                // or _hikkake.Current.Value
                Plot("Hikkake", "hikkake", _hikkake);
                
            }
        }
    }
    class HikkakeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkake = Hikkake(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hikkake.Update(bar)
    
            if self.hikkake.IsReady:
                # The current value of self.hikkake is represented by self.hikkake.Current.Value
                self.Plot("Hikkake", "hikkake", self.hikkake.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HikkakeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Hikkake _hikkake;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkake = new Hikkake(SPY);
            RegisterIndicator(_symbol, _hikkake, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hikkake.IsReady)
            {
                // The current value of _hikkake is represented by itself (_hikkake)
                // or _hikkake.Current.Value
                Plot("Hikkake", "hikkake", _hikkake);
                
            }
        }
    }
    class HikkakeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkake = Hikkake(SPY)
            self.RegisterIndicator(self.symbol, self.hikkake, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hikkake.IsReady:
                # The current value of self.hikkake is represented by self.hikkake.Current.Value
                self.Plot("Hikkake", "hikkake", self.hikkake.Current.Value)
                
    

    The following reference table describes the Hikkake constructor:

    Hikkake() 1/2

                Hikkake QuantConnect.Indicators.CandlestickPatterns.Hikkake (
        string  name
       )
            

    Initializes a new instance of the Hikkak class using the specified name.

    Hikkake() 2/2

                Hikkake QuantConnect.Indicators.CandlestickPatterns.Hikkake (
        
       )
            

    Initializes a new instance of the Hikkak class.

     

    13.1.1.23 Hikkake Modified

    Introduction

    Create a new Hikkake Modified candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using HikkakeModified Indicator

    To create an automatic indicators for HikkakeModified , call the HikkakeModified helper method from the QCAlgorithm class. The HikkakeModified method creates a HikkakeModified object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HikkakeModifiedAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HikkakeModified _hikkakemodified;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkakemodified = HikkakeModified(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_hikkakemodified.IsReady)
            {
                // The current value of _hikkakemodified is represented by itself (_hikkakemodified)
                // or _hikkakemodified.Current.Value
                Plot("HikkakeModified", "hikkakemodified", _hikkakemodified);
                
            }
        }
    }
    class HikkakeModifiedAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkakemodified = self.HikkakeModified(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.hikkakemodified.IsReady:
                # The current value of self.hikkakemodified is represented by self.hikkakemodified.Current.Value
                self.Plot("HikkakeModified", "hikkakemodified", self.hikkakemodified.Current.Value)
                
    

    The following reference table describes the HikkakeModified method:

    HikkakeModified() 1/1

                HikkakeModified QuantConnect.Algorithm.CandlestickPatterns.HikkakeModified (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new HikkakeModified pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HikkakeModified indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HikkakeModifiedAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HikkakeModified _hikkakemodified;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkakemodified = new HikkakeModified(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hikkakemodified.Update(bar);
            }
    
            if (_hikkakemodified.IsReady)
            {
                // The current value of _hikkakemodified is represented by itself (_hikkakemodified)
                // or _hikkakemodified.Current.Value
                Plot("HikkakeModified", "hikkakemodified", _hikkakemodified);
                
            }
        }
    }
    class HikkakeModifiedAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkakemodified = HikkakeModified(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hikkakemodified.Update(bar)
    
            if self.hikkakemodified.IsReady:
                # The current value of self.hikkakemodified is represented by self.hikkakemodified.Current.Value
                self.Plot("HikkakeModified", "hikkakemodified", self.hikkakemodified.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HikkakeModifiedAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HikkakeModified _hikkakemodified;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hikkakemodified = new HikkakeModified(SPY);
            RegisterIndicator(_symbol, _hikkakemodified, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hikkakemodified.IsReady)
            {
                // The current value of _hikkakemodified is represented by itself (_hikkakemodified)
                // or _hikkakemodified.Current.Value
                Plot("HikkakeModified", "hikkakemodified", _hikkakemodified);
                
            }
        }
    }
    class HikkakeModifiedAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hikkakemodified = HikkakeModified(SPY)
            self.RegisterIndicator(self.symbol, self.hikkakemodified, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hikkakemodified.IsReady:
                # The current value of self.hikkakemodified is represented by self.hikkakemodified.Current.Value
                self.Plot("HikkakeModified", "hikkakemodified", self.hikkakemodified.Current.Value)
                
    

    The following reference table describes the HikkakeModified constructor:

    HikkakeModified() 1/2

                HikkakeModified QuantConnect.Indicators.CandlestickPatterns.HikkakeModified (
        string  name
       )
            

    Initializes a new instance of the HikkakeModifie class using the specified name.

    HikkakeModified() 2/2

                HikkakeModified QuantConnect.Indicators.CandlestickPatterns.HikkakeModified (
        
       )
            

    Initializes a new instance of the HikkakeModifie class.

     

    13.1.1.24 Homing Pigeon

    Introduction

    Create a new Homing Pigeon candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using HomingPigeon Indicator

    To create an automatic indicators for HomingPigeon , call the HomingPigeon helper method from the QCAlgorithm class. The HomingPigeon method creates a HomingPigeon object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HomingPigeonAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HomingPigeon _homingpigeon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _homingpigeon = HomingPigeon(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_homingpigeon.IsReady)
            {
                // The current value of _homingpigeon is represented by itself (_homingpigeon)
                // or _homingpigeon.Current.Value
                Plot("HomingPigeon", "homingpigeon", _homingpigeon);
                
            }
        }
    }
    class HomingPigeonAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.homingpigeon = self.HomingPigeon(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.homingpigeon.IsReady:
                # The current value of self.homingpigeon is represented by self.homingpigeon.Current.Value
                self.Plot("HomingPigeon", "homingpigeon", self.homingpigeon.Current.Value)
                
    

    The following reference table describes the HomingPigeon method:

    HomingPigeon() 1/1

                HomingPigeon QuantConnect.Algorithm.CandlestickPatterns.HomingPigeon (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new HomingPigeon pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HomingPigeon indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class HomingPigeonAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HomingPigeon _homingpigeon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _homingpigeon = new HomingPigeon(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _homingpigeon.Update(bar);
            }
    
            if (_homingpigeon.IsReady)
            {
                // The current value of _homingpigeon is represented by itself (_homingpigeon)
                // or _homingpigeon.Current.Value
                Plot("HomingPigeon", "homingpigeon", _homingpigeon);
                
            }
        }
    }
    class HomingPigeonAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.homingpigeon = HomingPigeon(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.homingpigeon.Update(bar)
    
            if self.homingpigeon.IsReady:
                # The current value of self.homingpigeon is represented by self.homingpigeon.Current.Value
                self.Plot("HomingPigeon", "homingpigeon", self.homingpigeon.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HomingPigeonAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HomingPigeon _homingpigeon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _homingpigeon = new HomingPigeon(SPY);
            RegisterIndicator(_symbol, _homingpigeon, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_homingpigeon.IsReady)
            {
                // The current value of _homingpigeon is represented by itself (_homingpigeon)
                // or _homingpigeon.Current.Value
                Plot("HomingPigeon", "homingpigeon", _homingpigeon);
                
            }
        }
    }
    class HomingPigeonAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.homingpigeon = HomingPigeon(SPY)
            self.RegisterIndicator(self.symbol, self.homingpigeon, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.homingpigeon.IsReady:
                # The current value of self.homingpigeon is represented by self.homingpigeon.Current.Value
                self.Plot("HomingPigeon", "homingpigeon", self.homingpigeon.Current.Value)
                
    

    The following reference table describes the HomingPigeon constructor:

    HomingPigeon() 1/2

                HomingPigeon QuantConnect.Indicators.CandlestickPatterns.HomingPigeon (
        string  name
       )
            

    Initializes a new instance of the HomingPigeo class using the specified name.

    HomingPigeon() 2/2

                HomingPigeon QuantConnect.Indicators.CandlestickPatterns.HomingPigeon (
        
       )
            

    Initializes a new instance of the HomingPigeo class.

     

    13.1.1.25 Identical Three Crows

    Introduction

    Create a new Identical Three Crows candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using IdenticalThreeCrows Indicator

    To create an automatic indicators for IdenticalThreeCrows , call the IdenticalThreeCrows helper method from the QCAlgorithm class. The IdenticalThreeCrows method creates a IdenticalThreeCrows object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class IdenticalThreeCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IdenticalThreeCrows _identicalthreecrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identicalthreecrows = IdenticalThreeCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_identicalthreecrows.IsReady)
            {
                // The current value of _identicalthreecrows is represented by itself (_identicalthreecrows)
                // or _identicalthreecrows.Current.Value
                Plot("IdenticalThreeCrows", "identicalthreecrows", _identicalthreecrows);
                
            }
        }
    }
    class IdenticalThreeCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identicalthreecrows = self.IdenticalThreeCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.identicalthreecrows.IsReady:
                # The current value of self.identicalthreecrows is represented by self.identicalthreecrows.Current.Value
                self.Plot("IdenticalThreeCrows", "identicalthreecrows", self.identicalthreecrows.Current.Value)
                
    

    The following reference table describes the IdenticalThreeCrows method:

    IdenticalThreeCrows() 1/1

                IdenticalThreeCrows QuantConnect.Algorithm.CandlestickPatterns.IdenticalThreeCrows (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new IdenticalThreeCrows pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a IdenticalThreeCrows indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class IdenticalThreeCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IdenticalThreeCrows _identicalthreecrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identicalthreecrows = new IdenticalThreeCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _identicalthreecrows.Update(bar);
            }
    
            if (_identicalthreecrows.IsReady)
            {
                // The current value of _identicalthreecrows is represented by itself (_identicalthreecrows)
                // or _identicalthreecrows.Current.Value
                Plot("IdenticalThreeCrows", "identicalthreecrows", _identicalthreecrows);
                
            }
        }
    }
    class IdenticalThreeCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identicalthreecrows = IdenticalThreeCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.identicalthreecrows.Update(bar)
    
            if self.identicalthreecrows.IsReady:
                # The current value of self.identicalthreecrows is represented by self.identicalthreecrows.Current.Value
                self.Plot("IdenticalThreeCrows", "identicalthreecrows", self.identicalthreecrows.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class IdenticalThreeCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IdenticalThreeCrows _identicalthreecrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identicalthreecrows = new IdenticalThreeCrows(SPY);
            RegisterIndicator(_symbol, _identicalthreecrows, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_identicalthreecrows.IsReady)
            {
                // The current value of _identicalthreecrows is represented by itself (_identicalthreecrows)
                // or _identicalthreecrows.Current.Value
                Plot("IdenticalThreeCrows", "identicalthreecrows", _identicalthreecrows);
                
            }
        }
    }
    class IdenticalThreeCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identicalthreecrows = IdenticalThreeCrows(SPY)
            self.RegisterIndicator(self.symbol, self.identicalthreecrows, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.identicalthreecrows.IsReady:
                # The current value of self.identicalthreecrows is represented by self.identicalthreecrows.Current.Value
                self.Plot("IdenticalThreeCrows", "identicalthreecrows", self.identicalthreecrows.Current.Value)
                
    

    The following reference table describes the IdenticalThreeCrows constructor:

    IdenticalThreeCrows() 1/2

                IdenticalThreeCrows QuantConnect.Indicators.CandlestickPatterns.IdenticalThreeCrows (
        string  name
       )
            

    Initializes a new instance of the IdenticalThreeCrow class using the specified name.

    IdenticalThreeCrows() 2/2

                IdenticalThreeCrows QuantConnect.Indicators.CandlestickPatterns.IdenticalThreeCrows (
        
       )
            

    Initializes a new instance of the IdenticalThreeCrow class.

     

    13.1.1.26 In Neck

    Introduction

    Create a new In-Neck candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using InNeck Indicator

    To create an automatic indicators for InNeck , call the InNeck helper method from the QCAlgorithm class. The InNeck method creates a InNeck object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class InNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InNeck _inneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _inneck = InNeck(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_inneck.IsReady)
            {
                // The current value of _inneck is represented by itself (_inneck)
                // or _inneck.Current.Value
                Plot("InNeck", "inneck", _inneck);
                
            }
        }
    }
    class InNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.inneck = self.InNeck(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.inneck.IsReady:
                # The current value of self.inneck is represented by self.inneck.Current.Value
                self.Plot("InNeck", "inneck", self.inneck.Current.Value)
                
    

    The following reference table describes the InNeck method:

    InNeck() 1/1

                InNeck QuantConnect.Algorithm.CandlestickPatterns.InNeck (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new InNeck pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a InNeck indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class InNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InNeck _inneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _inneck = new InNeck(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _inneck.Update(bar);
            }
    
            if (_inneck.IsReady)
            {
                // The current value of _inneck is represented by itself (_inneck)
                // or _inneck.Current.Value
                Plot("InNeck", "inneck", _inneck);
                
            }
        }
    }
    class InNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.inneck = InNeck(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.inneck.Update(bar)
    
            if self.inneck.IsReady:
                # The current value of self.inneck is represented by self.inneck.Current.Value
                self.Plot("InNeck", "inneck", self.inneck.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class InNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InNeck _inneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _inneck = new InNeck(SPY);
            RegisterIndicator(_symbol, _inneck, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_inneck.IsReady)
            {
                // The current value of _inneck is represented by itself (_inneck)
                // or _inneck.Current.Value
                Plot("InNeck", "inneck", _inneck);
                
            }
        }
    }
    class InNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.inneck = InNeck(SPY)
            self.RegisterIndicator(self.symbol, self.inneck, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.inneck.IsReady:
                # The current value of self.inneck is represented by self.inneck.Current.Value
                self.Plot("InNeck", "inneck", self.inneck.Current.Value)
                
    

    The following reference table describes the InNeck constructor:

    InNeck() 1/2

                InNeck QuantConnect.Indicators.CandlestickPatterns.InNeck (
        string  name
       )
            

    Initializes a new instance of the InNec class using the specified name.

    InNeck() 2/2

                InNeck QuantConnect.Indicators.CandlestickPatterns.InNeck (
        
       )
            

    Initializes a new instance of the InNec class.

     

    13.1.1.27 Inverted Hammer

    Introduction

    Create a new Inverted Hammer candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using InvertedHammer Indicator

    To create an automatic indicators for InvertedHammer , call the InvertedHammer helper method from the QCAlgorithm class. The InvertedHammer method creates a InvertedHammer object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class InvertedHammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InvertedHammer _invertedhammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _invertedhammer = InvertedHammer(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_invertedhammer.IsReady)
            {
                // The current value of _invertedhammer is represented by itself (_invertedhammer)
                // or _invertedhammer.Current.Value
                Plot("InvertedHammer", "invertedhammer", _invertedhammer);
                
            }
        }
    }
    class InvertedHammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.invertedhammer = self.InvertedHammer(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.invertedhammer.IsReady:
                # The current value of self.invertedhammer is represented by self.invertedhammer.Current.Value
                self.Plot("InvertedHammer", "invertedhammer", self.invertedhammer.Current.Value)
                
    

    The following reference table describes the InvertedHammer method:

    InvertedHammer() 1/1

                InvertedHammer QuantConnect.Algorithm.CandlestickPatterns.InvertedHammer (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new InvertedHammer pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a InvertedHammer indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class InvertedHammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InvertedHammer _invertedhammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _invertedhammer = new InvertedHammer(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _invertedhammer.Update(bar);
            }
    
            if (_invertedhammer.IsReady)
            {
                // The current value of _invertedhammer is represented by itself (_invertedhammer)
                // or _invertedhammer.Current.Value
                Plot("InvertedHammer", "invertedhammer", _invertedhammer);
                
            }
        }
    }
    class InvertedHammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.invertedhammer = InvertedHammer(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.invertedhammer.Update(bar)
    
            if self.invertedhammer.IsReady:
                # The current value of self.invertedhammer is represented by self.invertedhammer.Current.Value
                self.Plot("InvertedHammer", "invertedhammer", self.invertedhammer.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class InvertedHammerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private InvertedHammer _invertedhammer;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _invertedhammer = new InvertedHammer(SPY);
            RegisterIndicator(_symbol, _invertedhammer, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_invertedhammer.IsReady)
            {
                // The current value of _invertedhammer is represented by itself (_invertedhammer)
                // or _invertedhammer.Current.Value
                Plot("InvertedHammer", "invertedhammer", _invertedhammer);
                
            }
        }
    }
    class InvertedHammerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.invertedhammer = InvertedHammer(SPY)
            self.RegisterIndicator(self.symbol, self.invertedhammer, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.invertedhammer.IsReady:
                # The current value of self.invertedhammer is represented by self.invertedhammer.Current.Value
                self.Plot("InvertedHammer", "invertedhammer", self.invertedhammer.Current.Value)
                
    

    The following reference table describes the InvertedHammer constructor:

    InvertedHammer() 1/2

                InvertedHammer QuantConnect.Indicators.CandlestickPatterns.InvertedHammer (
        string  name
       )
            

    Initializes a new instance of the InvertedHamme class using the specified name.

    InvertedHammer() 2/2

                InvertedHammer QuantConnect.Indicators.CandlestickPatterns.InvertedHammer (
        
       )
            

    Initializes a new instance of the InvertedHamme class.

     

    13.1.1.28 Kicking

    Introduction

    Create a new Kicking candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Kicking Indicator

    To create an automatic indicators for Kicking , call the Kicking helper method from the QCAlgorithm class. The Kicking method creates a Kicking object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class KickingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Kicking _kicking;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kicking = Kicking(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_kicking.IsReady)
            {
                // The current value of _kicking is represented by itself (_kicking)
                // or _kicking.Current.Value
                Plot("Kicking", "kicking", _kicking);
                
            }
        }
    }
    class KickingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kicking = self.Kicking(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.kicking.IsReady:
                # The current value of self.kicking is represented by self.kicking.Current.Value
                self.Plot("Kicking", "kicking", self.kicking.Current.Value)
                
    

    The following reference table describes the Kicking method:

    Kicking() 1/1

                Kicking QuantConnect.Algorithm.CandlestickPatterns.Kicking (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Kicking pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Kicking indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class KickingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Kicking _kicking;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kicking = new Kicking(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _kicking.Update(bar);
            }
    
            if (_kicking.IsReady)
            {
                // The current value of _kicking is represented by itself (_kicking)
                // or _kicking.Current.Value
                Plot("Kicking", "kicking", _kicking);
                
            }
        }
    }
    class KickingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kicking = Kicking(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.kicking.Update(bar)
    
            if self.kicking.IsReady:
                # The current value of self.kicking is represented by self.kicking.Current.Value
                self.Plot("Kicking", "kicking", self.kicking.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class KickingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Kicking _kicking;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kicking = new Kicking(SPY);
            RegisterIndicator(_symbol, _kicking, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_kicking.IsReady)
            {
                // The current value of _kicking is represented by itself (_kicking)
                // or _kicking.Current.Value
                Plot("Kicking", "kicking", _kicking);
                
            }
        }
    }
    class KickingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kicking = Kicking(SPY)
            self.RegisterIndicator(self.symbol, self.kicking, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.kicking.IsReady:
                # The current value of self.kicking is represented by self.kicking.Current.Value
                self.Plot("Kicking", "kicking", self.kicking.Current.Value)
                
    

    The following reference table describes the Kicking constructor:

    Kicking() 1/2

                Kicking QuantConnect.Indicators.CandlestickPatterns.Kicking (
        string  name
       )
            

    Initializes a new instance of the Kickin class using the specified name.

    Kicking() 2/2

                Kicking QuantConnect.Indicators.CandlestickPatterns.Kicking (
        
       )
            

    Initializes a new instance of the Kickin class.

     

    13.1.1.29 Kicking By Length

    Introduction

    Create a new Kicking (bull/bear determined by the longer marubozu) candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using KickingByLength Indicator

    To create an automatic indicators for KickingByLength , call the KickingByLength helper method from the QCAlgorithm class. The KickingByLength method creates a KickingByLength object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class KickingByLengthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KickingByLength _kickingbylength;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kickingbylength = KickingByLength(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_kickingbylength.IsReady)
            {
                // The current value of _kickingbylength is represented by itself (_kickingbylength)
                // or _kickingbylength.Current.Value
                Plot("KickingByLength", "kickingbylength", _kickingbylength);
                
            }
        }
    }
    class KickingByLengthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kickingbylength = self.KickingByLength(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.kickingbylength.IsReady:
                # The current value of self.kickingbylength is represented by self.kickingbylength.Current.Value
                self.Plot("KickingByLength", "kickingbylength", self.kickingbylength.Current.Value)
                
    

    The following reference table describes the KickingByLength method:

    KickingByLength() 1/1

                KickingByLength QuantConnect.Algorithm.CandlestickPatterns.KickingByLength (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new KickingByLength pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a KickingByLength indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class KickingByLengthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KickingByLength _kickingbylength;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kickingbylength = new KickingByLength(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _kickingbylength.Update(bar);
            }
    
            if (_kickingbylength.IsReady)
            {
                // The current value of _kickingbylength is represented by itself (_kickingbylength)
                // or _kickingbylength.Current.Value
                Plot("KickingByLength", "kickingbylength", _kickingbylength);
                
            }
        }
    }
    class KickingByLengthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kickingbylength = KickingByLength(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.kickingbylength.Update(bar)
    
            if self.kickingbylength.IsReady:
                # The current value of self.kickingbylength is represented by self.kickingbylength.Current.Value
                self.Plot("KickingByLength", "kickingbylength", self.kickingbylength.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class KickingByLengthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KickingByLength _kickingbylength;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kickingbylength = new KickingByLength(SPY);
            RegisterIndicator(_symbol, _kickingbylength, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_kickingbylength.IsReady)
            {
                // The current value of _kickingbylength is represented by itself (_kickingbylength)
                // or _kickingbylength.Current.Value
                Plot("KickingByLength", "kickingbylength", _kickingbylength);
                
            }
        }
    }
    class KickingByLengthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kickingbylength = KickingByLength(SPY)
            self.RegisterIndicator(self.symbol, self.kickingbylength, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.kickingbylength.IsReady:
                # The current value of self.kickingbylength is represented by self.kickingbylength.Current.Value
                self.Plot("KickingByLength", "kickingbylength", self.kickingbylength.Current.Value)
                
    

    The following reference table describes the KickingByLength constructor:

    KickingByLength() 1/2

                KickingByLength QuantConnect.Indicators.CandlestickPatterns.KickingByLength (
        string  name
       )
            

    Initializes a new instance of the KickingByLengt class using the specified name.

    KickingByLength() 2/2

                KickingByLength QuantConnect.Indicators.CandlestickPatterns.KickingByLength (
        
       )
            

    Initializes a new instance of the KickingByLengt class.

     

    13.1.1.30 Ladder Bottom

    Introduction

    Create a new Ladder Bottom candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using LadderBottom Indicator

    To create an automatic indicators for LadderBottom , call the LadderBottom helper method from the QCAlgorithm class. The LadderBottom method creates a LadderBottom object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LadderBottomAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LadderBottom _ladderbottom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ladderbottom = LadderBottom(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_ladderbottom.IsReady)
            {
                // The current value of _ladderbottom is represented by itself (_ladderbottom)
                // or _ladderbottom.Current.Value
                Plot("LadderBottom", "ladderbottom", _ladderbottom);
                
            }
        }
    }
    class LadderBottomAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ladderbottom = self.LadderBottom(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.ladderbottom.IsReady:
                # The current value of self.ladderbottom is represented by self.ladderbottom.Current.Value
                self.Plot("LadderBottom", "ladderbottom", self.ladderbottom.Current.Value)
                
    

    The following reference table describes the LadderBottom method:

    LadderBottom() 1/1

                LadderBottom QuantConnect.Algorithm.CandlestickPatterns.LadderBottom (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new LadderBottom pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LadderBottom indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class LadderBottomAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LadderBottom _ladderbottom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ladderbottom = new LadderBottom(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ladderbottom.Update(bar);
            }
    
            if (_ladderbottom.IsReady)
            {
                // The current value of _ladderbottom is represented by itself (_ladderbottom)
                // or _ladderbottom.Current.Value
                Plot("LadderBottom", "ladderbottom", _ladderbottom);
                
            }
        }
    }
    class LadderBottomAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ladderbottom = LadderBottom(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ladderbottom.Update(bar)
    
            if self.ladderbottom.IsReady:
                # The current value of self.ladderbottom is represented by self.ladderbottom.Current.Value
                self.Plot("LadderBottom", "ladderbottom", self.ladderbottom.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LadderBottomAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LadderBottom _ladderbottom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ladderbottom = new LadderBottom(SPY);
            RegisterIndicator(_symbol, _ladderbottom, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ladderbottom.IsReady)
            {
                // The current value of _ladderbottom is represented by itself (_ladderbottom)
                // or _ladderbottom.Current.Value
                Plot("LadderBottom", "ladderbottom", _ladderbottom);
                
            }
        }
    }
    class LadderBottomAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ladderbottom = LadderBottom(SPY)
            self.RegisterIndicator(self.symbol, self.ladderbottom, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ladderbottom.IsReady:
                # The current value of self.ladderbottom is represented by self.ladderbottom.Current.Value
                self.Plot("LadderBottom", "ladderbottom", self.ladderbottom.Current.Value)
                
    

    The following reference table describes the LadderBottom constructor:

    LadderBottom() 1/2

                LadderBottom QuantConnect.Indicators.CandlestickPatterns.LadderBottom (
        string  name
       )
            

    Initializes a new instance of the LadderBotto class using the specified name.

    LadderBottom() 2/2

                LadderBottom QuantConnect.Indicators.CandlestickPatterns.LadderBottom (
        
       )
            

    Initializes a new instance of the LadderBotto class.

     

    13.1.1.31 Long Legged Doji

    Introduction

    Create a new Long Legged Doji candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using LongLeggedDoji Indicator

    To create an automatic indicators for LongLeggedDoji , call the LongLeggedDoji helper method from the QCAlgorithm class. The LongLeggedDoji method creates a LongLeggedDoji object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LongLeggedDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLeggedDoji _longleggeddoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longleggeddoji = LongLeggedDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_longleggeddoji.IsReady)
            {
                // The current value of _longleggeddoji is represented by itself (_longleggeddoji)
                // or _longleggeddoji.Current.Value
                Plot("LongLeggedDoji", "longleggeddoji", _longleggeddoji);
                
            }
        }
    }
    class LongLeggedDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longleggeddoji = self.LongLeggedDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.longleggeddoji.IsReady:
                # The current value of self.longleggeddoji is represented by self.longleggeddoji.Current.Value
                self.Plot("LongLeggedDoji", "longleggeddoji", self.longleggeddoji.Current.Value)
                
    

    The following reference table describes the LongLeggedDoji method:

    LongLeggedDoji() 1/1

                LongLeggedDoji QuantConnect.Algorithm.CandlestickPatterns.LongLeggedDoji (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new LongLeggedDoji pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LongLeggedDoji indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class LongLeggedDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLeggedDoji _longleggeddoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longleggeddoji = new LongLeggedDoji(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _longleggeddoji.Update(bar);
            }
    
            if (_longleggeddoji.IsReady)
            {
                // The current value of _longleggeddoji is represented by itself (_longleggeddoji)
                // or _longleggeddoji.Current.Value
                Plot("LongLeggedDoji", "longleggeddoji", _longleggeddoji);
                
            }
        }
    }
    class LongLeggedDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longleggeddoji = LongLeggedDoji(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.longleggeddoji.Update(bar)
    
            if self.longleggeddoji.IsReady:
                # The current value of self.longleggeddoji is represented by self.longleggeddoji.Current.Value
                self.Plot("LongLeggedDoji", "longleggeddoji", self.longleggeddoji.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LongLeggedDojiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLeggedDoji _longleggeddoji;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longleggeddoji = new LongLeggedDoji(SPY);
            RegisterIndicator(_symbol, _longleggeddoji, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_longleggeddoji.IsReady)
            {
                // The current value of _longleggeddoji is represented by itself (_longleggeddoji)
                // or _longleggeddoji.Current.Value
                Plot("LongLeggedDoji", "longleggeddoji", _longleggeddoji);
                
            }
        }
    }
    class LongLeggedDojiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longleggeddoji = LongLeggedDoji(SPY)
            self.RegisterIndicator(self.symbol, self.longleggeddoji, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.longleggeddoji.IsReady:
                # The current value of self.longleggeddoji is represented by self.longleggeddoji.Current.Value
                self.Plot("LongLeggedDoji", "longleggeddoji", self.longleggeddoji.Current.Value)
                
    

    The following reference table describes the LongLeggedDoji constructor:

    LongLeggedDoji() 1/2

                LongLeggedDoji QuantConnect.Indicators.CandlestickPatterns.LongLeggedDoji (
        string  name
       )
            

    Initializes a new instance of the LongLeggedDoj class using the specified name.

    LongLeggedDoji() 2/2

                LongLeggedDoji QuantConnect.Indicators.CandlestickPatterns.LongLeggedDoji (
        
       )
            

    Initializes a new instance of the LongLeggedDoj class.

     

    13.1.1.32 Long Line Candle

    Introduction

    Create a new Long Line Candle candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using LongLineCandle Indicator

    To create an automatic indicators for LongLineCandle , call the LongLineCandle helper method from the QCAlgorithm class. The LongLineCandle method creates a LongLineCandle object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LongLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLineCandle _longlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longlinecandle = LongLineCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_longlinecandle.IsReady)
            {
                // The current value of _longlinecandle is represented by itself (_longlinecandle)
                // or _longlinecandle.Current.Value
                Plot("LongLineCandle", "longlinecandle", _longlinecandle);
                
            }
        }
    }
    class LongLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longlinecandle = self.LongLineCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.longlinecandle.IsReady:
                # The current value of self.longlinecandle is represented by self.longlinecandle.Current.Value
                self.Plot("LongLineCandle", "longlinecandle", self.longlinecandle.Current.Value)
                
    

    The following reference table describes the LongLineCandle method:

    LongLineCandle() 1/1

                LongLineCandle QuantConnect.Algorithm.CandlestickPatterns.LongLineCandle (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new LongLineCandle pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LongLineCandle indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class LongLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLineCandle _longlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longlinecandle = new LongLineCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _longlinecandle.Update(bar);
            }
    
            if (_longlinecandle.IsReady)
            {
                // The current value of _longlinecandle is represented by itself (_longlinecandle)
                // or _longlinecandle.Current.Value
                Plot("LongLineCandle", "longlinecandle", _longlinecandle);
                
            }
        }
    }
    class LongLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longlinecandle = LongLineCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.longlinecandle.Update(bar)
    
            if self.longlinecandle.IsReady:
                # The current value of self.longlinecandle is represented by self.longlinecandle.Current.Value
                self.Plot("LongLineCandle", "longlinecandle", self.longlinecandle.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LongLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LongLineCandle _longlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _longlinecandle = new LongLineCandle(SPY);
            RegisterIndicator(_symbol, _longlinecandle, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_longlinecandle.IsReady)
            {
                // The current value of _longlinecandle is represented by itself (_longlinecandle)
                // or _longlinecandle.Current.Value
                Plot("LongLineCandle", "longlinecandle", _longlinecandle);
                
            }
        }
    }
    class LongLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.longlinecandle = LongLineCandle(SPY)
            self.RegisterIndicator(self.symbol, self.longlinecandle, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.longlinecandle.IsReady:
                # The current value of self.longlinecandle is represented by self.longlinecandle.Current.Value
                self.Plot("LongLineCandle", "longlinecandle", self.longlinecandle.Current.Value)
                
    

    The following reference table describes the LongLineCandle constructor:

    LongLineCandle() 1/2

                LongLineCandle QuantConnect.Indicators.CandlestickPatterns.LongLineCandle (
        string  name
       )
            

    Initializes a new instance of the LongLineCandl class using the specified name.

    LongLineCandle() 2/2

                LongLineCandle QuantConnect.Indicators.CandlestickPatterns.LongLineCandle (
        
       )
            

    Initializes a new instance of the LongLineCandl class.

     

    13.1.1.33 Marubozu

    Introduction

    Create a new Marubozu candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Marubozu Indicator

    To create an automatic indicators for Marubozu , call the Marubozu helper method from the QCAlgorithm class. The Marubozu method creates a Marubozu object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Marubozu _marubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _marubozu = Marubozu(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_marubozu.IsReady)
            {
                // The current value of _marubozu is represented by itself (_marubozu)
                // or _marubozu.Current.Value
                Plot("Marubozu", "marubozu", _marubozu);
                
            }
        }
    }
    class MarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.marubozu = self.Marubozu(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.marubozu.IsReady:
                # The current value of self.marubozu is represented by self.marubozu.Current.Value
                self.Plot("Marubozu", "marubozu", self.marubozu.Current.Value)
                
    

    The following reference table describes the Marubozu method:

    Marubozu() 1/1

                Marubozu QuantConnect.Algorithm.CandlestickPatterns.Marubozu (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Marubozu pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Marubozu indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Marubozu _marubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _marubozu = new Marubozu(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _marubozu.Update(bar);
            }
    
            if (_marubozu.IsReady)
            {
                // The current value of _marubozu is represented by itself (_marubozu)
                // or _marubozu.Current.Value
                Plot("Marubozu", "marubozu", _marubozu);
                
            }
        }
    }
    class MarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.marubozu = Marubozu(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.marubozu.Update(bar)
    
            if self.marubozu.IsReady:
                # The current value of self.marubozu is represented by self.marubozu.Current.Value
                self.Plot("Marubozu", "marubozu", self.marubozu.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MarubozuAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Marubozu _marubozu;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _marubozu = new Marubozu(SPY);
            RegisterIndicator(_symbol, _marubozu, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_marubozu.IsReady)
            {
                // The current value of _marubozu is represented by itself (_marubozu)
                // or _marubozu.Current.Value
                Plot("Marubozu", "marubozu", _marubozu);
                
            }
        }
    }
    class MarubozuAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.marubozu = Marubozu(SPY)
            self.RegisterIndicator(self.symbol, self.marubozu, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.marubozu.IsReady:
                # The current value of self.marubozu is represented by self.marubozu.Current.Value
                self.Plot("Marubozu", "marubozu", self.marubozu.Current.Value)
                
    

    The following reference table describes the Marubozu constructor:

    Marubozu() 1/2

                Marubozu QuantConnect.Indicators.CandlestickPatterns.Marubozu (
        string  name
       )
            

    Initializes a new instance of the Maruboz class using the specified name.

    Marubozu() 2/2

                Marubozu QuantConnect.Indicators.CandlestickPatterns.Marubozu (
        
       )
            

    Initializes a new instance of the Maruboz class.

     

    13.1.1.34 Mat Hold

    Introduction

    Create a new Mat Hold candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using MatHold Indicator

    To create an automatic indicators for MatHold , call the MatHold helper method from the QCAlgorithm class. The MatHold method creates a MatHold object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MatHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatHold _mathold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mathold = MatHold(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_mathold.IsReady)
            {
                // The current value of _mathold is represented by itself (_mathold)
                // or _mathold.Current.Value
                Plot("MatHold", "mathold", _mathold);
                
            }
        }
    }
    class MatHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mathold = self.MatHold(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.mathold.IsReady:
                # The current value of self.mathold is represented by self.mathold.Current.Value
                self.Plot("MatHold", "mathold", self.mathold.Current.Value)
                
    

    The following reference table describes the MatHold method:

    MatHold() 1/1

                MatHold QuantConnect.Algorithm.CandlestickPatterns.MatHold (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MatHold pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MatHold indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MatHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatHold _mathold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mathold = new MatHold(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mathold.Update(bar);
            }
    
            if (_mathold.IsReady)
            {
                // The current value of _mathold is represented by itself (_mathold)
                // or _mathold.Current.Value
                Plot("MatHold", "mathold", _mathold);
                
            }
        }
    }
    class MatHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mathold = MatHold(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mathold.Update(bar)
    
            if self.mathold.IsReady:
                # The current value of self.mathold is represented by self.mathold.Current.Value
                self.Plot("MatHold", "mathold", self.mathold.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MatHoldAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatHold _mathold;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mathold = new MatHold(SPY);
            RegisterIndicator(_symbol, _mathold, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mathold.IsReady)
            {
                // The current value of _mathold is represented by itself (_mathold)
                // or _mathold.Current.Value
                Plot("MatHold", "mathold", _mathold);
                
            }
        }
    }
    class MatHoldAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mathold = MatHold(SPY)
            self.RegisterIndicator(self.symbol, self.mathold, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mathold.IsReady:
                # The current value of self.mathold is represented by self.mathold.Current.Value
                self.Plot("MatHold", "mathold", self.mathold.Current.Value)
                
    

    The following reference table describes the MatHold constructor:

    MatHold() 1/3

                MatHold QuantConnect.Indicators.CandlestickPatterns.MatHold (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the MatHol class using the specified name.

    MatHold() 2/3

                MatHold QuantConnect.Indicators.CandlestickPatterns.MatHold (
        decimal  penetration
       )
            

    Initializes a new instance of the MatHol class.

    MatHold() 3/3

                MatHold QuantConnect.Indicators.CandlestickPatterns.MatHold (
        
       )
            

    Initializes a new instance of the MatHol class.

     

    13.1.1.35 Matching Low

    Introduction

    Create a new Matching Low candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using MatchingLow Indicator

    To create an automatic indicators for MatchingLow , call the MatchingLow helper method from the QCAlgorithm class. The MatchingLow method creates a MatchingLow object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MatchingLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatchingLow _matchinglow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _matchinglow = MatchingLow(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_matchinglow.IsReady)
            {
                // The current value of _matchinglow is represented by itself (_matchinglow)
                // or _matchinglow.Current.Value
                Plot("MatchingLow", "matchinglow", _matchinglow);
                
            }
        }
    }
    class MatchingLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.matchinglow = self.MatchingLow(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.matchinglow.IsReady:
                # The current value of self.matchinglow is represented by self.matchinglow.Current.Value
                self.Plot("MatchingLow", "matchinglow", self.matchinglow.Current.Value)
                
    

    The following reference table describes the MatchingLow method:

    MatchingLow() 1/1

                MatchingLow QuantConnect.Algorithm.CandlestickPatterns.MatchingLow (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MatchingLow pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MatchingLow indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MatchingLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatchingLow _matchinglow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _matchinglow = new MatchingLow(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _matchinglow.Update(bar);
            }
    
            if (_matchinglow.IsReady)
            {
                // The current value of _matchinglow is represented by itself (_matchinglow)
                // or _matchinglow.Current.Value
                Plot("MatchingLow", "matchinglow", _matchinglow);
                
            }
        }
    }
    class MatchingLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.matchinglow = MatchingLow(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.matchinglow.Update(bar)
    
            if self.matchinglow.IsReady:
                # The current value of self.matchinglow is represented by self.matchinglow.Current.Value
                self.Plot("MatchingLow", "matchinglow", self.matchinglow.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MatchingLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MatchingLow _matchinglow;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _matchinglow = new MatchingLow(SPY);
            RegisterIndicator(_symbol, _matchinglow, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_matchinglow.IsReady)
            {
                // The current value of _matchinglow is represented by itself (_matchinglow)
                // or _matchinglow.Current.Value
                Plot("MatchingLow", "matchinglow", _matchinglow);
                
            }
        }
    }
    class MatchingLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.matchinglow = MatchingLow(SPY)
            self.RegisterIndicator(self.symbol, self.matchinglow, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.matchinglow.IsReady:
                # The current value of self.matchinglow is represented by self.matchinglow.Current.Value
                self.Plot("MatchingLow", "matchinglow", self.matchinglow.Current.Value)
                
    

    The following reference table describes the MatchingLow constructor:

    MatchingLow() 1/2

                MatchingLow QuantConnect.Indicators.CandlestickPatterns.MatchingLow (
        string  name
       )
            

    Initializes a new instance of the MatchingLo class using the specified name.

    MatchingLow() 2/2

                MatchingLow QuantConnect.Indicators.CandlestickPatterns.MatchingLow (
        
       )
            

    Initializes a new instance of the MatchingLo class.

     

    13.1.1.36 Morning Doji Star

    Introduction

    Create a new Morning Doji Star candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using MorningDojiStar Indicator

    To create an automatic indicators for MorningDojiStar , call the MorningDojiStar helper method from the QCAlgorithm class. The MorningDojiStar method creates a MorningDojiStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MorningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningDojiStar _morningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningdojistar = MorningDojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_morningdojistar.IsReady)
            {
                // The current value of _morningdojistar is represented by itself (_morningdojistar)
                // or _morningdojistar.Current.Value
                Plot("MorningDojiStar", "morningdojistar", _morningdojistar);
                
            }
        }
    }
    class MorningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningdojistar = self.MorningDojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.morningdojistar.IsReady:
                # The current value of self.morningdojistar is represented by self.morningdojistar.Current.Value
                self.Plot("MorningDojiStar", "morningdojistar", self.morningdojistar.Current.Value)
                
    

    The following reference table describes the MorningDojiStar method:

    MorningDojiStar() 1/1

                MorningDojiStar QuantConnect.Algorithm.CandlestickPatterns.MorningDojiStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MorningDojiStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MorningDojiStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MorningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningDojiStar _morningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningdojistar = new MorningDojiStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _morningdojistar.Update(bar);
            }
    
            if (_morningdojistar.IsReady)
            {
                // The current value of _morningdojistar is represented by itself (_morningdojistar)
                // or _morningdojistar.Current.Value
                Plot("MorningDojiStar", "morningdojistar", _morningdojistar);
                
            }
        }
    }
    class MorningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningdojistar = MorningDojiStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.morningdojistar.Update(bar)
    
            if self.morningdojistar.IsReady:
                # The current value of self.morningdojistar is represented by self.morningdojistar.Current.Value
                self.Plot("MorningDojiStar", "morningdojistar", self.morningdojistar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MorningDojiStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningDojiStar _morningdojistar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningdojistar = new MorningDojiStar(SPY);
            RegisterIndicator(_symbol, _morningdojistar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_morningdojistar.IsReady)
            {
                // The current value of _morningdojistar is represented by itself (_morningdojistar)
                // or _morningdojistar.Current.Value
                Plot("MorningDojiStar", "morningdojistar", _morningdojistar);
                
            }
        }
    }
    class MorningDojiStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningdojistar = MorningDojiStar(SPY)
            self.RegisterIndicator(self.symbol, self.morningdojistar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.morningdojistar.IsReady:
                # The current value of self.morningdojistar is represented by self.morningdojistar.Current.Value
                self.Plot("MorningDojiStar", "morningdojistar", self.morningdojistar.Current.Value)
                
    

    The following reference table describes the MorningDojiStar constructor:

    MorningDojiStar() 1/3

                MorningDojiStar QuantConnect.Indicators.CandlestickPatterns.MorningDojiStar (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the MorningDojiSta class using the specified name.

    MorningDojiStar() 2/3

                MorningDojiStar QuantConnect.Indicators.CandlestickPatterns.MorningDojiStar (
        decimal  penetration
       )
            

    Initializes a new instance of the MorningDojiSta class.

    MorningDojiStar() 3/3

                MorningDojiStar QuantConnect.Indicators.CandlestickPatterns.MorningDojiStar (
        
       )
            

    Initializes a new instance of the MorningDojiSta class.

     

    13.1.1.37 Morning Star

    Introduction

    Create a new Morning Star candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using MorningStar Indicator

    To create an automatic indicators for MorningStar , call the MorningStar helper method from the QCAlgorithm class. The MorningStar method creates a MorningStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MorningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningStar _morningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningstar = MorningStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_morningstar.IsReady)
            {
                // The current value of _morningstar is represented by itself (_morningstar)
                // or _morningstar.Current.Value
                Plot("MorningStar", "morningstar", _morningstar);
                
            }
        }
    }
    class MorningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningstar = self.MorningStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.morningstar.IsReady:
                # The current value of self.morningstar is represented by self.morningstar.Current.Value
                self.Plot("MorningStar", "morningstar", self.morningstar.Current.Value)
                
    

    The following reference table describes the MorningStar method:

    MorningStar() 1/1

                MorningStar QuantConnect.Algorithm.CandlestickPatterns.MorningStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MorningStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MorningStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MorningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningStar _morningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningstar = new MorningStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _morningstar.Update(bar);
            }
    
            if (_morningstar.IsReady)
            {
                // The current value of _morningstar is represented by itself (_morningstar)
                // or _morningstar.Current.Value
                Plot("MorningStar", "morningstar", _morningstar);
                
            }
        }
    }
    class MorningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningstar = MorningStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.morningstar.Update(bar)
    
            if self.morningstar.IsReady:
                # The current value of self.morningstar is represented by self.morningstar.Current.Value
                self.Plot("MorningStar", "morningstar", self.morningstar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MorningStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MorningStar _morningstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _morningstar = new MorningStar(SPY);
            RegisterIndicator(_symbol, _morningstar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_morningstar.IsReady)
            {
                // The current value of _morningstar is represented by itself (_morningstar)
                // or _morningstar.Current.Value
                Plot("MorningStar", "morningstar", _morningstar);
                
            }
        }
    }
    class MorningStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.morningstar = MorningStar(SPY)
            self.RegisterIndicator(self.symbol, self.morningstar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.morningstar.IsReady:
                # The current value of self.morningstar is represented by self.morningstar.Current.Value
                self.Plot("MorningStar", "morningstar", self.morningstar.Current.Value)
                
    

    The following reference table describes the MorningStar constructor:

    MorningStar() 1/3

                MorningStar QuantConnect.Indicators.CandlestickPatterns.MorningStar (
        string    name,
        *decimal  penetration
       )
            

    Initializes a new instance of the MorningSta class using the specified name.

    MorningStar() 2/3

                MorningStar QuantConnect.Indicators.CandlestickPatterns.MorningStar (
        decimal  penetration
       )
            

    Initializes a new instance of the MorningSta class.

    MorningStar() 3/3

                MorningStar QuantConnect.Indicators.CandlestickPatterns.MorningStar (
        
       )
            

    Initializes a new instance of the MorningSta class.

     

    13.1.1.38 On Neck

    Introduction

    Create a new On-Neck candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using OnNeck Indicator

    To create an automatic indicators for OnNeck , call the OnNeck helper method from the QCAlgorithm class. The OnNeck method creates a OnNeck object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class OnNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnNeck _onneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _onneck = OnNeck(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_onneck.IsReady)
            {
                // The current value of _onneck is represented by itself (_onneck)
                // or _onneck.Current.Value
                Plot("OnNeck", "onneck", _onneck);
                
            }
        }
    }
    class OnNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.onneck = self.OnNeck(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.onneck.IsReady:
                # The current value of self.onneck is represented by self.onneck.Current.Value
                self.Plot("OnNeck", "onneck", self.onneck.Current.Value)
                
    

    The following reference table describes the OnNeck method:

    OnNeck() 1/1

                OnNeck QuantConnect.Algorithm.CandlestickPatterns.OnNeck (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new OnNeck pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a OnNeck indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class OnNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnNeck _onneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _onneck = new OnNeck(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _onneck.Update(bar);
            }
    
            if (_onneck.IsReady)
            {
                // The current value of _onneck is represented by itself (_onneck)
                // or _onneck.Current.Value
                Plot("OnNeck", "onneck", _onneck);
                
            }
        }
    }
    class OnNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.onneck = OnNeck(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.onneck.Update(bar)
    
            if self.onneck.IsReady:
                # The current value of self.onneck is represented by self.onneck.Current.Value
                self.Plot("OnNeck", "onneck", self.onneck.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class OnNeckAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnNeck _onneck;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _onneck = new OnNeck(SPY);
            RegisterIndicator(_symbol, _onneck, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_onneck.IsReady)
            {
                // The current value of _onneck is represented by itself (_onneck)
                // or _onneck.Current.Value
                Plot("OnNeck", "onneck", _onneck);
                
            }
        }
    }
    class OnNeckAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.onneck = OnNeck(SPY)
            self.RegisterIndicator(self.symbol, self.onneck, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.onneck.IsReady:
                # The current value of self.onneck is represented by self.onneck.Current.Value
                self.Plot("OnNeck", "onneck", self.onneck.Current.Value)
                
    

    The following reference table describes the OnNeck constructor:

    OnNeck() 1/2

                OnNeck QuantConnect.Indicators.CandlestickPatterns.OnNeck (
        string  name
       )
            

    Initializes a new instance of the OnNec class using the specified name.

    OnNeck() 2/2

                OnNeck QuantConnect.Indicators.CandlestickPatterns.OnNeck (
        
       )
            

    Initializes a new instance of the OnNec class.

     

    13.1.1.39 Piercing

    Introduction

    Create a new Piercing candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Piercing Indicator

    To create an automatic indicators for Piercing , call the Piercing helper method from the QCAlgorithm class. The Piercing method creates a Piercing object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class PiercingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Piercing _piercing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _piercing = Piercing(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_piercing.IsReady)
            {
                // The current value of _piercing is represented by itself (_piercing)
                // or _piercing.Current.Value
                Plot("Piercing", "piercing", _piercing);
                
            }
        }
    }
    class PiercingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.piercing = self.Piercing(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.piercing.IsReady:
                # The current value of self.piercing is represented by self.piercing.Current.Value
                self.Plot("Piercing", "piercing", self.piercing.Current.Value)
                
    

    The following reference table describes the Piercing method:

    Piercing() 1/1

                Piercing QuantConnect.Algorithm.CandlestickPatterns.Piercing (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Piercing pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Piercing indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class PiercingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Piercing _piercing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _piercing = new Piercing(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _piercing.Update(bar);
            }
    
            if (_piercing.IsReady)
            {
                // The current value of _piercing is represented by itself (_piercing)
                // or _piercing.Current.Value
                Plot("Piercing", "piercing", _piercing);
                
            }
        }
    }
    class PiercingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.piercing = Piercing(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.piercing.Update(bar)
    
            if self.piercing.IsReady:
                # The current value of self.piercing is represented by self.piercing.Current.Value
                self.Plot("Piercing", "piercing", self.piercing.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class PiercingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Piercing _piercing;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _piercing = new Piercing(SPY);
            RegisterIndicator(_symbol, _piercing, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_piercing.IsReady)
            {
                // The current value of _piercing is represented by itself (_piercing)
                // or _piercing.Current.Value
                Plot("Piercing", "piercing", _piercing);
                
            }
        }
    }
    class PiercingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.piercing = Piercing(SPY)
            self.RegisterIndicator(self.symbol, self.piercing, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.piercing.IsReady:
                # The current value of self.piercing is represented by self.piercing.Current.Value
                self.Plot("Piercing", "piercing", self.piercing.Current.Value)
                
    

    The following reference table describes the Piercing constructor:

    Piercing() 1/2

                Piercing QuantConnect.Indicators.CandlestickPatterns.Piercing (
        string  name
       )
            

    Initializes a new instance of the Piercin class using the specified name.

    Piercing() 2/2

                Piercing QuantConnect.Indicators.CandlestickPatterns.Piercing (
        
       )
            

    Initializes a new instance of the Piercin class.

     

    13.1.1.40 Rickshaw Man

    Introduction

    Create a new Rickshaw Man candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using RickshawMan Indicator

    To create an automatic indicators for RickshawMan , call the RickshawMan helper method from the QCAlgorithm class. The RickshawMan method creates a RickshawMan object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RickshawManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RickshawMan _rickshawman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rickshawman = RickshawMan(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_rickshawman.IsReady)
            {
                // The current value of _rickshawman is represented by itself (_rickshawman)
                // or _rickshawman.Current.Value
                Plot("RickshawMan", "rickshawman", _rickshawman);
                
            }
        }
    }
    class RickshawManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rickshawman = self.RickshawMan(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.rickshawman.IsReady:
                # The current value of self.rickshawman is represented by self.rickshawman.Current.Value
                self.Plot("RickshawMan", "rickshawman", self.rickshawman.Current.Value)
                
    

    The following reference table describes the RickshawMan method:

    RickshawMan() 1/1

                RickshawMan QuantConnect.Algorithm.CandlestickPatterns.RickshawMan (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new RickshawMan pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RickshawMan indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class RickshawManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RickshawMan _rickshawman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rickshawman = new RickshawMan(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rickshawman.Update(bar);
            }
    
            if (_rickshawman.IsReady)
            {
                // The current value of _rickshawman is represented by itself (_rickshawman)
                // or _rickshawman.Current.Value
                Plot("RickshawMan", "rickshawman", _rickshawman);
                
            }
        }
    }
    class RickshawManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rickshawman = RickshawMan(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rickshawman.Update(bar)
    
            if self.rickshawman.IsReady:
                # The current value of self.rickshawman is represented by self.rickshawman.Current.Value
                self.Plot("RickshawMan", "rickshawman", self.rickshawman.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RickshawManAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RickshawMan _rickshawman;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rickshawman = new RickshawMan(SPY);
            RegisterIndicator(_symbol, _rickshawman, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rickshawman.IsReady)
            {
                // The current value of _rickshawman is represented by itself (_rickshawman)
                // or _rickshawman.Current.Value
                Plot("RickshawMan", "rickshawman", _rickshawman);
                
            }
        }
    }
    class RickshawManAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rickshawman = RickshawMan(SPY)
            self.RegisterIndicator(self.symbol, self.rickshawman, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rickshawman.IsReady:
                # The current value of self.rickshawman is represented by self.rickshawman.Current.Value
                self.Plot("RickshawMan", "rickshawman", self.rickshawman.Current.Value)
                
    

    The following reference table describes the RickshawMan constructor:

    RickshawMan() 1/2

                RickshawMan QuantConnect.Indicators.CandlestickPatterns.RickshawMan (
        string  name
       )
            

    Initializes a new instance of the RickshawMa class using the specified name.

    RickshawMan() 2/2

                RickshawMan QuantConnect.Indicators.CandlestickPatterns.RickshawMan (
        
       )
            

    Initializes a new instance of the RickshawMa class.

     

    13.1.1.41 Rise Fall Three Methods

    Introduction

    Create a new Rising/Falling Three Methods candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using RiseFallThreeMethods Indicator

    To create an automatic indicators for RiseFallThreeMethods , call the RiseFallThreeMethods helper method from the QCAlgorithm class. The RiseFallThreeMethods method creates a RiseFallThreeMethods object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RiseFallThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RiseFallThreeMethods _risefallthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _risefallthreemethods = RiseFallThreeMethods(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_risefallthreemethods.IsReady)
            {
                // The current value of _risefallthreemethods is represented by itself (_risefallthreemethods)
                // or _risefallthreemethods.Current.Value
                Plot("RiseFallThreeMethods", "risefallthreemethods", _risefallthreemethods);
                
            }
        }
    }
    class RiseFallThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.risefallthreemethods = self.RiseFallThreeMethods(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.risefallthreemethods.IsReady:
                # The current value of self.risefallthreemethods is represented by self.risefallthreemethods.Current.Value
                self.Plot("RiseFallThreeMethods", "risefallthreemethods", self.risefallthreemethods.Current.Value)
                
    

    The following reference table describes the RiseFallThreeMethods method:

    RiseFallThreeMethods() 1/1

                RiseFallThreeMethods QuantConnect.Algorithm.CandlestickPatterns.RiseFallThreeMethods (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new RiseFallThreeMethods pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RiseFallThreeMethods indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class RiseFallThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RiseFallThreeMethods _risefallthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _risefallthreemethods = new RiseFallThreeMethods(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _risefallthreemethods.Update(bar);
            }
    
            if (_risefallthreemethods.IsReady)
            {
                // The current value of _risefallthreemethods is represented by itself (_risefallthreemethods)
                // or _risefallthreemethods.Current.Value
                Plot("RiseFallThreeMethods", "risefallthreemethods", _risefallthreemethods);
                
            }
        }
    }
    class RiseFallThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.risefallthreemethods = RiseFallThreeMethods(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.risefallthreemethods.Update(bar)
    
            if self.risefallthreemethods.IsReady:
                # The current value of self.risefallthreemethods is represented by self.risefallthreemethods.Current.Value
                self.Plot("RiseFallThreeMethods", "risefallthreemethods", self.risefallthreemethods.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RiseFallThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RiseFallThreeMethods _risefallthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _risefallthreemethods = new RiseFallThreeMethods(SPY);
            RegisterIndicator(_symbol, _risefallthreemethods, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_risefallthreemethods.IsReady)
            {
                // The current value of _risefallthreemethods is represented by itself (_risefallthreemethods)
                // or _risefallthreemethods.Current.Value
                Plot("RiseFallThreeMethods", "risefallthreemethods", _risefallthreemethods);
                
            }
        }
    }
    class RiseFallThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.risefallthreemethods = RiseFallThreeMethods(SPY)
            self.RegisterIndicator(self.symbol, self.risefallthreemethods, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.risefallthreemethods.IsReady:
                # The current value of self.risefallthreemethods is represented by self.risefallthreemethods.Current.Value
                self.Plot("RiseFallThreeMethods", "risefallthreemethods", self.risefallthreemethods.Current.Value)
                
    

    The following reference table describes the RiseFallThreeMethods constructor:

    RiseFallThreeMethods() 1/2

                RiseFallThreeMethods QuantConnect.Indicators.CandlestickPatterns.RiseFallThreeMethods (
        string  name
       )
            

    Initializes a new instance of the RiseFallThreeMethod class using the specified name.

    RiseFallThreeMethods() 2/2

                RiseFallThreeMethods QuantConnect.Indicators.CandlestickPatterns.RiseFallThreeMethods (
        
       )
            

    Initializes a new instance of the RiseFallThreeMethod class.

     

    13.1.1.42 Separating Lines

    Introduction

    Create a new Separating Lines candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using SeparatingLines Indicator

    To create an automatic indicators for SeparatingLines , call the SeparatingLines helper method from the QCAlgorithm class. The SeparatingLines method creates a SeparatingLines object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SeparatingLinesAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SeparatingLines _separatinglines;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _separatinglines = SeparatingLines(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_separatinglines.IsReady)
            {
                // The current value of _separatinglines is represented by itself (_separatinglines)
                // or _separatinglines.Current.Value
                Plot("SeparatingLines", "separatinglines", _separatinglines);
                
            }
        }
    }
    class SeparatingLinesAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.separatinglines = self.SeparatingLines(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.separatinglines.IsReady:
                # The current value of self.separatinglines is represented by self.separatinglines.Current.Value
                self.Plot("SeparatingLines", "separatinglines", self.separatinglines.Current.Value)
                
    

    The following reference table describes the SeparatingLines method:

    SeparatingLines() 1/1

                SeparatingLines QuantConnect.Algorithm.CandlestickPatterns.SeparatingLines (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new SeparatingLines pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SeparatingLines indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class SeparatingLinesAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SeparatingLines _separatinglines;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _separatinglines = new SeparatingLines(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _separatinglines.Update(bar);
            }
    
            if (_separatinglines.IsReady)
            {
                // The current value of _separatinglines is represented by itself (_separatinglines)
                // or _separatinglines.Current.Value
                Plot("SeparatingLines", "separatinglines", _separatinglines);
                
            }
        }
    }
    class SeparatingLinesAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.separatinglines = SeparatingLines(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.separatinglines.Update(bar)
    
            if self.separatinglines.IsReady:
                # The current value of self.separatinglines is represented by self.separatinglines.Current.Value
                self.Plot("SeparatingLines", "separatinglines", self.separatinglines.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SeparatingLinesAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SeparatingLines _separatinglines;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _separatinglines = new SeparatingLines(SPY);
            RegisterIndicator(_symbol, _separatinglines, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_separatinglines.IsReady)
            {
                // The current value of _separatinglines is represented by itself (_separatinglines)
                // or _separatinglines.Current.Value
                Plot("SeparatingLines", "separatinglines", _separatinglines);
                
            }
        }
    }
    class SeparatingLinesAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.separatinglines = SeparatingLines(SPY)
            self.RegisterIndicator(self.symbol, self.separatinglines, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.separatinglines.IsReady:
                # The current value of self.separatinglines is represented by self.separatinglines.Current.Value
                self.Plot("SeparatingLines", "separatinglines", self.separatinglines.Current.Value)
                
    

    The following reference table describes the SeparatingLines constructor:

    SeparatingLines() 1/2

                SeparatingLines QuantConnect.Indicators.CandlestickPatterns.SeparatingLines (
        string  name
       )
            

    Initializes a new instance of the SeparatingLine class using the specified name.

    SeparatingLines() 2/2

                SeparatingLines QuantConnect.Indicators.CandlestickPatterns.SeparatingLines (
        
       )
            

    Initializes a new instance of the SeparatingLine class.

     

    13.1.1.43 Shooting Star

    Introduction

    Create a new Shooting Star candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ShootingStar Indicator

    To create an automatic indicators for ShootingStar , call the ShootingStar helper method from the QCAlgorithm class. The ShootingStar method creates a ShootingStar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ShootingStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShootingStar _shootingstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shootingstar = ShootingStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_shootingstar.IsReady)
            {
                // The current value of _shootingstar is represented by itself (_shootingstar)
                // or _shootingstar.Current.Value
                Plot("ShootingStar", "shootingstar", _shootingstar);
                
            }
        }
    }
    class ShootingStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shootingstar = self.ShootingStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.shootingstar.IsReady:
                # The current value of self.shootingstar is represented by self.shootingstar.Current.Value
                self.Plot("ShootingStar", "shootingstar", self.shootingstar.Current.Value)
                
    

    The following reference table describes the ShootingStar method:

    ShootingStar() 1/1

                ShootingStar QuantConnect.Algorithm.CandlestickPatterns.ShootingStar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ShootingStar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ShootingStar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ShootingStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShootingStar _shootingstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shootingstar = new ShootingStar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _shootingstar.Update(bar);
            }
    
            if (_shootingstar.IsReady)
            {
                // The current value of _shootingstar is represented by itself (_shootingstar)
                // or _shootingstar.Current.Value
                Plot("ShootingStar", "shootingstar", _shootingstar);
                
            }
        }
    }
    class ShootingStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shootingstar = ShootingStar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.shootingstar.Update(bar)
    
            if self.shootingstar.IsReady:
                # The current value of self.shootingstar is represented by self.shootingstar.Current.Value
                self.Plot("ShootingStar", "shootingstar", self.shootingstar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ShootingStarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShootingStar _shootingstar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shootingstar = new ShootingStar(SPY);
            RegisterIndicator(_symbol, _shootingstar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_shootingstar.IsReady)
            {
                // The current value of _shootingstar is represented by itself (_shootingstar)
                // or _shootingstar.Current.Value
                Plot("ShootingStar", "shootingstar", _shootingstar);
                
            }
        }
    }
    class ShootingStarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shootingstar = ShootingStar(SPY)
            self.RegisterIndicator(self.symbol, self.shootingstar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.shootingstar.IsReady:
                # The current value of self.shootingstar is represented by self.shootingstar.Current.Value
                self.Plot("ShootingStar", "shootingstar", self.shootingstar.Current.Value)
                
    

    The following reference table describes the ShootingStar constructor:

    ShootingStar() 1/2

                ShootingStar QuantConnect.Indicators.CandlestickPatterns.ShootingStar (
        string  name
       )
            

    Initializes a new instance of the ShootingSta class using the specified name.

    ShootingStar() 2/2

                ShootingStar QuantConnect.Indicators.CandlestickPatterns.ShootingStar (
        
       )
            

    Initializes a new instance of the ShootingSta class.

     

    13.1.1.44 Short Line Candle

    Introduction

    Create a new Short Line Candle candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ShortLineCandle Indicator

    To create an automatic indicators for ShortLineCandle , call the ShortLineCandle helper method from the QCAlgorithm class. The ShortLineCandle method creates a ShortLineCandle object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ShortLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShortLineCandle _shortlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shortlinecandle = ShortLineCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_shortlinecandle.IsReady)
            {
                // The current value of _shortlinecandle is represented by itself (_shortlinecandle)
                // or _shortlinecandle.Current.Value
                Plot("ShortLineCandle", "shortlinecandle", _shortlinecandle);
                
            }
        }
    }
    class ShortLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shortlinecandle = self.ShortLineCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.shortlinecandle.IsReady:
                # The current value of self.shortlinecandle is represented by self.shortlinecandle.Current.Value
                self.Plot("ShortLineCandle", "shortlinecandle", self.shortlinecandle.Current.Value)
                
    

    The following reference table describes the ShortLineCandle method:

    ShortLineCandle() 1/1

                ShortLineCandle QuantConnect.Algorithm.CandlestickPatterns.ShortLineCandle (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ShortLineCandle pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ShortLineCandle indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ShortLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShortLineCandle _shortlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shortlinecandle = new ShortLineCandle(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _shortlinecandle.Update(bar);
            }
    
            if (_shortlinecandle.IsReady)
            {
                // The current value of _shortlinecandle is represented by itself (_shortlinecandle)
                // or _shortlinecandle.Current.Value
                Plot("ShortLineCandle", "shortlinecandle", _shortlinecandle);
                
            }
        }
    }
    class ShortLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shortlinecandle = ShortLineCandle(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.shortlinecandle.Update(bar)
    
            if self.shortlinecandle.IsReady:
                # The current value of self.shortlinecandle is represented by self.shortlinecandle.Current.Value
                self.Plot("ShortLineCandle", "shortlinecandle", self.shortlinecandle.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ShortLineCandleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ShortLineCandle _shortlinecandle;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _shortlinecandle = new ShortLineCandle(SPY);
            RegisterIndicator(_symbol, _shortlinecandle, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_shortlinecandle.IsReady)
            {
                // The current value of _shortlinecandle is represented by itself (_shortlinecandle)
                // or _shortlinecandle.Current.Value
                Plot("ShortLineCandle", "shortlinecandle", _shortlinecandle);
                
            }
        }
    }
    class ShortLineCandleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.shortlinecandle = ShortLineCandle(SPY)
            self.RegisterIndicator(self.symbol, self.shortlinecandle, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.shortlinecandle.IsReady:
                # The current value of self.shortlinecandle is represented by self.shortlinecandle.Current.Value
                self.Plot("ShortLineCandle", "shortlinecandle", self.shortlinecandle.Current.Value)
                
    

    The following reference table describes the ShortLineCandle constructor:

    ShortLineCandle() 1/2

                ShortLineCandle QuantConnect.Indicators.CandlestickPatterns.ShortLineCandle (
        string  name
       )
            

    Initializes a new instance of the ShortLineCandl class using the specified name.

    ShortLineCandle() 2/2

                ShortLineCandle QuantConnect.Indicators.CandlestickPatterns.ShortLineCandle (
        
       )
            

    Initializes a new instance of the ShortLineCandl class.

     

    13.1.1.45 Spinning Top

    Introduction

    Create a new Spinning Top candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using SpinningTop Indicator

    To create an automatic indicators for SpinningTop , call the SpinningTop helper method from the QCAlgorithm class. The SpinningTop method creates a SpinningTop object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SpinningTopAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SpinningTop _spinningtop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _spinningtop = SpinningTop(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_spinningtop.IsReady)
            {
                // The current value of _spinningtop is represented by itself (_spinningtop)
                // or _spinningtop.Current.Value
                Plot("SpinningTop", "spinningtop", _spinningtop);
                
            }
        }
    }
    class SpinningTopAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.spinningtop = self.SpinningTop(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.spinningtop.IsReady:
                # The current value of self.spinningtop is represented by self.spinningtop.Current.Value
                self.Plot("SpinningTop", "spinningtop", self.spinningtop.Current.Value)
                
    

    The following reference table describes the SpinningTop method:

    SpinningTop() 1/1

                SpinningTop QuantConnect.Algorithm.CandlestickPatterns.SpinningTop (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new SpinningTop pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SpinningTop indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class SpinningTopAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SpinningTop _spinningtop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _spinningtop = new SpinningTop(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _spinningtop.Update(bar);
            }
    
            if (_spinningtop.IsReady)
            {
                // The current value of _spinningtop is represented by itself (_spinningtop)
                // or _spinningtop.Current.Value
                Plot("SpinningTop", "spinningtop", _spinningtop);
                
            }
        }
    }
    class SpinningTopAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.spinningtop = SpinningTop(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.spinningtop.Update(bar)
    
            if self.spinningtop.IsReady:
                # The current value of self.spinningtop is represented by self.spinningtop.Current.Value
                self.Plot("SpinningTop", "spinningtop", self.spinningtop.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SpinningTopAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SpinningTop _spinningtop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _spinningtop = new SpinningTop(SPY);
            RegisterIndicator(_symbol, _spinningtop, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_spinningtop.IsReady)
            {
                // The current value of _spinningtop is represented by itself (_spinningtop)
                // or _spinningtop.Current.Value
                Plot("SpinningTop", "spinningtop", _spinningtop);
                
            }
        }
    }
    class SpinningTopAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.spinningtop = SpinningTop(SPY)
            self.RegisterIndicator(self.symbol, self.spinningtop, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.spinningtop.IsReady:
                # The current value of self.spinningtop is represented by self.spinningtop.Current.Value
                self.Plot("SpinningTop", "spinningtop", self.spinningtop.Current.Value)
                
    

    The following reference table describes the SpinningTop constructor:

    SpinningTop() 1/2

                SpinningTop QuantConnect.Indicators.CandlestickPatterns.SpinningTop (
        string  name
       )
            

    Initializes a new instance of the SpinningTo class using the specified name.

    SpinningTop() 2/2

                SpinningTop QuantConnect.Indicators.CandlestickPatterns.SpinningTop (
        
       )
            

    Initializes a new instance of the SpinningTo class.

     

    13.1.1.46 Stalled Pattern

    Introduction

    Create a new Stalled Pattern candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using StalledPattern Indicator

    To create an automatic indicators for StalledPattern , call the StalledPattern helper method from the QCAlgorithm class. The StalledPattern method creates a StalledPattern object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class StalledPatternAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StalledPattern _stalledpattern;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stalledpattern = StalledPattern(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_stalledpattern.IsReady)
            {
                // The current value of _stalledpattern is represented by itself (_stalledpattern)
                // or _stalledpattern.Current.Value
                Plot("StalledPattern", "stalledpattern", _stalledpattern);
                
            }
        }
    }
    class StalledPatternAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stalledpattern = self.StalledPattern(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.stalledpattern.IsReady:
                # The current value of self.stalledpattern is represented by self.stalledpattern.Current.Value
                self.Plot("StalledPattern", "stalledpattern", self.stalledpattern.Current.Value)
                
    

    The following reference table describes the StalledPattern method:

    StalledPattern() 1/1

                StalledPattern QuantConnect.Algorithm.CandlestickPatterns.StalledPattern (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new StalledPattern pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a StalledPattern indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class StalledPatternAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StalledPattern _stalledpattern;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stalledpattern = new StalledPattern(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _stalledpattern.Update(bar);
            }
    
            if (_stalledpattern.IsReady)
            {
                // The current value of _stalledpattern is represented by itself (_stalledpattern)
                // or _stalledpattern.Current.Value
                Plot("StalledPattern", "stalledpattern", _stalledpattern);
                
            }
        }
    }
    class StalledPatternAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stalledpattern = StalledPattern(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.stalledpattern.Update(bar)
    
            if self.stalledpattern.IsReady:
                # The current value of self.stalledpattern is represented by self.stalledpattern.Current.Value
                self.Plot("StalledPattern", "stalledpattern", self.stalledpattern.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class StalledPatternAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StalledPattern _stalledpattern;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stalledpattern = new StalledPattern(SPY);
            RegisterIndicator(_symbol, _stalledpattern, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_stalledpattern.IsReady)
            {
                // The current value of _stalledpattern is represented by itself (_stalledpattern)
                // or _stalledpattern.Current.Value
                Plot("StalledPattern", "stalledpattern", _stalledpattern);
                
            }
        }
    }
    class StalledPatternAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stalledpattern = StalledPattern(SPY)
            self.RegisterIndicator(self.symbol, self.stalledpattern, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.stalledpattern.IsReady:
                # The current value of self.stalledpattern is represented by self.stalledpattern.Current.Value
                self.Plot("StalledPattern", "stalledpattern", self.stalledpattern.Current.Value)
                
    

    The following reference table describes the StalledPattern constructor:

    StalledPattern() 1/2

                StalledPattern QuantConnect.Indicators.CandlestickPatterns.StalledPattern (
        string  name
       )
            

    Initializes a new instance of the StalledPatter class using the specified name.

    StalledPattern() 2/2

                StalledPattern QuantConnect.Indicators.CandlestickPatterns.StalledPattern (
        
       )
            

    Initializes a new instance of the StalledPatter class.

     

    13.1.1.47 Stick Sandwich

    Introduction

    Create a new Stick Sandwich candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using StickSandwich Indicator

    To create an automatic indicators for StickSandwich , call the StickSandwich helper method from the QCAlgorithm class. The StickSandwich method creates a StickSandwich object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class StickSandwichAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StickSandwich _sticksandwich;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sticksandwich = StickSandwich(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_sticksandwich.IsReady)
            {
                // The current value of _sticksandwich is represented by itself (_sticksandwich)
                // or _sticksandwich.Current.Value
                Plot("StickSandwich", "sticksandwich", _sticksandwich);
                
            }
        }
    }
    class StickSandwichAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sticksandwich = self.StickSandwich(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.sticksandwich.IsReady:
                # The current value of self.sticksandwich is represented by self.sticksandwich.Current.Value
                self.Plot("StickSandwich", "sticksandwich", self.sticksandwich.Current.Value)
                
    

    The following reference table describes the StickSandwich method:

    StickSandwich() 1/1

                StickSandwich QuantConnect.Algorithm.CandlestickPatterns.StickSandwich (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new StickSandwich pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a StickSandwich indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class StickSandwichAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StickSandwich _sticksandwich;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sticksandwich = new StickSandwich(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sticksandwich.Update(bar);
            }
    
            if (_sticksandwich.IsReady)
            {
                // The current value of _sticksandwich is represented by itself (_sticksandwich)
                // or _sticksandwich.Current.Value
                Plot("StickSandwich", "sticksandwich", _sticksandwich);
                
            }
        }
    }
    class StickSandwichAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sticksandwich = StickSandwich(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sticksandwich.Update(bar)
    
            if self.sticksandwich.IsReady:
                # The current value of self.sticksandwich is represented by self.sticksandwich.Current.Value
                self.Plot("StickSandwich", "sticksandwich", self.sticksandwich.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class StickSandwichAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StickSandwich _sticksandwich;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sticksandwich = new StickSandwich(SPY);
            RegisterIndicator(_symbol, _sticksandwich, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sticksandwich.IsReady)
            {
                // The current value of _sticksandwich is represented by itself (_sticksandwich)
                // or _sticksandwich.Current.Value
                Plot("StickSandwich", "sticksandwich", _sticksandwich);
                
            }
        }
    }
    class StickSandwichAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sticksandwich = StickSandwich(SPY)
            self.RegisterIndicator(self.symbol, self.sticksandwich, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sticksandwich.IsReady:
                # The current value of self.sticksandwich is represented by self.sticksandwich.Current.Value
                self.Plot("StickSandwich", "sticksandwich", self.sticksandwich.Current.Value)
                
    

    The following reference table describes the StickSandwich constructor:

    StickSandwich() 1/2

                StickSandwich QuantConnect.Indicators.CandlestickPatterns.StickSandwich (
        string  name
       )
            

    Initializes a new instance of the StickSandwic class using the specified name.

    StickSandwich() 2/2

                StickSandwich QuantConnect.Indicators.CandlestickPatterns.StickSandwich (
        
       )
            

    Initializes a new instance of the StickSandwic class.

     

    13.1.1.48 Takuri

    Introduction

    Create a new Takuri (Dragonfly Doji with very long lower shadow) candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Takuri Indicator

    To create an automatic indicators for Takuri , call the Takuri helper method from the QCAlgorithm class. The Takuri method creates a Takuri object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TakuriAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Takuri _takuri;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _takuri = Takuri(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_takuri.IsReady)
            {
                // The current value of _takuri is represented by itself (_takuri)
                // or _takuri.Current.Value
                Plot("Takuri", "takuri", _takuri);
                
            }
        }
    }
    class TakuriAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.takuri = self.Takuri(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.takuri.IsReady:
                # The current value of self.takuri is represented by self.takuri.Current.Value
                self.Plot("Takuri", "takuri", self.takuri.Current.Value)
                
    

    The following reference table describes the Takuri method:

    Takuri() 1/1

                Takuri QuantConnect.Algorithm.CandlestickPatterns.Takuri (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Takuri pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Takuri indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class TakuriAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Takuri _takuri;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _takuri = new Takuri(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _takuri.Update(bar);
            }
    
            if (_takuri.IsReady)
            {
                // The current value of _takuri is represented by itself (_takuri)
                // or _takuri.Current.Value
                Plot("Takuri", "takuri", _takuri);
                
            }
        }
    }
    class TakuriAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.takuri = Takuri(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.takuri.Update(bar)
    
            if self.takuri.IsReady:
                # The current value of self.takuri is represented by self.takuri.Current.Value
                self.Plot("Takuri", "takuri", self.takuri.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TakuriAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Takuri _takuri;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _takuri = new Takuri(SPY);
            RegisterIndicator(_symbol, _takuri, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_takuri.IsReady)
            {
                // The current value of _takuri is represented by itself (_takuri)
                // or _takuri.Current.Value
                Plot("Takuri", "takuri", _takuri);
                
            }
        }
    }
    class TakuriAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.takuri = Takuri(SPY)
            self.RegisterIndicator(self.symbol, self.takuri, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.takuri.IsReady:
                # The current value of self.takuri is represented by self.takuri.Current.Value
                self.Plot("Takuri", "takuri", self.takuri.Current.Value)
                
    

    The following reference table describes the Takuri constructor:

    Takuri() 1/2

                Takuri QuantConnect.Indicators.CandlestickPatterns.Takuri (
        string  name
       )
            

    Initializes a new instance of the Takur class using the specified name.

    Takuri() 2/2

                Takuri QuantConnect.Indicators.CandlestickPatterns.Takuri (
        
       )
            

    Initializes a new instance of the Takur class.

     

    13.1.1.49 Tasuki Gap

    Introduction

    Create a new Tasuki Gap candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using TasukiGap Indicator

    To create an automatic indicators for TasukiGap , call the TasukiGap helper method from the QCAlgorithm class. The TasukiGap method creates a TasukiGap object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TasukiGapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TasukiGap _tasukigap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tasukigap = TasukiGap(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_tasukigap.IsReady)
            {
                // The current value of _tasukigap is represented by itself (_tasukigap)
                // or _tasukigap.Current.Value
                Plot("TasukiGap", "tasukigap", _tasukigap);
                
            }
        }
    }
    class TasukiGapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tasukigap = self.TasukiGap(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.tasukigap.IsReady:
                # The current value of self.tasukigap is represented by self.tasukigap.Current.Value
                self.Plot("TasukiGap", "tasukigap", self.tasukigap.Current.Value)
                
    

    The following reference table describes the TasukiGap method:

    TasukiGap() 1/1

                TasukiGap QuantConnect.Algorithm.CandlestickPatterns.TasukiGap (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new TasukiGap pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TasukiGap indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class TasukiGapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TasukiGap _tasukigap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tasukigap = new TasukiGap(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tasukigap.Update(bar);
            }
    
            if (_tasukigap.IsReady)
            {
                // The current value of _tasukigap is represented by itself (_tasukigap)
                // or _tasukigap.Current.Value
                Plot("TasukiGap", "tasukigap", _tasukigap);
                
            }
        }
    }
    class TasukiGapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tasukigap = TasukiGap(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tasukigap.Update(bar)
    
            if self.tasukigap.IsReady:
                # The current value of self.tasukigap is represented by self.tasukigap.Current.Value
                self.Plot("TasukiGap", "tasukigap", self.tasukigap.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TasukiGapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TasukiGap _tasukigap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tasukigap = new TasukiGap(SPY);
            RegisterIndicator(_symbol, _tasukigap, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tasukigap.IsReady)
            {
                // The current value of _tasukigap is represented by itself (_tasukigap)
                // or _tasukigap.Current.Value
                Plot("TasukiGap", "tasukigap", _tasukigap);
                
            }
        }
    }
    class TasukiGapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tasukigap = TasukiGap(SPY)
            self.RegisterIndicator(self.symbol, self.tasukigap, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tasukigap.IsReady:
                # The current value of self.tasukigap is represented by self.tasukigap.Current.Value
                self.Plot("TasukiGap", "tasukigap", self.tasukigap.Current.Value)
                
    

    The following reference table describes the TasukiGap constructor:

    TasukiGap() 1/2

                TasukiGap QuantConnect.Indicators.CandlestickPatterns.TasukiGap (
        string  name
       )
            

    Initializes a new instance of the TasukiGa class using the specified name.

    TasukiGap() 2/2

                TasukiGap QuantConnect.Indicators.CandlestickPatterns.TasukiGap (
        
       )
            

    Initializes a new instance of the TasukiGa class.

     

    13.1.1.50 Three Black Crows

    Introduction

    Create a new Three Black Crows candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeBlackCrows Indicator

    To create an automatic indicators for ThreeBlackCrows , call the ThreeBlackCrows helper method from the QCAlgorithm class. The ThreeBlackCrows method creates a ThreeBlackCrows object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeBlackCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeBlackCrows _threeblackcrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeblackcrows = ThreeBlackCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeblackcrows.IsReady)
            {
                // The current value of _threeblackcrows is represented by itself (_threeblackcrows)
                // or _threeblackcrows.Current.Value
                Plot("ThreeBlackCrows", "threeblackcrows", _threeblackcrows);
                
            }
        }
    }
    class ThreeBlackCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeblackcrows = self.ThreeBlackCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeblackcrows.IsReady:
                # The current value of self.threeblackcrows is represented by self.threeblackcrows.Current.Value
                self.Plot("ThreeBlackCrows", "threeblackcrows", self.threeblackcrows.Current.Value)
                
    

    The following reference table describes the ThreeBlackCrows method:

    ThreeBlackCrows() 1/1

                ThreeBlackCrows QuantConnect.Algorithm.CandlestickPatterns.ThreeBlackCrows (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeBlackCrows pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeBlackCrows indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeBlackCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeBlackCrows _threeblackcrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeblackcrows = new ThreeBlackCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threeblackcrows.Update(bar);
            }
    
            if (_threeblackcrows.IsReady)
            {
                // The current value of _threeblackcrows is represented by itself (_threeblackcrows)
                // or _threeblackcrows.Current.Value
                Plot("ThreeBlackCrows", "threeblackcrows", _threeblackcrows);
                
            }
        }
    }
    class ThreeBlackCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeblackcrows = ThreeBlackCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threeblackcrows.Update(bar)
    
            if self.threeblackcrows.IsReady:
                # The current value of self.threeblackcrows is represented by self.threeblackcrows.Current.Value
                self.Plot("ThreeBlackCrows", "threeblackcrows", self.threeblackcrows.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeBlackCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeBlackCrows _threeblackcrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeblackcrows = new ThreeBlackCrows(SPY);
            RegisterIndicator(_symbol, _threeblackcrows, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeblackcrows.IsReady)
            {
                // The current value of _threeblackcrows is represented by itself (_threeblackcrows)
                // or _threeblackcrows.Current.Value
                Plot("ThreeBlackCrows", "threeblackcrows", _threeblackcrows);
                
            }
        }
    }
    class ThreeBlackCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeblackcrows = ThreeBlackCrows(SPY)
            self.RegisterIndicator(self.symbol, self.threeblackcrows, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeblackcrows.IsReady:
                # The current value of self.threeblackcrows is represented by self.threeblackcrows.Current.Value
                self.Plot("ThreeBlackCrows", "threeblackcrows", self.threeblackcrows.Current.Value)
                
    

    The following reference table describes the ThreeBlackCrows constructor:

    ThreeBlackCrows() 1/2

                ThreeBlackCrows QuantConnect.Indicators.CandlestickPatterns.ThreeBlackCrows (
        string  name
       )
            

    Initializes a new instance of the ThreeBlackCrow class using the specified name.

    ThreeBlackCrows() 2/2

                ThreeBlackCrows QuantConnect.Indicators.CandlestickPatterns.ThreeBlackCrows (
        
       )
            

    Initializes a new instance of the ThreeBlackCrow class.

     

    13.1.1.51 Three Inside

    Introduction

    Create a new Three Inside Up/Down candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeInside Indicator

    To create an automatic indicators for ThreeInside , call the ThreeInside helper method from the QCAlgorithm class. The ThreeInside method creates a ThreeInside object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeInsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeInside _threeinside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeinside = ThreeInside(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeinside.IsReady)
            {
                // The current value of _threeinside is represented by itself (_threeinside)
                // or _threeinside.Current.Value
                Plot("ThreeInside", "threeinside", _threeinside);
                
            }
        }
    }
    class ThreeInsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeinside = self.ThreeInside(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeinside.IsReady:
                # The current value of self.threeinside is represented by self.threeinside.Current.Value
                self.Plot("ThreeInside", "threeinside", self.threeinside.Current.Value)
                
    

    The following reference table describes the ThreeInside method:

    ThreeInside() 1/1

                ThreeInside QuantConnect.Algorithm.CandlestickPatterns.ThreeInside (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeInside pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeInside indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeInsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeInside _threeinside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeinside = new ThreeInside(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threeinside.Update(bar);
            }
    
            if (_threeinside.IsReady)
            {
                // The current value of _threeinside is represented by itself (_threeinside)
                // or _threeinside.Current.Value
                Plot("ThreeInside", "threeinside", _threeinside);
                
            }
        }
    }
    class ThreeInsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeinside = ThreeInside(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threeinside.Update(bar)
    
            if self.threeinside.IsReady:
                # The current value of self.threeinside is represented by self.threeinside.Current.Value
                self.Plot("ThreeInside", "threeinside", self.threeinside.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeInsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeInside _threeinside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeinside = new ThreeInside(SPY);
            RegisterIndicator(_symbol, _threeinside, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeinside.IsReady)
            {
                // The current value of _threeinside is represented by itself (_threeinside)
                // or _threeinside.Current.Value
                Plot("ThreeInside", "threeinside", _threeinside);
                
            }
        }
    }
    class ThreeInsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeinside = ThreeInside(SPY)
            self.RegisterIndicator(self.symbol, self.threeinside, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeinside.IsReady:
                # The current value of self.threeinside is represented by self.threeinside.Current.Value
                self.Plot("ThreeInside", "threeinside", self.threeinside.Current.Value)
                
    

    The following reference table describes the ThreeInside constructor:

    ThreeInside() 1/2

                ThreeInside QuantConnect.Indicators.CandlestickPatterns.ThreeInside (
        string  name
       )
            

    Initializes a new instance of the ThreeInsid class using the specified name.

    ThreeInside() 2/2

                ThreeInside QuantConnect.Indicators.CandlestickPatterns.ThreeInside (
        
       )
            

    Initializes a new instance of the ThreeInsid class.

     

    13.1.1.52 Three Line Strike

    Introduction

    Create a new Three Line Strike candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeLineStrike Indicator

    To create an automatic indicators for ThreeLineStrike , call the ThreeLineStrike helper method from the QCAlgorithm class. The ThreeLineStrike method creates a ThreeLineStrike object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeLineStrikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeLineStrike _threelinestrike;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threelinestrike = ThreeLineStrike(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threelinestrike.IsReady)
            {
                // The current value of _threelinestrike is represented by itself (_threelinestrike)
                // or _threelinestrike.Current.Value
                Plot("ThreeLineStrike", "threelinestrike", _threelinestrike);
                
            }
        }
    }
    class ThreeLineStrikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threelinestrike = self.ThreeLineStrike(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threelinestrike.IsReady:
                # The current value of self.threelinestrike is represented by self.threelinestrike.Current.Value
                self.Plot("ThreeLineStrike", "threelinestrike", self.threelinestrike.Current.Value)
                
    

    The following reference table describes the ThreeLineStrike method:

    ThreeLineStrike() 1/1

                ThreeLineStrike QuantConnect.Algorithm.CandlestickPatterns.ThreeLineStrike (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeLineStrike pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeLineStrike indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeLineStrikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeLineStrike _threelinestrike;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threelinestrike = new ThreeLineStrike(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threelinestrike.Update(bar);
            }
    
            if (_threelinestrike.IsReady)
            {
                // The current value of _threelinestrike is represented by itself (_threelinestrike)
                // or _threelinestrike.Current.Value
                Plot("ThreeLineStrike", "threelinestrike", _threelinestrike);
                
            }
        }
    }
    class ThreeLineStrikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threelinestrike = ThreeLineStrike(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threelinestrike.Update(bar)
    
            if self.threelinestrike.IsReady:
                # The current value of self.threelinestrike is represented by self.threelinestrike.Current.Value
                self.Plot("ThreeLineStrike", "threelinestrike", self.threelinestrike.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeLineStrikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeLineStrike _threelinestrike;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threelinestrike = new ThreeLineStrike(SPY);
            RegisterIndicator(_symbol, _threelinestrike, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threelinestrike.IsReady)
            {
                // The current value of _threelinestrike is represented by itself (_threelinestrike)
                // or _threelinestrike.Current.Value
                Plot("ThreeLineStrike", "threelinestrike", _threelinestrike);
                
            }
        }
    }
    class ThreeLineStrikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threelinestrike = ThreeLineStrike(SPY)
            self.RegisterIndicator(self.symbol, self.threelinestrike, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threelinestrike.IsReady:
                # The current value of self.threelinestrike is represented by self.threelinestrike.Current.Value
                self.Plot("ThreeLineStrike", "threelinestrike", self.threelinestrike.Current.Value)
                
    

    The following reference table describes the ThreeLineStrike constructor:

    ThreeLineStrike() 1/2

                ThreeLineStrike QuantConnect.Indicators.CandlestickPatterns.ThreeLineStrike (
        string  name
       )
            

    Initializes a new instance of the ThreeLineStrik class using the specified name.

    ThreeLineStrike() 2/2

                ThreeLineStrike QuantConnect.Indicators.CandlestickPatterns.ThreeLineStrike (
        
       )
            

    Initializes a new instance of the ThreeLineStrik class.

     

    13.1.1.53 Three Outside

    Introduction

    Create a new Three Outside Up/Down candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeOutside Indicator

    To create an automatic indicators for ThreeOutside , call the ThreeOutside helper method from the QCAlgorithm class. The ThreeOutside method creates a ThreeOutside object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeOutsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeOutside _threeoutside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeoutside = ThreeOutside(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeoutside.IsReady)
            {
                // The current value of _threeoutside is represented by itself (_threeoutside)
                // or _threeoutside.Current.Value
                Plot("ThreeOutside", "threeoutside", _threeoutside);
                
            }
        }
    }
    class ThreeOutsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeoutside = self.ThreeOutside(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeoutside.IsReady:
                # The current value of self.threeoutside is represented by self.threeoutside.Current.Value
                self.Plot("ThreeOutside", "threeoutside", self.threeoutside.Current.Value)
                
    

    The following reference table describes the ThreeOutside method:

    ThreeOutside() 1/1

                ThreeOutside QuantConnect.Algorithm.CandlestickPatterns.ThreeOutside (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeOutside pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeOutside indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeOutsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeOutside _threeoutside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeoutside = new ThreeOutside(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threeoutside.Update(bar);
            }
    
            if (_threeoutside.IsReady)
            {
                // The current value of _threeoutside is represented by itself (_threeoutside)
                // or _threeoutside.Current.Value
                Plot("ThreeOutside", "threeoutside", _threeoutside);
                
            }
        }
    }
    class ThreeOutsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeoutside = ThreeOutside(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threeoutside.Update(bar)
    
            if self.threeoutside.IsReady:
                # The current value of self.threeoutside is represented by self.threeoutside.Current.Value
                self.Plot("ThreeOutside", "threeoutside", self.threeoutside.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeOutsideAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeOutside _threeoutside;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threeoutside = new ThreeOutside(SPY);
            RegisterIndicator(_symbol, _threeoutside, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threeoutside.IsReady)
            {
                // The current value of _threeoutside is represented by itself (_threeoutside)
                // or _threeoutside.Current.Value
                Plot("ThreeOutside", "threeoutside", _threeoutside);
                
            }
        }
    }
    class ThreeOutsideAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threeoutside = ThreeOutside(SPY)
            self.RegisterIndicator(self.symbol, self.threeoutside, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threeoutside.IsReady:
                # The current value of self.threeoutside is represented by self.threeoutside.Current.Value
                self.Plot("ThreeOutside", "threeoutside", self.threeoutside.Current.Value)
                
    

    The following reference table describes the ThreeOutside constructor:

    ThreeOutside() 1/2

                ThreeOutside QuantConnect.Indicators.CandlestickPatterns.ThreeOutside (
        string  name
       )
            

    Initializes a new instance of the ThreeOutsid class using the specified name.

    ThreeOutside() 2/2

                ThreeOutside QuantConnect.Indicators.CandlestickPatterns.ThreeOutside (
        
       )
            

    Initializes a new instance of the ThreeOutsid class.

     

    13.1.1.54 Three Stars In South

    Introduction

    Create a new Three Stars In The South candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeStarsInSouth Indicator

    To create an automatic indicators for ThreeStarsInSouth , call the ThreeStarsInSouth helper method from the QCAlgorithm class. The ThreeStarsInSouth method creates a ThreeStarsInSouth object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeStarsInSouthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeStarsInSouth _threestarsinsouth;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threestarsinsouth = ThreeStarsInSouth(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threestarsinsouth.IsReady)
            {
                // The current value of _threestarsinsouth is represented by itself (_threestarsinsouth)
                // or _threestarsinsouth.Current.Value
                Plot("ThreeStarsInSouth", "threestarsinsouth", _threestarsinsouth);
                
            }
        }
    }
    class ThreeStarsInSouthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threestarsinsouth = self.ThreeStarsInSouth(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threestarsinsouth.IsReady:
                # The current value of self.threestarsinsouth is represented by self.threestarsinsouth.Current.Value
                self.Plot("ThreeStarsInSouth", "threestarsinsouth", self.threestarsinsouth.Current.Value)
                
    

    The following reference table describes the ThreeStarsInSouth method:

    ThreeStarsInSouth() 1/1

                ThreeStarsInSouth QuantConnect.Algorithm.CandlestickPatterns.ThreeStarsInSouth (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeStarsInSouth pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeStarsInSouth indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeStarsInSouthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeStarsInSouth _threestarsinsouth;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threestarsinsouth = new ThreeStarsInSouth(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threestarsinsouth.Update(bar);
            }
    
            if (_threestarsinsouth.IsReady)
            {
                // The current value of _threestarsinsouth is represented by itself (_threestarsinsouth)
                // or _threestarsinsouth.Current.Value
                Plot("ThreeStarsInSouth", "threestarsinsouth", _threestarsinsouth);
                
            }
        }
    }
    class ThreeStarsInSouthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threestarsinsouth = ThreeStarsInSouth(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threestarsinsouth.Update(bar)
    
            if self.threestarsinsouth.IsReady:
                # The current value of self.threestarsinsouth is represented by self.threestarsinsouth.Current.Value
                self.Plot("ThreeStarsInSouth", "threestarsinsouth", self.threestarsinsouth.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeStarsInSouthAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeStarsInSouth _threestarsinsouth;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threestarsinsouth = new ThreeStarsInSouth(SPY);
            RegisterIndicator(_symbol, _threestarsinsouth, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threestarsinsouth.IsReady)
            {
                // The current value of _threestarsinsouth is represented by itself (_threestarsinsouth)
                // or _threestarsinsouth.Current.Value
                Plot("ThreeStarsInSouth", "threestarsinsouth", _threestarsinsouth);
                
            }
        }
    }
    class ThreeStarsInSouthAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threestarsinsouth = ThreeStarsInSouth(SPY)
            self.RegisterIndicator(self.symbol, self.threestarsinsouth, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threestarsinsouth.IsReady:
                # The current value of self.threestarsinsouth is represented by self.threestarsinsouth.Current.Value
                self.Plot("ThreeStarsInSouth", "threestarsinsouth", self.threestarsinsouth.Current.Value)
                
    

    The following reference table describes the ThreeStarsInSouth constructor:

    ThreeStarsInSouth() 1/2

                ThreeStarsInSouth QuantConnect.Indicators.CandlestickPatterns.ThreeStarsInSouth (
        string  name
       )
            

    Initializes a new instance of the ThreeStarsInSout class using the specified name.

    ThreeStarsInSouth() 2/2

                ThreeStarsInSouth QuantConnect.Indicators.CandlestickPatterns.ThreeStarsInSouth (
        
       )
            

    Initializes a new instance of the ThreeStarsInSout class.

     

    13.1.1.55 Three White Soldiers

    Introduction

    Create a new Three Advancing White Soldiers candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using ThreeWhiteSoldiers Indicator

    To create an automatic indicators for ThreeWhiteSoldiers , call the ThreeWhiteSoldiers helper method from the QCAlgorithm class. The ThreeWhiteSoldiers method creates a ThreeWhiteSoldiers object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThreeWhiteSoldiersAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeWhiteSoldiers _threewhitesoldiers;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threewhitesoldiers = ThreeWhiteSoldiers(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_threewhitesoldiers.IsReady)
            {
                // The current value of _threewhitesoldiers is represented by itself (_threewhitesoldiers)
                // or _threewhitesoldiers.Current.Value
                Plot("ThreeWhiteSoldiers", "threewhitesoldiers", _threewhitesoldiers);
                
            }
        }
    }
    class ThreeWhiteSoldiersAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threewhitesoldiers = self.ThreeWhiteSoldiers(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.threewhitesoldiers.IsReady:
                # The current value of self.threewhitesoldiers is represented by self.threewhitesoldiers.Current.Value
                self.Plot("ThreeWhiteSoldiers", "threewhitesoldiers", self.threewhitesoldiers.Current.Value)
                
    

    The following reference table describes the ThreeWhiteSoldiers method:

    ThreeWhiteSoldiers() 1/1

                ThreeWhiteSoldiers QuantConnect.Algorithm.CandlestickPatterns.ThreeWhiteSoldiers (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ThreeWhiteSoldiers pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ThreeWhiteSoldiers indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThreeWhiteSoldiersAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeWhiteSoldiers _threewhitesoldiers;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threewhitesoldiers = new ThreeWhiteSoldiers(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _threewhitesoldiers.Update(bar);
            }
    
            if (_threewhitesoldiers.IsReady)
            {
                // The current value of _threewhitesoldiers is represented by itself (_threewhitesoldiers)
                // or _threewhitesoldiers.Current.Value
                Plot("ThreeWhiteSoldiers", "threewhitesoldiers", _threewhitesoldiers);
                
            }
        }
    }
    class ThreeWhiteSoldiersAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threewhitesoldiers = ThreeWhiteSoldiers(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.threewhitesoldiers.Update(bar)
    
            if self.threewhitesoldiers.IsReady:
                # The current value of self.threewhitesoldiers is represented by self.threewhitesoldiers.Current.Value
                self.Plot("ThreeWhiteSoldiers", "threewhitesoldiers", self.threewhitesoldiers.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThreeWhiteSoldiersAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ThreeWhiteSoldiers _threewhitesoldiers;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _threewhitesoldiers = new ThreeWhiteSoldiers(SPY);
            RegisterIndicator(_symbol, _threewhitesoldiers, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_threewhitesoldiers.IsReady)
            {
                // The current value of _threewhitesoldiers is represented by itself (_threewhitesoldiers)
                // or _threewhitesoldiers.Current.Value
                Plot("ThreeWhiteSoldiers", "threewhitesoldiers", _threewhitesoldiers);
                
            }
        }
    }
    class ThreeWhiteSoldiersAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.threewhitesoldiers = ThreeWhiteSoldiers(SPY)
            self.RegisterIndicator(self.symbol, self.threewhitesoldiers, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.threewhitesoldiers.IsReady:
                # The current value of self.threewhitesoldiers is represented by self.threewhitesoldiers.Current.Value
                self.Plot("ThreeWhiteSoldiers", "threewhitesoldiers", self.threewhitesoldiers.Current.Value)
                
    

    The following reference table describes the ThreeWhiteSoldiers constructor:

    ThreeWhiteSoldiers() 1/2

                ThreeWhiteSoldiers QuantConnect.Indicators.CandlestickPatterns.ThreeWhiteSoldiers (
        string  name
       )
            

    Initializes a new instance of the ThreeWhiteSoldier class using the specified name.

    ThreeWhiteSoldiers() 2/2

                ThreeWhiteSoldiers QuantConnect.Indicators.CandlestickPatterns.ThreeWhiteSoldiers (
        
       )
            

    Initializes a new instance of the ThreeWhiteSoldier class.

     

    13.1.1.56 Thrusting

    Introduction

    Create a new Thrusting candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Thrusting Indicator

    To create an automatic indicators for Thrusting , call the Thrusting helper method from the QCAlgorithm class. The Thrusting method creates a Thrusting object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ThrustingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Thrusting _thrusting;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _thrusting = Thrusting(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_thrusting.IsReady)
            {
                // The current value of _thrusting is represented by itself (_thrusting)
                // or _thrusting.Current.Value
                Plot("Thrusting", "thrusting", _thrusting);
                
            }
        }
    }
    class ThrustingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.thrusting = self.Thrusting(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.thrusting.IsReady:
                # The current value of self.thrusting is represented by self.thrusting.Current.Value
                self.Plot("Thrusting", "thrusting", self.thrusting.Current.Value)
                
    

    The following reference table describes the Thrusting method:

    Thrusting() 1/1

                Thrusting QuantConnect.Algorithm.CandlestickPatterns.Thrusting (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Thrusting pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Thrusting indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ThrustingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Thrusting _thrusting;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _thrusting = new Thrusting(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _thrusting.Update(bar);
            }
    
            if (_thrusting.IsReady)
            {
                // The current value of _thrusting is represented by itself (_thrusting)
                // or _thrusting.Current.Value
                Plot("Thrusting", "thrusting", _thrusting);
                
            }
        }
    }
    class ThrustingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.thrusting = Thrusting(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.thrusting.Update(bar)
    
            if self.thrusting.IsReady:
                # The current value of self.thrusting is represented by self.thrusting.Current.Value
                self.Plot("Thrusting", "thrusting", self.thrusting.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ThrustingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Thrusting _thrusting;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _thrusting = new Thrusting(SPY);
            RegisterIndicator(_symbol, _thrusting, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_thrusting.IsReady)
            {
                // The current value of _thrusting is represented by itself (_thrusting)
                // or _thrusting.Current.Value
                Plot("Thrusting", "thrusting", _thrusting);
                
            }
        }
    }
    class ThrustingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.thrusting = Thrusting(SPY)
            self.RegisterIndicator(self.symbol, self.thrusting, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.thrusting.IsReady:
                # The current value of self.thrusting is represented by self.thrusting.Current.Value
                self.Plot("Thrusting", "thrusting", self.thrusting.Current.Value)
                
    

    The following reference table describes the Thrusting constructor:

    Thrusting() 1/2

                Thrusting QuantConnect.Indicators.CandlestickPatterns.Thrusting (
        string  name
       )
            

    Initializes a new instance of the Thrustin class using the specified name.

    Thrusting() 2/2

                Thrusting QuantConnect.Indicators.CandlestickPatterns.Thrusting (
        
       )
            

    Initializes a new instance of the Thrustin class.

     

    13.1.1.57 Tristar

    Introduction

    Create a new Tristar candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using Tristar Indicator

    To create an automatic indicators for Tristar , call the Tristar helper method from the QCAlgorithm class. The Tristar method creates a Tristar object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TristarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Tristar _tristar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tristar = Tristar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_tristar.IsReady)
            {
                // The current value of _tristar is represented by itself (_tristar)
                // or _tristar.Current.Value
                Plot("Tristar", "tristar", _tristar);
                
            }
        }
    }
    class TristarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tristar = self.Tristar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.tristar.IsReady:
                # The current value of self.tristar is represented by self.tristar.Current.Value
                self.Plot("Tristar", "tristar", self.tristar.Current.Value)
                
    

    The following reference table describes the Tristar method:

    Tristar() 1/1

                Tristar QuantConnect.Algorithm.CandlestickPatterns.Tristar (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Tristar pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Tristar indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class TristarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Tristar _tristar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tristar = new Tristar(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tristar.Update(bar);
            }
    
            if (_tristar.IsReady)
            {
                // The current value of _tristar is represented by itself (_tristar)
                // or _tristar.Current.Value
                Plot("Tristar", "tristar", _tristar);
                
            }
        }
    }
    class TristarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tristar = Tristar(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tristar.Update(bar)
    
            if self.tristar.IsReady:
                # The current value of self.tristar is represented by self.tristar.Current.Value
                self.Plot("Tristar", "tristar", self.tristar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TristarAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Tristar _tristar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tristar = new Tristar(SPY);
            RegisterIndicator(_symbol, _tristar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tristar.IsReady)
            {
                // The current value of _tristar is represented by itself (_tristar)
                // or _tristar.Current.Value
                Plot("Tristar", "tristar", _tristar);
                
            }
        }
    }
    class TristarAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tristar = Tristar(SPY)
            self.RegisterIndicator(self.symbol, self.tristar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tristar.IsReady:
                # The current value of self.tristar is represented by self.tristar.Current.Value
                self.Plot("Tristar", "tristar", self.tristar.Current.Value)
                
    

    The following reference table describes the Tristar constructor:

    Tristar() 1/2

                Tristar QuantConnect.Indicators.CandlestickPatterns.Tristar (
        string  name
       )
            

    Initializes a new instance of the Trista class using the specified name.

    Tristar() 2/2

                Tristar QuantConnect.Indicators.CandlestickPatterns.Tristar (
        
       )
            

    Initializes a new instance of the Trista class.

     

    13.1.1.58 Two Crows

    Introduction

    Create a new Two Crows candlestick pattern indicator to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using TwoCrows Indicator

    To create an automatic indicators for TwoCrows , call the TwoCrows helper method from the QCAlgorithm class. The TwoCrows method creates a TwoCrows object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TwoCrows _twocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _twocrows = TwoCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_twocrows.IsReady)
            {
                // The current value of _twocrows is represented by itself (_twocrows)
                // or _twocrows.Current.Value
                Plot("TwoCrows", "twocrows", _twocrows);
                
            }
        }
    }
    class TwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.twocrows = self.TwoCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.twocrows.IsReady:
                # The current value of self.twocrows is represented by self.twocrows.Current.Value
                self.Plot("TwoCrows", "twocrows", self.twocrows.Current.Value)
                
    

    The following reference table describes the TwoCrows method:

    TwoCrows() 1/1

                TwoCrows QuantConnect.Algorithm.CandlestickPatterns.TwoCrows (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new TwoCrows pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TwoCrows indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class TwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TwoCrows _twocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _twocrows = new TwoCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _twocrows.Update(bar);
            }
    
            if (_twocrows.IsReady)
            {
                // The current value of _twocrows is represented by itself (_twocrows)
                // or _twocrows.Current.Value
                Plot("TwoCrows", "twocrows", _twocrows);
                
            }
        }
    }
    class TwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.twocrows = TwoCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.twocrows.Update(bar)
    
            if self.twocrows.IsReady:
                # The current value of self.twocrows is represented by self.twocrows.Current.Value
                self.Plot("TwoCrows", "twocrows", self.twocrows.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TwoCrows _twocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _twocrows = new TwoCrows(SPY);
            RegisterIndicator(_symbol, _twocrows, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_twocrows.IsReady)
            {
                // The current value of _twocrows is represented by itself (_twocrows)
                // or _twocrows.Current.Value
                Plot("TwoCrows", "twocrows", _twocrows);
                
            }
        }
    }
    class TwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.twocrows = TwoCrows(SPY)
            self.RegisterIndicator(self.symbol, self.twocrows, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.twocrows.IsReady:
                # The current value of self.twocrows is represented by self.twocrows.Current.Value
                self.Plot("TwoCrows", "twocrows", self.twocrows.Current.Value)
                
    

    The following reference table describes the TwoCrows constructor:

    TwoCrows() 1/2

                TwoCrows QuantConnect.Indicators.CandlestickPatterns.TwoCrows (
        string  name
       )
            

    Initializes a new instance of the TwoCrow class using the specified name.

    TwoCrows() 2/2

                TwoCrows QuantConnect.Indicators.CandlestickPatterns.TwoCrows (
        
       )
            

    Initializes a new instance of the TwoCrow class.

     

    13.1.1.59 Unique Three River

    Introduction

    Create a new Unique Three River candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using UniqueThreeRiver Indicator

    To create an automatic indicators for UniqueThreeRiver , call the UniqueThreeRiver helper method from the QCAlgorithm class. The UniqueThreeRiver method creates a UniqueThreeRiver object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class UniqueThreeRiverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UniqueThreeRiver _uniquethreeriver;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _uniquethreeriver = UniqueThreeRiver(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_uniquethreeriver.IsReady)
            {
                // The current value of _uniquethreeriver is represented by itself (_uniquethreeriver)
                // or _uniquethreeriver.Current.Value
                Plot("UniqueThreeRiver", "uniquethreeriver", _uniquethreeriver);
                
            }
        }
    }
    class UniqueThreeRiverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.uniquethreeriver = self.UniqueThreeRiver(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.uniquethreeriver.IsReady:
                # The current value of self.uniquethreeriver is represented by self.uniquethreeriver.Current.Value
                self.Plot("UniqueThreeRiver", "uniquethreeriver", self.uniquethreeriver.Current.Value)
                
    

    The following reference table describes the UniqueThreeRiver method:

    UniqueThreeRiver() 1/1

                UniqueThreeRiver QuantConnect.Algorithm.CandlestickPatterns.UniqueThreeRiver (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new UniqueThreeRiver pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a UniqueThreeRiver indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class UniqueThreeRiverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UniqueThreeRiver _uniquethreeriver;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _uniquethreeriver = new UniqueThreeRiver(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _uniquethreeriver.Update(bar);
            }
    
            if (_uniquethreeriver.IsReady)
            {
                // The current value of _uniquethreeriver is represented by itself (_uniquethreeriver)
                // or _uniquethreeriver.Current.Value
                Plot("UniqueThreeRiver", "uniquethreeriver", _uniquethreeriver);
                
            }
        }
    }
    class UniqueThreeRiverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.uniquethreeriver = UniqueThreeRiver(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.uniquethreeriver.Update(bar)
    
            if self.uniquethreeriver.IsReady:
                # The current value of self.uniquethreeriver is represented by self.uniquethreeriver.Current.Value
                self.Plot("UniqueThreeRiver", "uniquethreeriver", self.uniquethreeriver.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class UniqueThreeRiverAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UniqueThreeRiver _uniquethreeriver;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _uniquethreeriver = new UniqueThreeRiver(SPY);
            RegisterIndicator(_symbol, _uniquethreeriver, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_uniquethreeriver.IsReady)
            {
                // The current value of _uniquethreeriver is represented by itself (_uniquethreeriver)
                // or _uniquethreeriver.Current.Value
                Plot("UniqueThreeRiver", "uniquethreeriver", _uniquethreeriver);
                
            }
        }
    }
    class UniqueThreeRiverAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.uniquethreeriver = UniqueThreeRiver(SPY)
            self.RegisterIndicator(self.symbol, self.uniquethreeriver, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.uniquethreeriver.IsReady:
                # The current value of self.uniquethreeriver is represented by self.uniquethreeriver.Current.Value
                self.Plot("UniqueThreeRiver", "uniquethreeriver", self.uniquethreeriver.Current.Value)
                
    

    The following reference table describes the UniqueThreeRiver constructor:

    UniqueThreeRiver() 1/2

                UniqueThreeRiver QuantConnect.Indicators.CandlestickPatterns.UniqueThreeRiver (
        string  name
       )
            

    Initializes a new instance of the UniqueThreeRive class using the specified name.

    UniqueThreeRiver() 2/2

                UniqueThreeRiver QuantConnect.Indicators.CandlestickPatterns.UniqueThreeRiver (
        
       )
            

    Initializes a new instance of the UniqueThreeRive class.

     

    13.1.1.60 Up Down Gap Three Methods

    Introduction

    Create a new Up/Down Gap Three Methods candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using UpDownGapThreeMethods Indicator

    To create an automatic indicators for UpDownGapThreeMethods , call the UpDownGapThreeMethods helper method from the QCAlgorithm class. The UpDownGapThreeMethods method creates a UpDownGapThreeMethods object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class UpDownGapThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpDownGapThreeMethods _updowngapthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _updowngapthreemethods = UpDownGapThreeMethods(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_updowngapthreemethods.IsReady)
            {
                // The current value of _updowngapthreemethods is represented by itself (_updowngapthreemethods)
                // or _updowngapthreemethods.Current.Value
                Plot("UpDownGapThreeMethods", "updowngapthreemethods", _updowngapthreemethods);
                
            }
        }
    }
    class UpDownGapThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.updowngapthreemethods = self.UpDownGapThreeMethods(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.updowngapthreemethods.IsReady:
                # The current value of self.updowngapthreemethods is represented by self.updowngapthreemethods.Current.Value
                self.Plot("UpDownGapThreeMethods", "updowngapthreemethods", self.updowngapthreemethods.Current.Value)
                
    

    The following reference table describes the UpDownGapThreeMethods method:

    UpDownGapThreeMethods() 1/1

                UpDownGapThreeMethods QuantConnect.Algorithm.CandlestickPatterns.UpDownGapThreeMethods (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new UpDownGapThreeMethods pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a UpDownGapThreeMethods indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class UpDownGapThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpDownGapThreeMethods _updowngapthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _updowngapthreemethods = new UpDownGapThreeMethods(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _updowngapthreemethods.Update(bar);
            }
    
            if (_updowngapthreemethods.IsReady)
            {
                // The current value of _updowngapthreemethods is represented by itself (_updowngapthreemethods)
                // or _updowngapthreemethods.Current.Value
                Plot("UpDownGapThreeMethods", "updowngapthreemethods", _updowngapthreemethods);
                
            }
        }
    }
    class UpDownGapThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.updowngapthreemethods = UpDownGapThreeMethods(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.updowngapthreemethods.Update(bar)
    
            if self.updowngapthreemethods.IsReady:
                # The current value of self.updowngapthreemethods is represented by self.updowngapthreemethods.Current.Value
                self.Plot("UpDownGapThreeMethods", "updowngapthreemethods", self.updowngapthreemethods.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class UpDownGapThreeMethodsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpDownGapThreeMethods _updowngapthreemethods;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _updowngapthreemethods = new UpDownGapThreeMethods(SPY);
            RegisterIndicator(_symbol, _updowngapthreemethods, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_updowngapthreemethods.IsReady)
            {
                // The current value of _updowngapthreemethods is represented by itself (_updowngapthreemethods)
                // or _updowngapthreemethods.Current.Value
                Plot("UpDownGapThreeMethods", "updowngapthreemethods", _updowngapthreemethods);
                
            }
        }
    }
    class UpDownGapThreeMethodsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.updowngapthreemethods = UpDownGapThreeMethods(SPY)
            self.RegisterIndicator(self.symbol, self.updowngapthreemethods, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.updowngapthreemethods.IsReady:
                # The current value of self.updowngapthreemethods is represented by self.updowngapthreemethods.Current.Value
                self.Plot("UpDownGapThreeMethods", "updowngapthreemethods", self.updowngapthreemethods.Current.Value)
                
    

    The following reference table describes the UpDownGapThreeMethods constructor:

    UpDownGapThreeMethods() 1/2

                UpDownGapThreeMethods QuantConnect.Indicators.CandlestickPatterns.UpDownGapThreeMethods (
        string  name
       )
            

    Initializes a new instance of the UpDownGapThreeMethod class using the specified name.

    UpDownGapThreeMethods() 2/2

                UpDownGapThreeMethods QuantConnect.Indicators.CandlestickPatterns.UpDownGapThreeMethods (
        
       )
            

    Initializes a new instance of the UpDownGapThreeMethod class.

     

    13.1.1.61 Upside Gap Two Crows

    Introduction

    Create a new Upside Gap Two Crows candlestick pattern to indicate the pattern's presence.

    To view the implementation of this candlestick pattern, see the LEAN GitHub repository .

    Using UpsideGapTwoCrows Indicator

    To create an automatic indicators for UpsideGapTwoCrows , call the UpsideGapTwoCrows helper method from the QCAlgorithm class. The UpsideGapTwoCrows method creates a UpsideGapTwoCrows object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class UpsideGapTwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpsideGapTwoCrows _upsidegaptwocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _upsidegaptwocrows = UpsideGapTwoCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_upsidegaptwocrows.IsReady)
            {
                // The current value of _upsidegaptwocrows is represented by itself (_upsidegaptwocrows)
                // or _upsidegaptwocrows.Current.Value
                Plot("UpsideGapTwoCrows", "upsidegaptwocrows", _upsidegaptwocrows);
                
            }
        }
    }
    class UpsideGapTwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.upsidegaptwocrows = self.UpsideGapTwoCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.upsidegaptwocrows.IsReady:
                # The current value of self.upsidegaptwocrows is represented by self.upsidegaptwocrows.Current.Value
                self.Plot("UpsideGapTwoCrows", "upsidegaptwocrows", self.upsidegaptwocrows.Current.Value)
                
    

    The following reference table describes the UpsideGapTwoCrows method:

    UpsideGapTwoCrows() 1/1

                UpsideGapTwoCrows QuantConnect.Algorithm.CandlestickPatterns.UpsideGapTwoCrows (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new UpsideGapTwoCrows pattern indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a UpsideGapTwoCrows indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class UpsideGapTwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpsideGapTwoCrows _upsidegaptwocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _upsidegaptwocrows = new UpsideGapTwoCrows(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _upsidegaptwocrows.Update(bar);
            }
    
            if (_upsidegaptwocrows.IsReady)
            {
                // The current value of _upsidegaptwocrows is represented by itself (_upsidegaptwocrows)
                // or _upsidegaptwocrows.Current.Value
                Plot("UpsideGapTwoCrows", "upsidegaptwocrows", _upsidegaptwocrows);
                
            }
        }
    }
    class UpsideGapTwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.upsidegaptwocrows = UpsideGapTwoCrows(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.upsidegaptwocrows.Update(bar)
    
            if self.upsidegaptwocrows.IsReady:
                # The current value of self.upsidegaptwocrows is represented by self.upsidegaptwocrows.Current.Value
                self.Plot("UpsideGapTwoCrows", "upsidegaptwocrows", self.upsidegaptwocrows.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class UpsideGapTwoCrowsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UpsideGapTwoCrows _upsidegaptwocrows;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _upsidegaptwocrows = new UpsideGapTwoCrows(SPY);
            RegisterIndicator(_symbol, _upsidegaptwocrows, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_upsidegaptwocrows.IsReady)
            {
                // The current value of _upsidegaptwocrows is represented by itself (_upsidegaptwocrows)
                // or _upsidegaptwocrows.Current.Value
                Plot("UpsideGapTwoCrows", "upsidegaptwocrows", _upsidegaptwocrows);
                
            }
        }
    }
    class UpsideGapTwoCrowsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.upsidegaptwocrows = UpsideGapTwoCrows(SPY)
            self.RegisterIndicator(self.symbol, self.upsidegaptwocrows, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.upsidegaptwocrows.IsReady:
                # The current value of self.upsidegaptwocrows is represented by self.upsidegaptwocrows.Current.Value
                self.Plot("UpsideGapTwoCrows", "upsidegaptwocrows", self.upsidegaptwocrows.Current.Value)
                
    

    The following reference table describes the UpsideGapTwoCrows constructor:

    UpsideGapTwoCrows() 1/2

                UpsideGapTwoCrows QuantConnect.Indicators.CandlestickPatterns.UpsideGapTwoCrows (
        string  name
       )
            

    Initializes a new instance of the UpsideGapTwoCrow class using the specified name.

    UpsideGapTwoCrows() 2/2

                UpsideGapTwoCrows QuantConnect.Indicators.CandlestickPatterns.UpsideGapTwoCrows (
        
       )
            

    Initializes a new instance of the UpsideGapTwoCrow class.

     

    13.1.2 Absolute Price Oscillator

    Introduction

    This indicator computes the Absolute Price Oscillator (APO) The Absolute Price Oscillator is calculated using the following formula: APO[i] = FastMA[i] - SlowMA[i]

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using APO Indicator

    To create an automatic indicators for AbsolutePriceOscillator , call the APO helper method from the QCAlgorithm class. The APO method creates a AbsolutePriceOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AbsolutePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbsolutePriceOscillator _apo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _apo = APO("SPY", 10, 2, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_apo.IsReady)
            {
                // The current value of _apo is represented by itself (_apo)
                // or _apo.Current.Value
                Plot("AbsolutePriceOscillator", "apo", _apo);
                // Plot all properties of apo
                Plot("AbsolutePriceOscillator", "fast", _apo.Fast);
                Plot("AbsolutePriceOscillator", "slow", _apo.Slow);
                Plot("AbsolutePriceOscillator", "signal", _apo.Signal);
                Plot("AbsolutePriceOscillator", "histogram", _apo.Histogram);
            }
        }
    }
    class AbsolutePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.apo = self.APO("SPY", 10, 2, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.apo.IsReady:
                # The current value of self.apo is represented by self.apo.Current.Value
                self.Plot("AbsolutePriceOscillator", "apo", self.apo.Current.Value)
                # Plot all attributes of self.apo
                self.Plot("AbsolutePriceOscillator", "fast", self.apo.Fast.Current.Value)
                self.Plot("AbsolutePriceOscillator", "slow", self.apo.Slow.Current.Value)
                self.Plot("AbsolutePriceOscillator", "signal", self.apo.Signal.Current.Value)
                self.Plot("AbsolutePriceOscillator", "histogram", self.apo.Histogram.Current.Value)
    

    The following reference table describes the APO method:

    APO() 1/1

                AbsolutePriceOscillator QuantConnect.Algorithm.QCAlgorithm.APO (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        MovingAverageType                movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new AbsolutePriceOscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a AbsolutePriceOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class AbsolutePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbsolutePriceOscillator _apo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _apo = new AbsolutePriceOscillator(10, 2, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _apo.Update(bar.EndTime, bar.Close);
            }
    
            if (_apo.IsReady)
            {
                // The current value of _apo is represented by itself (_apo)
                // or _apo.Current.Value
                Plot("AbsolutePriceOscillator", "apo", _apo);
                // Plot all properties of apo
                Plot("AbsolutePriceOscillator", "fast", _apo.Fast);
                Plot("AbsolutePriceOscillator", "slow", _apo.Slow);
                Plot("AbsolutePriceOscillator", "signal", _apo.Signal);
                Plot("AbsolutePriceOscillator", "histogram", _apo.Histogram);
            }
        }
    }
    class AbsolutePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.apo = AbsolutePriceOscillator(10, 2, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.apo.Update(bar.EndTime, bar.Close)
    
            if self.apo.IsReady:
                # The current value of self.apo is represented by self.apo.Current.Value
                self.Plot("AbsolutePriceOscillator", "apo", self.apo.Current.Value)
                # Plot all attributes of self.apo
                self.Plot("AbsolutePriceOscillator", "fast", self.apo.Fast.Current.Value)
                self.Plot("AbsolutePriceOscillator", "slow", self.apo.Slow.Current.Value)
                self.Plot("AbsolutePriceOscillator", "signal", self.apo.Signal.Current.Value)
                self.Plot("AbsolutePriceOscillator", "histogram", self.apo.Histogram.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AbsolutePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AbsolutePriceOscillator _apo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _apo = new AbsolutePriceOscillator(10, 2, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _apo, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_apo.IsReady)
            {
                // The current value of _apo is represented by itself (_apo)
                // or _apo.Current.Value
                Plot("AbsolutePriceOscillator", "apo", _apo);
                // Plot all properties of apo
                Plot("AbsolutePriceOscillator", "fast", _apo.Fast);
                Plot("AbsolutePriceOscillator", "slow", _apo.Slow);
                Plot("AbsolutePriceOscillator", "signal", _apo.Signal);
                Plot("AbsolutePriceOscillator", "histogram", _apo.Histogram);
            }
        }
    }
    class AbsolutePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.apo = AbsolutePriceOscillator(10, 2, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.apo, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.apo.IsReady:
                # The current value of self.apo is represented by self.apo.Current.Value
                self.Plot("AbsolutePriceOscillator", "apo", self.apo.Current.Value)
                # Plot all attributes of self.apo
                self.Plot("AbsolutePriceOscillator", "fast", self.apo.Fast.Current.Value)
                self.Plot("AbsolutePriceOscillator", "slow", self.apo.Slow.Current.Value)
                self.Plot("AbsolutePriceOscillator", "signal", self.apo.Signal.Current.Value)
                self.Plot("AbsolutePriceOscillator", "histogram", self.apo.Histogram.Current.Value)
    

    The following reference table describes the AbsolutePriceOscillator constructor:

    AbsolutePriceOscillator() 1/2

                AbsolutePriceOscillator QuantConnect.Indicators.AbsolutePriceOscillator (
        string              name,
        int                 fastPeriod,
        int                 slowPeriod,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the AbsolutePriceOscillato class using the specified name and parameters.

    AbsolutePriceOscillator() 2/2

                AbsolutePriceOscillator QuantConnect.Indicators.AbsolutePriceOscillator (
        int                 fastPeriod,
        int                 slowPeriod,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the AbsolutePriceOscillato class using the specified parameters.

    Visualization

    The following image shows plot values of selected properties of AbsolutePriceOscillator using the plotly library.

    AbsolutePriceOscillator line plot.

     

    13.1.3 Acceleration Bands

    Introduction

    The Acceleration Bands created by Price Headley plots upper and lower envelope bands around a moving average.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ABANDS Indicator

    To create an automatic indicators for AccelerationBands , call the ABANDS helper method from the QCAlgorithm class. The ABANDS method creates a AccelerationBands object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AccelerationBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccelerationBands _abands;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abands = ABANDS("SPY", 10, 4, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_abands.IsReady)
            {
                // The current value of _abands is represented by itself (_abands)
                // or _abands.Current.Value
                Plot("AccelerationBands", "abands", _abands);
                // Plot all properties of abands
                Plot("AccelerationBands", "middleband", _abands.MiddleBand);
                Plot("AccelerationBands", "upperband", _abands.UpperBand);
                Plot("AccelerationBands", "lowerband", _abands.LowerBand);
            }
        }
    }
    class AccelerationBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abands = self.ABANDS("SPY", 10, 4, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.abands.IsReady:
                # The current value of self.abands is represented by self.abands.Current.Value
                self.Plot("AccelerationBands", "abands", self.abands.Current.Value)
                # Plot all attributes of self.abands
                self.Plot("AccelerationBands", "middleband", self.abands.MiddleBand.Current.Value)
                self.Plot("AccelerationBands", "upperband", self.abands.UpperBand.Current.Value)
                self.Plot("AccelerationBands", "lowerband", self.abands.LowerBand.Current.Value)
    

    The following reference table describes the ABANDS method:

    ABANDS() 1/1

                AccelerationBands QuantConnect.Algorithm.QCAlgorithm.ABANDS (
        Symbol                            symbol,
        Int32                             period,
        *Decimal                          width,
        *MovingAverageType                movingAverageType,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Acceleration Bands indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a AccelerationBands indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class AccelerationBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccelerationBands _abands;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abands = new AccelerationBands(10, 4, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _abands.Update(bar.EndTime, bar.Close);
            }
    
            if (_abands.IsReady)
            {
                // The current value of _abands is represented by itself (_abands)
                // or _abands.Current.Value
                Plot("AccelerationBands", "abands", _abands);
                // Plot all properties of abands
                Plot("AccelerationBands", "middleband", _abands.MiddleBand);
                Plot("AccelerationBands", "upperband", _abands.UpperBand);
                Plot("AccelerationBands", "lowerband", _abands.LowerBand);
            }
        }
    }
    class AccelerationBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abands = AccelerationBands(10, 4, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.abands.Update(bar.EndTime, bar.Close)
    
            if self.abands.IsReady:
                # The current value of self.abands is represented by self.abands.Current.Value
                self.Plot("AccelerationBands", "abands", self.abands.Current.Value)
                # Plot all attributes of self.abands
                self.Plot("AccelerationBands", "middleband", self.abands.MiddleBand.Current.Value)
                self.Plot("AccelerationBands", "upperband", self.abands.UpperBand.Current.Value)
                self.Plot("AccelerationBands", "lowerband", self.abands.LowerBand.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AccelerationBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccelerationBands _abands;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _abands = new AccelerationBands(10, 4, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _abands, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_abands.IsReady)
            {
                // The current value of _abands is represented by itself (_abands)
                // or _abands.Current.Value
                Plot("AccelerationBands", "abands", _abands);
                // Plot all properties of abands
                Plot("AccelerationBands", "middleband", _abands.MiddleBand);
                Plot("AccelerationBands", "upperband", _abands.UpperBand);
                Plot("AccelerationBands", "lowerband", _abands.LowerBand);
            }
        }
    }
    class AccelerationBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.abands = AccelerationBands(10, 4, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.abands, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.abands.IsReady:
                # The current value of self.abands is represented by self.abands.Current.Value
                self.Plot("AccelerationBands", "abands", self.abands.Current.Value)
                # Plot all attributes of self.abands
                self.Plot("AccelerationBands", "middleband", self.abands.MiddleBand.Current.Value)
                self.Plot("AccelerationBands", "upperband", self.abands.UpperBand.Current.Value)
                self.Plot("AccelerationBands", "lowerband", self.abands.LowerBand.Current.Value)
    

    The following reference table describes the AccelerationBands constructor:

    AccelerationBands() 1/3

                AccelerationBands QuantConnect.Indicators.AccelerationBands (
        string              name,
        int                 period,
        decimal             width,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the AccelerationBands class.

    AccelerationBands() 2/3

                AccelerationBands QuantConnect.Indicators.AccelerationBands (
        int      period,
        decimal  width
       )
            

    Initializes a new instance of the AccelerationBands class.

    AccelerationBands() 3/3

                AccelerationBands QuantConnect.Indicators.AccelerationBands (
        int  period
       )
            

    Initializes a new instance of the AccelerationBands class.

    Visualization

    The following image shows plot values of selected properties of AccelerationBands using the plotly library.

    AccelerationBands line plot.

     

    13.1.4 Accumulation Distribution

    Introduction

    This indicator computes the Accumulation/Distribution (AD) The Accumulation/Distribution is calculated using the following formula: AD = AD + ((Close - Low) - (High - Close)) / (High - Low) * Volume

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using AD Indicator

    To create an automatic indicators for AccumulationDistribution , call the AD helper method from the QCAlgorithm class. The AD method creates a AccumulationDistribution object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AccumulationDistributionAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistribution _ad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ad = AD("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_ad.IsReady)
            {
                // The current value of _ad is represented by itself (_ad)
                // or _ad.Current.Value
                Plot("AccumulationDistribution", "ad", _ad);
                
            }
        }
    }
    class AccumulationDistributionAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ad = self.AD("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.ad.IsReady:
                # The current value of self.ad is represented by self.ad.Current.Value
                self.Plot("AccumulationDistribution", "ad", self.ad.Current.Value)
                
    

    The following reference table describes the AD method:

    AD() 1/1

                AccumulationDistribution QuantConnect.Algorithm.QCAlgorithm.AD (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AccumulationDistribution indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AccumulationDistribution indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AccumulationDistributionAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistribution _ad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ad = new AccumulationDistribution("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ad.Update(bar);
            }
    
            if (_ad.IsReady)
            {
                // The current value of _ad is represented by itself (_ad)
                // or _ad.Current.Value
                Plot("AccumulationDistribution", "ad", _ad);
                
            }
        }
    }
    class AccumulationDistributionAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ad = AccumulationDistribution("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ad.Update(bar)
    
            if self.ad.IsReady:
                # The current value of self.ad is represented by self.ad.Current.Value
                self.Plot("AccumulationDistribution", "ad", self.ad.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AccumulationDistributionAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistribution _ad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ad = new AccumulationDistribution("SPY");
            RegisterIndicator(_symbol, _ad, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ad.IsReady)
            {
                // The current value of _ad is represented by itself (_ad)
                // or _ad.Current.Value
                Plot("AccumulationDistribution", "ad", _ad);
                
            }
        }
    }
    class AccumulationDistributionAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ad = AccumulationDistribution("SPY")
            self.RegisterIndicator(self.symbol, self.ad, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ad.IsReady:
                # The current value of self.ad is represented by self.ad.Current.Value
                self.Plot("AccumulationDistribution", "ad", self.ad.Current.Value)
                
    

    The following reference table describes the AccumulationDistribution constructor:

    AccumulationDistribution() 1/2

                AccumulationDistribution QuantConnect.Indicators.AccumulationDistribution (
        
       )
            

    Initializes a new instance of the AccumulationDistributio class using the specified name.

    AccumulationDistribution() 2/2

                AccumulationDistribution QuantConnect.Indicators.AccumulationDistribution (
        string  name
       )
            

    Initializes a new instance of the AccumulationDistributio class using the specified name.

    Visualization

    The following image shows plot values of selected properties of AccumulationDistribution using the plotly library.

    AccumulationDistribution line plot.

     

    13.1.5 Accumulation Distribution Oscillator

    Introduction

    This indicator computes the Accumulation/Distribution Oscillator (ADOSC) The Accumulation/Distribution Oscillator is calculated using the following formula: ADOSC = EMA(fast,AD) - EMA(slow,AD)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADOSC Indicator

    To create an automatic indicators for AccumulationDistributionOscillator , call the ADOSC helper method from the QCAlgorithm class. The ADOSC method creates a AccumulationDistributionOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AccumulationDistributionOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistributionOscillator _adosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adosc = ADOSC("SPY", 10, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (_adosc.IsReady)
            {
                // The current value of _adosc is represented by itself (_adosc)
                // or _adosc.Current.Value
                Plot("AccumulationDistributionOscillator", "adosc", _adosc);
                
            }
        }
    }
    class AccumulationDistributionOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adosc = self.ADOSC("SPY", 10, 2)
    
        def OnData(self, slice: Slice) -> None:
            if self.adosc.IsReady:
                # The current value of self.adosc is represented by self.adosc.Current.Value
                self.Plot("AccumulationDistributionOscillator", "adosc", self.adosc.Current.Value)
                
    

    The following reference table describes the ADOSC method:

    ADOSC() 1/1

                AccumulationDistributionOscillator QuantConnect.Algorithm.QCAlgorithm.ADOSC (
        Symbol                            symbol,
        Int32                             fastPeriod,
        Int32                             slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AccumulationDistributionOscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AccumulationDistributionOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AccumulationDistributionOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistributionOscillator _adosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adosc = new AccumulationDistributionOscillator(10, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _adosc.Update(bar);
            }
    
            if (_adosc.IsReady)
            {
                // The current value of _adosc is represented by itself (_adosc)
                // or _adosc.Current.Value
                Plot("AccumulationDistributionOscillator", "adosc", _adosc);
                
            }
        }
    }
    class AccumulationDistributionOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adosc = AccumulationDistributionOscillator(10, 2)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.adosc.Update(bar)
    
            if self.adosc.IsReady:
                # The current value of self.adosc is represented by self.adosc.Current.Value
                self.Plot("AccumulationDistributionOscillator", "adosc", self.adosc.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AccumulationDistributionOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AccumulationDistributionOscillator _adosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adosc = new AccumulationDistributionOscillator(10, 2);
            RegisterIndicator(_symbol, _adosc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_adosc.IsReady)
            {
                // The current value of _adosc is represented by itself (_adosc)
                // or _adosc.Current.Value
                Plot("AccumulationDistributionOscillator", "adosc", _adosc);
                
            }
        }
    }
    class AccumulationDistributionOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adosc = AccumulationDistributionOscillator(10, 2)
            self.RegisterIndicator(self.symbol, self.adosc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.adosc.IsReady:
                # The current value of self.adosc is represented by self.adosc.Current.Value
                self.Plot("AccumulationDistributionOscillator", "adosc", self.adosc.Current.Value)
                
    

    The following reference table describes the AccumulationDistributionOscillator constructor:

    AccumulationDistributionOscillator() 1/2

                AccumulationDistributionOscillator QuantConnect.Indicators.AccumulationDistributionOscillator (
        int  fastPeriod,
        int  slowPeriod
       )
            

    Initializes a new instance of the AccumulationDistributionOscillato class using the specified parameters.

    AccumulationDistributionOscillator() 2/2

                AccumulationDistributionOscillator QuantConnect.Indicators.AccumulationDistributionOscillator (
        string  name,
        int     fastPeriod,
        int     slowPeriod
       )
            

    Initializes a new instance of the AccumulationDistributionOscillato class using the specified parameters.

    Visualization

    The following image shows plot values of selected properties of AccumulationDistributionOscillator using the plotly library.

    AccumulationDistributionOscillator line plot.

     

    13.1.6 Advance Decline Difference

    Introduction

    The Advance Decline Difference compute the difference between the number of stocks that closed higher and the number of stocks that closed lower than their previous day's closing prices.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADDIFF Indicator

    To create an automatic indicators for AdvanceDeclineDifference , call the ADDIFF helper method from the QCAlgorithm class. The ADDIFF method creates a AdvanceDeclineDifference object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AdvanceDeclineDifferenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineDifference _addiff;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _addiff = ADDIFF(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_addiff.IsReady)
            {
                // The current value of _addiff is represented by itself (_addiff)
                // or _addiff.Current.Value
                Plot("AdvanceDeclineDifference", "addiff", _addiff);
                
            }
        }
    }
    class AdvanceDeclineDifferenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.addiff = self.ADDIFF(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.addiff.IsReady:
                # The current value of self.addiff is represented by self.addiff.Current.Value
                self.Plot("AdvanceDeclineDifference", "addiff", self.addiff.Current.Value)
                
    

    The following reference table describes the ADDIFF method:

    ADDIFF() 1/1

                AdvanceDeclineDifference QuantConnect.Algorithm.QCAlgorithm.ADDIFF (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AdvanceDeclineDifference indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AdvanceDeclineDifferenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineDifference _addiff;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _addiff = new AdvanceDeclineDifference("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _addiff.Update(bar);
            }
    
            if (_addiff.IsReady)
            {
                // The current value of _addiff is represented by itself (_addiff)
                // or _addiff.Current.Value
                Plot("AdvanceDeclineDifference", "addiff", _addiff);
                
            }
        }
    }
    class AdvanceDeclineDifferenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.addiff = AdvanceDeclineDifference("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.addiff.Update(bar)
    
            if self.addiff.IsReady:
                # The current value of self.addiff is represented by self.addiff.Current.Value
                self.Plot("AdvanceDeclineDifference", "addiff", self.addiff.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AdvanceDeclineDifferenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineDifference _addiff;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _addiff = new AdvanceDeclineDifference("QQQ"]);
            RegisterIndicator(_symbol, _addiff, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_addiff.IsReady)
            {
                // The current value of _addiff is represented by itself (_addiff)
                // or _addiff.Current.Value
                Plot("AdvanceDeclineDifference", "addiff", _addiff);
                
            }
        }
    }
    class AdvanceDeclineDifferenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.addiff = AdvanceDeclineDifference("QQQ"])
            self.RegisterIndicator(self.symbol, self.addiff, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.addiff.IsReady:
                # The current value of self.addiff is represented by self.addiff.Current.Value
                self.Plot("AdvanceDeclineDifference", "addiff", self.addiff.Current.Value)
                
    

    The following reference table describes the AdvanceDeclineDifference constructor:

    AdvanceDeclineDifference() 1/1

                AdvanceDeclineDifference QuantConnect.Indicators.AdvanceDeclineDifference (
        
       )
            

    Initializes a new instance of the AdvanceDeclineDifferenc class.

    Visualization

    The following image shows plot values of selected properties of AdvanceDeclineDifference using the plotly library.

    AdvanceDeclineDifference line plot.

     

    13.1.7 Advance Decline Ratio

    Introduction

    The advance-decline ratio (ADR) compares the number of stocks that closed higher against the number of stocks that closed lower than their previous day's closing prices.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADR Indicator

    To create an automatic indicators for AdvanceDeclineRatio , call the ADR helper method from the QCAlgorithm class. The ADR method creates a AdvanceDeclineRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AdvanceDeclineRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineRatio _adr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adr = ADR(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_adr.IsReady)
            {
                // The current value of _adr is represented by itself (_adr)
                // or _adr.Current.Value
                Plot("AdvanceDeclineRatio", "adr", _adr);
                
            }
        }
    }
    class AdvanceDeclineRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adr = self.ADR(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.adr.IsReady:
                # The current value of self.adr is represented by self.adr.Current.Value
                self.Plot("AdvanceDeclineRatio", "adr", self.adr.Current.Value)
                
    

    The following reference table describes the ADR method:

    ADR() 1/1

                AdvanceDeclineRatio QuantConnect.Algorithm.QCAlgorithm.ADR (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AdvanceDeclineRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AdvanceDeclineRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineRatio _adr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adr = new AdvanceDeclineRatio("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _adr.Update(bar);
            }
    
            if (_adr.IsReady)
            {
                // The current value of _adr is represented by itself (_adr)
                // or _adr.Current.Value
                Plot("AdvanceDeclineRatio", "adr", _adr);
                
            }
        }
    }
    class AdvanceDeclineRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adr = AdvanceDeclineRatio("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.adr.Update(bar)
    
            if self.adr.IsReady:
                # The current value of self.adr is represented by self.adr.Current.Value
                self.Plot("AdvanceDeclineRatio", "adr", self.adr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AdvanceDeclineRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineRatio _adr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adr = new AdvanceDeclineRatio("QQQ"]);
            RegisterIndicator(_symbol, _adr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_adr.IsReady)
            {
                // The current value of _adr is represented by itself (_adr)
                // or _adr.Current.Value
                Plot("AdvanceDeclineRatio", "adr", _adr);
                
            }
        }
    }
    class AdvanceDeclineRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adr = AdvanceDeclineRatio("QQQ"])
            self.RegisterIndicator(self.symbol, self.adr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.adr.IsReady:
                # The current value of self.adr is represented by self.adr.Current.Value
                self.Plot("AdvanceDeclineRatio", "adr", self.adr.Current.Value)
                
    

    The following reference table describes the AdvanceDeclineRatio constructor:

    AdvanceDeclineRatio() 1/1

                AdvanceDeclineRatio QuantConnect.Indicators.AdvanceDeclineRatio (
        
       )
            

    Initializes a new instance of the AdvanceDeclineRati class.

    Visualization

    The following image shows plot values of selected properties of AdvanceDeclineRatio using the plotly library.

    AdvanceDeclineRatio line plot.

     

    13.1.8 Advance Decline Volume Ratio

    Introduction

    The Advance Decline Volume Ratio is a Breadth indicator calculated as ratio of summary volume of advancing stocks to summary volume of declining stocks. AD Volume Ratio is used in technical analysis to see where the main trading activity is focused.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADVR Indicator

    To create an automatic indicators for AdvanceDeclineVolumeRatio , call the ADVR helper method from the QCAlgorithm class. The ADVR method creates a AdvanceDeclineVolumeRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AdvanceDeclineVolumeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineVolumeRatio _advr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advr = ADVR(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_advr.IsReady)
            {
                // The current value of _advr is represented by itself (_advr)
                // or _advr.Current.Value
                Plot("AdvanceDeclineVolumeRatio", "advr", _advr);
                
            }
        }
    }
    class AdvanceDeclineVolumeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advr = self.ADVR(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.advr.IsReady:
                # The current value of self.advr is represented by self.advr.Current.Value
                self.Plot("AdvanceDeclineVolumeRatio", "advr", self.advr.Current.Value)
                
    

    The following reference table describes the ADVR method:

    ADVR() 1/1

                AdvanceDeclineVolumeRatio QuantConnect.Algorithm.QCAlgorithm.ADVR (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AdvanceDeclineVolumeRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class AdvanceDeclineVolumeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineVolumeRatio _advr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advr = new AdvanceDeclineVolumeRatio("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _advr.Update(bar);
            }
    
            if (_advr.IsReady)
            {
                // The current value of _advr is represented by itself (_advr)
                // or _advr.Current.Value
                Plot("AdvanceDeclineVolumeRatio", "advr", _advr);
                
            }
        }
    }
    class AdvanceDeclineVolumeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advr = AdvanceDeclineVolumeRatio("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.advr.Update(bar)
    
            if self.advr.IsReady:
                # The current value of self.advr is represented by self.advr.Current.Value
                self.Plot("AdvanceDeclineVolumeRatio", "advr", self.advr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AdvanceDeclineVolumeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AdvanceDeclineVolumeRatio _advr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _advr = new AdvanceDeclineVolumeRatio("QQQ"]);
            RegisterIndicator(_symbol, _advr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_advr.IsReady)
            {
                // The current value of _advr is represented by itself (_advr)
                // or _advr.Current.Value
                Plot("AdvanceDeclineVolumeRatio", "advr", _advr);
                
            }
        }
    }
    class AdvanceDeclineVolumeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.advr = AdvanceDeclineVolumeRatio("QQQ"])
            self.RegisterIndicator(self.symbol, self.advr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.advr.IsReady:
                # The current value of self.advr is represented by self.advr.Current.Value
                self.Plot("AdvanceDeclineVolumeRatio", "advr", self.advr.Current.Value)
                
    

    The following reference table describes the AdvanceDeclineVolumeRatio constructor:

    AdvanceDeclineVolumeRatio() 1/1

                AdvanceDeclineVolumeRatio QuantConnect.Indicators.AdvanceDeclineVolumeRatio (
        
       )
            

    Initializes a new instance of the AdvanceDeclineVolumeRati class.

    Visualization

    The following image shows plot values of selected properties of AdvanceDeclineVolumeRatio using the plotly library.

    AdvanceDeclineVolumeRatio line plot.

     

    13.1.9 Arms Index

    Introduction

    The Arms Index, also called the Short-Term Trading Index (TRIN) is a technical analysis indicator that compares the number of advancing and declining stocks (AD Ratio) to advancing and declining volume (AD volume).

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TRIN Indicator

    To create an automatic indicators for ArmsIndex , call the TRIN helper method from the QCAlgorithm class. The TRIN method creates a ArmsIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ArmsIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArmsIndex _trin;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trin = TRIN(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_trin.IsReady)
            {
                // The current value of _trin is represented by itself (_trin)
                // or _trin.Current.Value
                Plot("ArmsIndex", "trin", _trin);
                // Plot all properties of trin
                Plot("ArmsIndex", "adratio", _trin.ADRatio);
                Plot("ArmsIndex", "advratio", _trin.ADVRatio);
            }
        }
    }
    class ArmsIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trin = self.TRIN(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.trin.IsReady:
                # The current value of self.trin is represented by self.trin.Current.Value
                self.Plot("ArmsIndex", "trin", self.trin.Current.Value)
                # Plot all attributes of self.trin
                self.Plot("ArmsIndex", "adratio", self.trin.ADRatio.Current.Value)
                self.Plot("ArmsIndex", "advratio", self.trin.ADVRatio.Current.Value)
    

    The following reference table describes the TRIN method:

    TRIN() 1/2

                ArmsIndex QuantConnect.Algorithm.QCAlgorithm.TRIN (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Arms Index indicator.

    TRIN() 2/2

                ArmsIndex QuantConnect.Algorithm.QCAlgorithm.TRIN (
        Symbol>                        symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Arms Index indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ArmsIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ArmsIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArmsIndex _trin;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trin = new ArmsIndex("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _trin.Update(bar);
            }
    
            if (_trin.IsReady)
            {
                // The current value of _trin is represented by itself (_trin)
                // or _trin.Current.Value
                Plot("ArmsIndex", "trin", _trin);
                // Plot all properties of trin
                Plot("ArmsIndex", "adratio", _trin.ADRatio);
                Plot("ArmsIndex", "advratio", _trin.ADVRatio);
            }
        }
    }
    class ArmsIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trin = ArmsIndex("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.trin.Update(bar)
    
            if self.trin.IsReady:
                # The current value of self.trin is represented by self.trin.Current.Value
                self.Plot("ArmsIndex", "trin", self.trin.Current.Value)
                # Plot all attributes of self.trin
                self.Plot("ArmsIndex", "adratio", self.trin.ADRatio.Current.Value)
                self.Plot("ArmsIndex", "advratio", self.trin.ADVRatio.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ArmsIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArmsIndex _trin;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trin = new ArmsIndex("QQQ"]);
            RegisterIndicator(_symbol, _trin, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_trin.IsReady)
            {
                // The current value of _trin is represented by itself (_trin)
                // or _trin.Current.Value
                Plot("ArmsIndex", "trin", _trin);
                // Plot all properties of trin
                Plot("ArmsIndex", "adratio", _trin.ADRatio);
                Plot("ArmsIndex", "advratio", _trin.ADVRatio);
            }
        }
    }
    class ArmsIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trin = ArmsIndex("QQQ"])
            self.RegisterIndicator(self.symbol, self.trin, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.trin.IsReady:
                # The current value of self.trin is represented by self.trin.Current.Value
                self.Plot("ArmsIndex", "trin", self.trin.Current.Value)
                # Plot all attributes of self.trin
                self.Plot("ArmsIndex", "adratio", self.trin.ADRatio.Current.Value)
                self.Plot("ArmsIndex", "advratio", self.trin.ADVRatio.Current.Value)
    

    The following reference table describes the ArmsIndex constructor:

    ArmsIndex() 1/1

                ArmsIndex QuantConnect.Indicators.ArmsIndex (
        
       )
            

    Initializes a new instance of the ArmsInde class.

    Visualization

    The following image shows plot values of selected properties of ArmsIndex using the plotly library.

    ArmsIndex line plot.

     

    13.1.10 Arnaud Legoux Moving Average

    Introduction

    Smooth and high sensitive moving Average. This moving average reduce lag of the information but still being smooth to reduce noises. Is a weighted moving average, which weights have a Normal shape; the parameters Sigma and Offset affect the kurtosis and skewness of the weights respectively. source

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ALMA Indicator

    To create an automatic indicators for ArnaudLegouxMovingAverage , call the ALMA helper method from the QCAlgorithm class. The ALMA method creates a ArnaudLegouxMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ArnaudLegouxMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArnaudLegouxMovingAverage _alma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _alma = ALMA("SPY", 10, 6, 0.85);
        }
    
        public override void OnData(Slice data)
        {
            if (_alma.IsReady)
            {
                // The current value of _alma is represented by itself (_alma)
                // or _alma.Current.Value
                Plot("ArnaudLegouxMovingAverage", "alma", _alma);
                
            }
        }
    }
    class ArnaudLegouxMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.alma = self.ALMA("SPY", 10, 6, 0.85)
    
        def OnData(self, slice: Slice) -> None:
            if self.alma.IsReady:
                # The current value of self.alma is represented by self.alma.Current.Value
                self.Plot("ArnaudLegouxMovingAverage", "alma", self.alma.Current.Value)
                
    

    The following reference table describes the ALMA method:

    ALMA() 1/1

                ArnaudLegouxMovingAverage QuantConnect.Algorithm.QCAlgorithm.ALMA (
        Symbol                           symbol,
        Int32                            period,
        *Int32                           sigma,
        *Decimal                         offset,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ArnaudLegouxMovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ArnaudLegouxMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class ArnaudLegouxMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArnaudLegouxMovingAverage _alma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _alma = new ArnaudLegouxMovingAverage(10, 6, 0.85);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _alma.Update(bar.EndTime, bar.Close);
            }
    
            if (_alma.IsReady)
            {
                // The current value of _alma is represented by itself (_alma)
                // or _alma.Current.Value
                Plot("ArnaudLegouxMovingAverage", "alma", _alma);
                
            }
        }
    }
    class ArnaudLegouxMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.alma = ArnaudLegouxMovingAverage(10, 6, 0.85)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.alma.Update(bar.EndTime, bar.Close)
    
            if self.alma.IsReady:
                # The current value of self.alma is represented by self.alma.Current.Value
                self.Plot("ArnaudLegouxMovingAverage", "alma", self.alma.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ArnaudLegouxMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ArnaudLegouxMovingAverage _alma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _alma = new ArnaudLegouxMovingAverage(10, 6, 0.85);
            RegisterIndicator(_symbol, _alma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_alma.IsReady)
            {
                // The current value of _alma is represented by itself (_alma)
                // or _alma.Current.Value
                Plot("ArnaudLegouxMovingAverage", "alma", _alma);
                
            }
        }
    }
    class ArnaudLegouxMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.alma = ArnaudLegouxMovingAverage(10, 6, 0.85)
            self.RegisterIndicator(self.symbol, self.alma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.alma.IsReady:
                # The current value of self.alma is represented by self.alma.Current.Value
                self.Plot("ArnaudLegouxMovingAverage", "alma", self.alma.Current.Value)
                
    

    The following reference table describes the ArnaudLegouxMovingAverage constructor:

    ArnaudLegouxMovingAverage() 1/4

                ArnaudLegouxMovingAverage QuantConnect.Indicators.ArnaudLegouxMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the ArnaudLegouxMovingAverage class.

    ArnaudLegouxMovingAverage() 2/4

                ArnaudLegouxMovingAverage QuantConnect.Indicators.ArnaudLegouxMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the ArnaudLegouxMovingAverage class.

    ArnaudLegouxMovingAverage() 3/4

                ArnaudLegouxMovingAverage QuantConnect.Indicators.ArnaudLegouxMovingAverage (
        int  period
       )
            

    Initializes a new instance of the ArnaudLegouxMovingAverage class.

    ArnaudLegouxMovingAverage() 4/4

                ArnaudLegouxMovingAverage QuantConnect.Indicators.ArnaudLegouxMovingAverage (
        int  period
       )
            

    Initializes a new instance of the ArnaudLegouxMovingAverage class.

    Visualization

    The following image shows plot values of selected properties of ArnaudLegouxMovingAverage using the plotly library.

    ArnaudLegouxMovingAverage line plot.

     

    13.1.11 Aroon Oscillator

    Introduction

    The Aroon Oscillator is the difference between AroonUp and AroonDown. The value of this indicator fluctuates between -100 and +100. An upward trend bias is present when the oscillator is positive, and a negative trend bias is present when the oscillator is negative. AroonUp/Down values over 75 identify strong trends in their respective direction.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using AROON Indicator

    To create an automatic indicators for AroonOscillator , call the AROON helper method from the QCAlgorithm class. The AROON method creates a AroonOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AroonOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AroonOscillator _aroon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aroon = AROON("SPY", 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_aroon.IsReady)
            {
                // The current value of _aroon is represented by itself (_aroon)
                // or _aroon.Current.Value
                Plot("AroonOscillator", "aroon", _aroon);
                // Plot all properties of aroon
                Plot("AroonOscillator", "aroonup", _aroon.AroonUp);
                Plot("AroonOscillator", "aroondown", _aroon.AroonDown);
            }
        }
    }
    class AroonOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aroon = self.AROON("SPY", 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.aroon.IsReady:
                # The current value of self.aroon is represented by self.aroon.Current.Value
                self.Plot("AroonOscillator", "aroon", self.aroon.Current.Value)
                # Plot all attributes of self.aroon
                self.Plot("AroonOscillator", "aroonup", self.aroon.AroonUp.Current.Value)
                self.Plot("AroonOscillator", "aroondown", self.aroon.AroonDown.Current.Value)
    

    The following reference table describes the AROON method:

    AROON() 1/2

                AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).

    AROON() 2/2

                AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
        Symbol                                symbol,
        Int32                                 upPeriod,
        Int32                                 downPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AroonOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class AroonOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AroonOscillator _aroon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aroon = new AroonOscillator(10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _aroon.Update(bar);
            }
    
            if (_aroon.IsReady)
            {
                // The current value of _aroon is represented by itself (_aroon)
                // or _aroon.Current.Value
                Plot("AroonOscillator", "aroon", _aroon);
                // Plot all properties of aroon
                Plot("AroonOscillator", "aroonup", _aroon.AroonUp);
                Plot("AroonOscillator", "aroondown", _aroon.AroonDown);
            }
        }
    }
    class AroonOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aroon = AroonOscillator(10, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.aroon.Update(bar)
    
            if self.aroon.IsReady:
                # The current value of self.aroon is represented by self.aroon.Current.Value
                self.Plot("AroonOscillator", "aroon", self.aroon.Current.Value)
                # Plot all attributes of self.aroon
                self.Plot("AroonOscillator", "aroonup", self.aroon.AroonUp.Current.Value)
                self.Plot("AroonOscillator", "aroondown", self.aroon.AroonDown.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AroonOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AroonOscillator _aroon;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aroon = new AroonOscillator(10, 20);
            RegisterIndicator(_symbol, _aroon, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_aroon.IsReady)
            {
                // The current value of _aroon is represented by itself (_aroon)
                // or _aroon.Current.Value
                Plot("AroonOscillator", "aroon", _aroon);
                // Plot all properties of aroon
                Plot("AroonOscillator", "aroonup", _aroon.AroonUp);
                Plot("AroonOscillator", "aroondown", _aroon.AroonDown);
            }
        }
    }
    class AroonOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aroon = AroonOscillator(10, 20)
            self.RegisterIndicator(self.symbol, self.aroon, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.aroon.IsReady:
                # The current value of self.aroon is represented by self.aroon.Current.Value
                self.Plot("AroonOscillator", "aroon", self.aroon.Current.Value)
                # Plot all attributes of self.aroon
                self.Plot("AroonOscillator", "aroonup", self.aroon.AroonUp.Current.Value)
                self.Plot("AroonOscillator", "aroondown", self.aroon.AroonDown.Current.Value)
    

    The following reference table describes the AroonOscillator constructor:

    AroonOscillator() 1/2

                AroonOscillator QuantConnect.Indicators.AroonOscillator (
        int  upPeriod,
        int  downPeriod
       )
            

    Creates a new AroonOscillator from the specified up/down periods.

    AroonOscillator() 2/2

                AroonOscillator QuantConnect.Indicators.AroonOscillator (
        string  name,
        int     upPeriod,
        int     downPeriod
       )
            

    Creates a new AroonOscillator from the specified up/down periods.

    Visualization

    The following image shows plot values of selected properties of AroonOscillator using the plotly library.

    AroonOscillator line plot.

     

    13.1.12 Augen Price Spike

    Introduction

    The Augen Price Spike indicator is an indicator that measures price changes in terms of standard deviations. In the book, The Volatility Edge in Options Trading, Jeff Augen describes a method for tracking absolute price changes in terms of recent volatility, using the standard deviation. length = x closes = closeArray closes1 = closeArray shifted right by 1 closes2 = closeArray shifted right by 2 closeLog = np.log(np.divide(closes1, closes2)) SDev = np.std(closeLog) m = SDev * closes1[-1] spike = (closes[-1]-closes1[-1])/m return spike Augen Price Spike from TradingView https://www.tradingview.com/script/fC7Pn2X2-Price-Spike-Jeff-Augen/

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using APS Indicator

    To create an automatic indicators for AugenPriceSpike , call the APS helper method from the QCAlgorithm class. The APS method creates a AugenPriceSpike object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AugenPriceSpikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AugenPriceSpike _aps;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aps = APS("SPY", 3);
        }
    
        public override void OnData(Slice data)
        {
            if (_aps.IsReady)
            {
                // The current value of _aps is represented by itself (_aps)
                // or _aps.Current.Value
                Plot("AugenPriceSpike", "aps", _aps);
                
            }
        }
    }
    class AugenPriceSpikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aps = self.APS("SPY", 3)
    
        def OnData(self, slice: Slice) -> None:
            if self.aps.IsReady:
                # The current value of self.aps is represented by self.aps.Current.Value
                self.Plot("AugenPriceSpike", "aps", self.aps.Current.Value)
                
    

    The following reference table describes the APS method:

    APS() 1/1

                AugenPriceSpike QuantConnect.Algorithm.QCAlgorithm.APS (
        Symbol                           symbol,
        *Int32                           period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an AugenPriceSpike indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AugenPriceSpike indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class AugenPriceSpikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AugenPriceSpike _aps;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aps = new AugenPriceSpike(3);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _aps.Update(bar.EndTime, bar.Close);
            }
    
            if (_aps.IsReady)
            {
                // The current value of _aps is represented by itself (_aps)
                // or _aps.Current.Value
                Plot("AugenPriceSpike", "aps", _aps);
                
            }
        }
    }
    class AugenPriceSpikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aps = AugenPriceSpike(3)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.aps.Update(bar.EndTime, bar.Close)
    
            if self.aps.IsReady:
                # The current value of self.aps is represented by self.aps.Current.Value
                self.Plot("AugenPriceSpike", "aps", self.aps.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AugenPriceSpikeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AugenPriceSpike _aps;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _aps = new AugenPriceSpike(3);
            RegisterIndicator(_symbol, _aps, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_aps.IsReady)
            {
                // The current value of _aps is represented by itself (_aps)
                // or _aps.Current.Value
                Plot("AugenPriceSpike", "aps", _aps);
                
            }
        }
    }
    class AugenPriceSpikeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.aps = AugenPriceSpike(3)
            self.RegisterIndicator(self.symbol, self.aps, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.aps.IsReady:
                # The current value of self.aps is represented by self.aps.Current.Value
                self.Plot("AugenPriceSpike", "aps", self.aps.Current.Value)
                
    

    The following reference table describes the AugenPriceSpike constructor:

    AugenPriceSpike() 1/2

                AugenPriceSpike QuantConnect.Indicators.AugenPriceSpike (
        *int  period
       )
            

    Initializes a new instance of the AugenPriceSpike class using the specified period.

    AugenPriceSpike() 2/2

                AugenPriceSpike QuantConnect.Indicators.AugenPriceSpike (
        string  name,
        int     period
       )
            

    Creates a new AugenPriceSpike indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of AugenPriceSpike using the plotly library.

    AugenPriceSpike line plot.

     

    13.1.13 Auto Regressive Integrated Moving Average

    Introduction

    An Autoregressive Intergrated Moving Average (ARIMA) is a time series model which can be used to describe a set of data. In particular,with Xₜ representing the series, the model assumes the data are of form (after differencing times): Xₜ = c + εₜ + ΣᵢφᵢXₜ₋ᵢ + Σᵢθᵢεₜ₋ᵢ where the first sum has an upper limit of and the second .

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ARIMA Indicator

    To create an automatic indicators for AutoRegressiveIntegratedMovingAverage , call the ARIMA helper method from the QCAlgorithm class. The ARIMA method creates a AutoRegressiveIntegratedMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AutoRegressiveIntegratedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AutoRegressiveIntegratedMovingAverage _arima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _arima = ARIMA("SPY", 1, 1, 1, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_arima.IsReady)
            {
                // The current value of _arima is represented by itself (_arima)
                // or _arima.Current.Value
                Plot("AutoRegressiveIntegratedMovingAverage", "arima", _arima);
                // Plot all properties of arima
                Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", _arima.ArResidualError);
                Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", _arima.MaResidualError);
            }
        }
    }
    class AutoRegressiveIntegratedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.arima = self.ARIMA("SPY", 1, 1, 1, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.arima.IsReady:
                # The current value of self.arima is represented by self.arima.Current.Value
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arima", self.arima.Current.Value)
                # Plot all attributes of self.arima
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", self.arima.ArResidualError.Current.Value)
                self.Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", self.arima.MaResidualError.Current.Value)
    

    The following reference table describes the ARIMA method:

    ARIMA() 1/1

                AutoRegressiveIntegratedMovingAverage QuantConnect.Algorithm.QCAlgorithm.ARIMA (
        Symbol                           symbol,
        Int32                            arOrder,
        Int32                            diffOrder,
        Int32                            maOrder,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ARIMA indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AutoRegressiveIntegratedMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class AutoRegressiveIntegratedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AutoRegressiveIntegratedMovingAverage _arima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _arima = new AutoRegressiveIntegratedMovingAverage(1, 1, 1, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _arima.Update(bar.EndTime, bar.Close);
            }
    
            if (_arima.IsReady)
            {
                // The current value of _arima is represented by itself (_arima)
                // or _arima.Current.Value
                Plot("AutoRegressiveIntegratedMovingAverage", "arima", _arima);
                // Plot all properties of arima
                Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", _arima.ArResidualError);
                Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", _arima.MaResidualError);
            }
        }
    }
    class AutoRegressiveIntegratedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.arima = AutoRegressiveIntegratedMovingAverage(1, 1, 1, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.arima.Update(bar.EndTime, bar.Close)
    
            if self.arima.IsReady:
                # The current value of self.arima is represented by self.arima.Current.Value
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arima", self.arima.Current.Value)
                # Plot all attributes of self.arima
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", self.arima.ArResidualError.Current.Value)
                self.Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", self.arima.MaResidualError.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AutoRegressiveIntegratedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AutoRegressiveIntegratedMovingAverage _arima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _arima = new AutoRegressiveIntegratedMovingAverage(1, 1, 1, 20);
            RegisterIndicator(_symbol, _arima, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_arima.IsReady)
            {
                // The current value of _arima is represented by itself (_arima)
                // or _arima.Current.Value
                Plot("AutoRegressiveIntegratedMovingAverage", "arima", _arima);
                // Plot all properties of arima
                Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", _arima.ArResidualError);
                Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", _arima.MaResidualError);
            }
        }
    }
    class AutoRegressiveIntegratedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.arima = AutoRegressiveIntegratedMovingAverage(1, 1, 1, 20)
            self.RegisterIndicator(self.symbol, self.arima, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.arima.IsReady:
                # The current value of self.arima is represented by self.arima.Current.Value
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arima", self.arima.Current.Value)
                # Plot all attributes of self.arima
                self.Plot("AutoRegressiveIntegratedMovingAverage", "arresidualerror", self.arima.ArResidualError.Current.Value)
                self.Plot("AutoRegressiveIntegratedMovingAverage", "maresidualerror", self.arima.MaResidualError.Current.Value)
    

    The following reference table describes the AutoRegressiveIntegratedMovingAverage constructor:

    AutoRegressiveIntegratedMovingAverage() 1/2

                AutoRegressiveIntegratedMovingAverage QuantConnect.Indicators.AutoRegressiveIntegratedMovingAverage (
        string  name,
        int     arOrder,
        int     diffOrder,
        int     maOrder,
        int     period,
        *bool   intercept
       )
            

    This particular constructor fits the model by means of TwoStepFit for a specified name.

    AutoRegressiveIntegratedMovingAverage() 2/2

                AutoRegressiveIntegratedMovingAverage QuantConnect.Indicators.AutoRegressiveIntegratedMovingAverage (
        int   arOrder,
        int   diffOrder,
        int   maOrder,
        int   period,
        bool  intercept
       )
            

    This particular constructor fits the model by means of TwoStepFit using ordinary least squares.

    Visualization

    The following image shows plot values of selected properties of AutoRegressiveIntegratedMovingAverage using the plotly library.

    AutoRegressiveIntegratedMovingAverage line plot.

     

    13.1.14 Average Directional Index

    Introduction

    This indicator computes Average Directional Index which measures trend strength without regard to trend direction. Firstly, it calculates the Directional Movement and the True Range value, and then the values are accumulated and smoothed using a custom smoothing method proposed by Wilder. For an n period smoothing, 1/n of each period's value is added to the total period. From these accumulated values we are therefore able to derived the 'Positive Directional Index' (+DI) and 'Negative Directional Index' (-DI) which is used to calculate the Average Directional Index. Computation source: https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_directional_index_adx

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADX Indicator

    To create an automatic indicators for AverageDirectionalIndex , call the ADX helper method from the QCAlgorithm class. The ADX method creates a AverageDirectionalIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AverageDirectionalIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalIndex _adx;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adx = ADX("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_adx.IsReady)
            {
                // The current value of _adx is represented by itself (_adx)
                // or _adx.Current.Value
                Plot("AverageDirectionalIndex", "adx", _adx);
                // Plot all properties of adx
                Plot("AverageDirectionalIndex", "positivedirectionalindex", _adx.PositiveDirectionalIndex);
                Plot("AverageDirectionalIndex", "negativedirectionalindex", _adx.NegativeDirectionalIndex);
            }
        }
    }
    class AverageDirectionalIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adx = self.ADX("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.adx.IsReady:
                # The current value of self.adx is represented by self.adx.Current.Value
                self.Plot("AverageDirectionalIndex", "adx", self.adx.Current.Value)
                # Plot all attributes of self.adx
                self.Plot("AverageDirectionalIndex", "positivedirectionalindex", self.adx.PositiveDirectionalIndex.Current.Value)
                self.Plot("AverageDirectionalIndex", "negativedirectionalindex", self.adx.NegativeDirectionalIndex.Current.Value)
    

    The following reference table describes the ADX method:

    ADX() 1/1

                AverageDirectionalIndex QuantConnect.Algorithm.QCAlgorithm.ADX (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Average Directional Index indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AverageDirectionalIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class AverageDirectionalIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalIndex _adx;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adx = new AverageDirectionalIndex(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _adx.Update(bar);
            }
    
            if (_adx.IsReady)
            {
                // The current value of _adx is represented by itself (_adx)
                // or _adx.Current.Value
                Plot("AverageDirectionalIndex", "adx", _adx);
                // Plot all properties of adx
                Plot("AverageDirectionalIndex", "positivedirectionalindex", _adx.PositiveDirectionalIndex);
                Plot("AverageDirectionalIndex", "negativedirectionalindex", _adx.NegativeDirectionalIndex);
            }
        }
    }
    class AverageDirectionalIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adx = AverageDirectionalIndex(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.adx.Update(bar)
    
            if self.adx.IsReady:
                # The current value of self.adx is represented by self.adx.Current.Value
                self.Plot("AverageDirectionalIndex", "adx", self.adx.Current.Value)
                # Plot all attributes of self.adx
                self.Plot("AverageDirectionalIndex", "positivedirectionalindex", self.adx.PositiveDirectionalIndex.Current.Value)
                self.Plot("AverageDirectionalIndex", "negativedirectionalindex", self.adx.NegativeDirectionalIndex.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AverageDirectionalIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalIndex _adx;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adx = new AverageDirectionalIndex(20);
            RegisterIndicator(_symbol, _adx, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_adx.IsReady)
            {
                // The current value of _adx is represented by itself (_adx)
                // or _adx.Current.Value
                Plot("AverageDirectionalIndex", "adx", _adx);
                // Plot all properties of adx
                Plot("AverageDirectionalIndex", "positivedirectionalindex", _adx.PositiveDirectionalIndex);
                Plot("AverageDirectionalIndex", "negativedirectionalindex", _adx.NegativeDirectionalIndex);
            }
        }
    }
    class AverageDirectionalIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adx = AverageDirectionalIndex(20)
            self.RegisterIndicator(self.symbol, self.adx, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.adx.IsReady:
                # The current value of self.adx is represented by self.adx.Current.Value
                self.Plot("AverageDirectionalIndex", "adx", self.adx.Current.Value)
                # Plot all attributes of self.adx
                self.Plot("AverageDirectionalIndex", "positivedirectionalindex", self.adx.PositiveDirectionalIndex.Current.Value)
                self.Plot("AverageDirectionalIndex", "negativedirectionalindex", self.adx.NegativeDirectionalIndex.Current.Value)
    

    The following reference table describes the AverageDirectionalIndex constructor:

    AverageDirectionalIndex() 1/2

                AverageDirectionalIndex QuantConnect.Indicators.AverageDirectionalIndex (
        int  period
       )
            

    Initializes a new instance of the AverageDirectionalInde class.

    AverageDirectionalIndex() 2/2

                AverageDirectionalIndex QuantConnect.Indicators.AverageDirectionalIndex (
        string  name,
        int     period
       )
            

    Initializes a new instance of the AverageDirectionalInde class.

    Visualization

    The following image shows plot values of selected properties of AverageDirectionalIndex using the plotly library.

    AverageDirectionalIndex line plot.

     

    13.1.15 Average Directional Movement Index Rating

    Introduction

    This indicator computes the Average Directional Movement Index Rating (ADXR). The Average Directional Movement Index Rating is calculated with the following formula: ADXR[i] = (ADX[i] + ADX[i - period + 1]) / 2

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ADXR Indicator

    To create an automatic indicators for AverageDirectionalMovementIndexRating , call the ADXR helper method from the QCAlgorithm class. The ADXR method creates a AverageDirectionalMovementIndexRating object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AverageDirectionalMovementIndexRatingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalMovementIndexRating _adxr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adxr = ADXR("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_adxr.IsReady)
            {
                // The current value of _adxr is represented by itself (_adxr)
                // or _adxr.Current.Value
                Plot("AverageDirectionalMovementIndexRating", "adxr", _adxr);
                // Plot all properties of adxr
                Plot("AverageDirectionalMovementIndexRating", "adx", _adxr.ADX);
            }
        }
    }
    class AverageDirectionalMovementIndexRatingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adxr = self.ADXR("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.adxr.IsReady:
                # The current value of self.adxr is represented by self.adxr.Current.Value
                self.Plot("AverageDirectionalMovementIndexRating", "adxr", self.adxr.Current.Value)
                # Plot all attributes of self.adxr
                self.Plot("AverageDirectionalMovementIndexRating", "adx", self.adxr.ADX.Current.Value)
    

    The following reference table describes the ADXR method:

    ADXR() 1/1

                AverageDirectionalMovementIndexRating QuantConnect.Algorithm.QCAlgorithm.ADXR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AverageDirectionalMovementIndexRating indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AverageDirectionalMovementIndexRating indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class AverageDirectionalMovementIndexRatingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalMovementIndexRating _adxr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adxr = new AverageDirectionalMovementIndexRating(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _adxr.Update(bar);
            }
    
            if (_adxr.IsReady)
            {
                // The current value of _adxr is represented by itself (_adxr)
                // or _adxr.Current.Value
                Plot("AverageDirectionalMovementIndexRating", "adxr", _adxr);
                // Plot all properties of adxr
                Plot("AverageDirectionalMovementIndexRating", "adx", _adxr.ADX);
            }
        }
    }
    class AverageDirectionalMovementIndexRatingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adxr = AverageDirectionalMovementIndexRating(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.adxr.Update(bar)
    
            if self.adxr.IsReady:
                # The current value of self.adxr is represented by self.adxr.Current.Value
                self.Plot("AverageDirectionalMovementIndexRating", "adxr", self.adxr.Current.Value)
                # Plot all attributes of self.adxr
                self.Plot("AverageDirectionalMovementIndexRating", "adx", self.adxr.ADX.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AverageDirectionalMovementIndexRatingAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageDirectionalMovementIndexRating _adxr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _adxr = new AverageDirectionalMovementIndexRating(20);
            RegisterIndicator(_symbol, _adxr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_adxr.IsReady)
            {
                // The current value of _adxr is represented by itself (_adxr)
                // or _adxr.Current.Value
                Plot("AverageDirectionalMovementIndexRating", "adxr", _adxr);
                // Plot all properties of adxr
                Plot("AverageDirectionalMovementIndexRating", "adx", _adxr.ADX);
            }
        }
    }
    class AverageDirectionalMovementIndexRatingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.adxr = AverageDirectionalMovementIndexRating(20)
            self.RegisterIndicator(self.symbol, self.adxr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.adxr.IsReady:
                # The current value of self.adxr is represented by self.adxr.Current.Value
                self.Plot("AverageDirectionalMovementIndexRating", "adxr", self.adxr.Current.Value)
                # Plot all attributes of self.adxr
                self.Plot("AverageDirectionalMovementIndexRating", "adx", self.adxr.ADX.Current.Value)
    

    The following reference table describes the AverageDirectionalMovementIndexRating constructor:

    AverageDirectionalMovementIndexRating() 1/2

                AverageDirectionalMovementIndexRating QuantConnect.Indicators.AverageDirectionalMovementIndexRating (
        string  name,
        int     period
       )
            

    Initializes a new instance of the AverageDirectionalMovementIndexRatin class using the specified name and period.

    AverageDirectionalMovementIndexRating() 2/2

                AverageDirectionalMovementIndexRating QuantConnect.Indicators.AverageDirectionalMovementIndexRating (
        int  period
       )
            

    Initializes a new instance of the AverageDirectionalMovementIndexRatin class using the specified period.

    Visualization

    The following image shows plot values of selected properties of AverageDirectionalMovementIndexRating using the plotly library.

    AverageDirectionalMovementIndexRating line plot.

     

    13.1.16 Average True Range

    Introduction

    The AverageTrueRange indicator is a measure of volatility introduced by Welles Wilder in his book: New Concepts in Technical Trading Systems. This indicator computes the TrueRange and then smoothes the TrueRange over a given period. TrueRange is defined as the maximum of the following: High - Low ABS(High - PreviousClose) ABS(Low - PreviousClose)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ATR Indicator

    To create an automatic indicators for AverageTrueRange , call the ATR helper method from the QCAlgorithm class. The ATR method creates a AverageTrueRange object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageTrueRange _atr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _atr = ATR("SPY", 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_atr.IsReady)
            {
                // The current value of _atr is represented by itself (_atr)
                // or _atr.Current.Value
                Plot("AverageTrueRange", "atr", _atr);
                // Plot all properties of atr
                Plot("AverageTrueRange", "truerange", _atr.TrueRange);
            }
        }
    }
    class AverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.atr = self.ATR("SPY", 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.atr.IsReady:
                # The current value of self.atr is represented by self.atr.Current.Value
                self.Plot("AverageTrueRange", "atr", self.atr.Current.Value)
                # Plot all attributes of self.atr
                self.Plot("AverageTrueRange", "truerange", self.atr.TrueRange.Current.Value)
    

    The following reference table describes the ATR method:

    ATR() 1/1

                AverageTrueRange QuantConnect.Algorithm.QCAlgorithm.ATR (
        Symbol                                symbol,
        Int32                                 period,
        *MovingAverageType                    type,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AverageTrueRange indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a AverageTrueRange indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class AverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageTrueRange _atr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _atr = new AverageTrueRange(20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _atr.Update(bar);
            }
    
            if (_atr.IsReady)
            {
                // The current value of _atr is represented by itself (_atr)
                // or _atr.Current.Value
                Plot("AverageTrueRange", "atr", _atr);
                // Plot all properties of atr
                Plot("AverageTrueRange", "truerange", _atr.TrueRange);
            }
        }
    }
    class AverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.atr = AverageTrueRange(20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.atr.Update(bar)
    
            if self.atr.IsReady:
                # The current value of self.atr is represented by self.atr.Current.Value
                self.Plot("AverageTrueRange", "atr", self.atr.Current.Value)
                # Plot all attributes of self.atr
                self.Plot("AverageTrueRange", "truerange", self.atr.TrueRange.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AverageTrueRange _atr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _atr = new AverageTrueRange(20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _atr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_atr.IsReady)
            {
                // The current value of _atr is represented by itself (_atr)
                // or _atr.Current.Value
                Plot("AverageTrueRange", "atr", _atr);
                // Plot all properties of atr
                Plot("AverageTrueRange", "truerange", _atr.TrueRange);
            }
        }
    }
    class AverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.atr = AverageTrueRange(20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.atr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.atr.IsReady:
                # The current value of self.atr is represented by self.atr.Current.Value
                self.Plot("AverageTrueRange", "atr", self.atr.Current.Value)
                # Plot all attributes of self.atr
                self.Plot("AverageTrueRange", "truerange", self.atr.TrueRange.Current.Value)
    

    The following reference table describes the AverageTrueRange constructor:

    AverageTrueRange() 1/2

                AverageTrueRange QuantConnect.Indicators.AverageTrueRange (
        string              name,
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Creates a new AverageTrueRange indicator using the specified period and moving average type.

    AverageTrueRange() 2/2

                AverageTrueRange QuantConnect.Indicators.AverageTrueRange (
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Creates a new AverageTrueRange indicator using the specified period and moving average type.

    Visualization

    The following image shows plot values of selected properties of AverageTrueRange using the plotly library.

    AverageTrueRange line plot.

     

    13.1.17 Awesome Oscillator

    Introduction

    The Awesome Oscillator Indicator tracks the price midpoint-movement of a security. Specifically, AO = MAfast[(H+L)/2] - MAslow[(H+L)/2] where MAfast and MAslow denote simple moving averages wherein fast has a shorter period. https://www.barchart.com/education/technical-indicators/awesome_oscillator

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using AO Indicator

    To create an automatic indicators for AwesomeOscillator , call the AO helper method from the QCAlgorithm class. The AO method creates a AwesomeOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class AwesomeOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AwesomeOscillator _ao;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ao = AO("SPY", 10, 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_ao.IsReady)
            {
                // The current value of _ao is represented by itself (_ao)
                // or _ao.Current.Value
                Plot("AwesomeOscillator", "ao", _ao);
                // Plot all properties of ao
                Plot("AwesomeOscillator", "slowao", _ao.SlowAo);
                Plot("AwesomeOscillator", "fastao", _ao.FastAo);
            }
        }
    }
    class AwesomeOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ao = self.AO("SPY", 10, 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.ao.IsReady:
                # The current value of self.ao is represented by self.ao.Current.Value
                self.Plot("AwesomeOscillator", "ao", self.ao.Current.Value)
                # Plot all attributes of self.ao
                self.Plot("AwesomeOscillator", "slowao", self.ao.SlowAo.Current.Value)
                self.Plot("AwesomeOscillator", "fastao", self.ao.FastAo.Current.Value)
    

    The following reference table describes the AO method:

    AO() 1/1

                AwesomeOscillator QuantConnect.Algorithm.QCAlgorithm.AO (
        Symbol                                symbol,
        Int32                                 slowPeriod,
        Int32                                 fastPeriod,
        MovingAverageType                     type,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Awesome Oscillator from the specified periods.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a AwesomeOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class AwesomeOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AwesomeOscillator _ao;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ao = new AwesomeOscillator(10, 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ao.Update(bar);
            }
    
            if (_ao.IsReady)
            {
                // The current value of _ao is represented by itself (_ao)
                // or _ao.Current.Value
                Plot("AwesomeOscillator", "ao", _ao);
                // Plot all properties of ao
                Plot("AwesomeOscillator", "slowao", _ao.SlowAo);
                Plot("AwesomeOscillator", "fastao", _ao.FastAo);
            }
        }
    }
    class AwesomeOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ao = AwesomeOscillator(10, 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ao.Update(bar)
    
            if self.ao.IsReady:
                # The current value of self.ao is represented by self.ao.Current.Value
                self.Plot("AwesomeOscillator", "ao", self.ao.Current.Value)
                # Plot all attributes of self.ao
                self.Plot("AwesomeOscillator", "slowao", self.ao.SlowAo.Current.Value)
                self.Plot("AwesomeOscillator", "fastao", self.ao.FastAo.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class AwesomeOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private AwesomeOscillator _ao;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ao = new AwesomeOscillator(10, 20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _ao, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ao.IsReady)
            {
                // The current value of _ao is represented by itself (_ao)
                // or _ao.Current.Value
                Plot("AwesomeOscillator", "ao", _ao);
                // Plot all properties of ao
                Plot("AwesomeOscillator", "slowao", _ao.SlowAo);
                Plot("AwesomeOscillator", "fastao", _ao.FastAo);
            }
        }
    }
    class AwesomeOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ao = AwesomeOscillator(10, 20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.ao, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ao.IsReady:
                # The current value of self.ao is represented by self.ao.Current.Value
                self.Plot("AwesomeOscillator", "ao", self.ao.Current.Value)
                # Plot all attributes of self.ao
                self.Plot("AwesomeOscillator", "slowao", self.ao.SlowAo.Current.Value)
                self.Plot("AwesomeOscillator", "fastao", self.ao.FastAo.Current.Value)
    

    The following reference table describes the AwesomeOscillator constructor:

    AwesomeOscillator() 1/2

                AwesomeOscillator QuantConnect.Indicators.AwesomeOscillator (
        int  fastPeriod,
        int  slowPeriod
       )
            

    Creates a new Awesome Oscillator from the specified periods.

    AwesomeOscillator() 2/2

                AwesomeOscillator QuantConnect.Indicators.AwesomeOscillator (
        string  name,
        int     fastPeriod,
        int     slowPeriod
       )
            

    Creates a new Awesome Oscillator from the specified periods.

    Visualization

    The following image shows plot values of selected properties of AwesomeOscillator using the plotly library.

    AwesomeOscillator line plot.

     

    13.1.18 Balance Of Power

    Introduction

    This indicator computes the Balance Of Power (BOP). The Balance Of Power is calculated with the following formula: BOP = (Close - Open) / (High - Low)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using BOP Indicator

    To create an automatic indicators for BalanceOfPower , call the BOP helper method from the QCAlgorithm class. The BOP method creates a BalanceOfPower object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class BalanceOfPowerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BalanceOfPower _bop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bop = BOP("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_bop.IsReady)
            {
                // The current value of _bop is represented by itself (_bop)
                // or _bop.Current.Value
                Plot("BalanceOfPower", "bop", _bop);
                
            }
        }
    }
    class BalanceOfPowerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bop = self.BOP("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.bop.IsReady:
                # The current value of self.bop is represented by self.bop.Current.Value
                self.Plot("BalanceOfPower", "bop", self.bop.Current.Value)
                
    

    The following reference table describes the BOP method:

    BOP() 1/1

                BalanceOfPower QuantConnect.Algorithm.QCAlgorithm.BOP (
        Symbol                                symbol,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Balance Of Power indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a BalanceOfPower indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class BalanceOfPowerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BalanceOfPower _bop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bop = new BalanceOfPower("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _bop.Update(bar);
            }
    
            if (_bop.IsReady)
            {
                // The current value of _bop is represented by itself (_bop)
                // or _bop.Current.Value
                Plot("BalanceOfPower", "bop", _bop);
                
            }
        }
    }
    class BalanceOfPowerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bop = BalanceOfPower("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.bop.Update(bar)
    
            if self.bop.IsReady:
                # The current value of self.bop is represented by self.bop.Current.Value
                self.Plot("BalanceOfPower", "bop", self.bop.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class BalanceOfPowerAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BalanceOfPower _bop;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bop = new BalanceOfPower("SPY");
            RegisterIndicator(_symbol, _bop, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_bop.IsReady)
            {
                // The current value of _bop is represented by itself (_bop)
                // or _bop.Current.Value
                Plot("BalanceOfPower", "bop", _bop);
                
            }
        }
    }
    class BalanceOfPowerAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bop = BalanceOfPower("SPY")
            self.RegisterIndicator(self.symbol, self.bop, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.bop.IsReady:
                # The current value of self.bop is represented by self.bop.Current.Value
                self.Plot("BalanceOfPower", "bop", self.bop.Current.Value)
                
    

    The following reference table describes the BalanceOfPower constructor:

    BalanceOfPower() 1/2

                BalanceOfPower QuantConnect.Indicators.BalanceOfPower (
        
       )
            

    Initializes a new instance of the BalanceOfPowe class using the specified name.

    BalanceOfPower() 2/2

                BalanceOfPower QuantConnect.Indicators.BalanceOfPower (
        string  name
       )
            

    Initializes a new instance of the BalanceOfPowe class using the specified name.

    Visualization

    The following image shows plot values of selected properties of BalanceOfPower using the plotly library.

    BalanceOfPower line plot.

     

    13.1.19 Beta

    Introduction

    In technical analysis Beta indicator is used to measure volatility or risk of a target (ETF) relative to the overall risk (volatility) of the reference (market indexes). The Beta indicators compares target's price movement to the movements of the indexes over the same period of time. It is common practice to use the SPX index as a benchmark of the overall reference market when it comes to Beta calculations.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using B Indicator

    To create an automatic indicators for Beta , call the B helper method from the QCAlgorithm class. The B method creates a Beta object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class BetaAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Beta _b;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _b = B("QQQ", "SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_b.IsReady)
            {
                // The current value of _b is represented by itself (_b)
                // or _b.Current.Value
                Plot("Beta", "b", _b);
                
            }
        }
    }
    class BetaAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.b = self.B("QQQ", "SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.b.IsReady:
                # The current value of self.b is represented by self.b.Current.Value
                self.Plot("Beta", "b", self.b.Current.Value)
                
    

    The following reference table describes the B method:

    B() 1/1

                Beta QuantConnect.Algorithm.QCAlgorithm.B (
        Symbol                            target,
        Symbol                            reference,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Beta indicator for the given target symbol in relation with the reference used. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Beta indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class BetaAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Beta _b;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _b = new Beta("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _b.Update(bar);
            }
    
            if (_b.IsReady)
            {
                // The current value of _b is represented by itself (_b)
                // or _b.Current.Value
                Plot("Beta", "b", _b);
                
            }
        }
    }
    class BetaAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.b = Beta("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.b.Update(bar)
    
            if self.b.IsReady:
                # The current value of self.b is represented by self.b.Current.Value
                self.Plot("Beta", "b", self.b.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class BetaAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Beta _b;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _b = new Beta("SPY", 20);
            RegisterIndicator(_symbol, _b, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_b.IsReady)
            {
                // The current value of _b is represented by itself (_b)
                // or _b.Current.Value
                Plot("Beta", "b", _b);
                
            }
        }
    }
    class BetaAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.b = Beta("SPY", 20)
            self.RegisterIndicator(self.symbol, self.b, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.b.IsReady:
                # The current value of self.b is represented by self.b.Current.Value
                self.Plot("Beta", "b", self.b.Current.Value)
                
    

    The following reference table describes the Beta constructor:

    Beta() 1/1

                Beta QuantConnect.Indicators.Beta (
        string  name,
        int     period,
        Symbol  targetSymbol,
        Symbol  referenceSymbol
       )
            

    reference values.

    Visualization

    The following image shows plot values of selected properties of Beta using the plotly library.

    Beta line plot.

     

    13.1.20 Bollinger Bands

    Introduction

    This indicator creates a moving average (middle band) with an upper band and lower band fixed at k standard deviations above and below the moving average.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using BB Indicator

    To create an automatic indicators for BollingerBands , call the BB helper method from the QCAlgorithm class. The BB method creates a BollingerBands object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class BollingerBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BollingerBands _bb;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bb = BB("SPY", 30, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (_bb.IsReady)
            {
                // The current value of _bb is represented by itself (_bb)
                // or _bb.Current.Value
                Plot("BollingerBands", "bb", _bb);
                // Plot all properties of bb
                Plot("BollingerBands", "standarddeviation", _bb.StandardDeviation);
                Plot("BollingerBands", "middleband", _bb.MiddleBand);
                Plot("BollingerBands", "upperband", _bb.UpperBand);
                Plot("BollingerBands", "lowerband", _bb.LowerBand);
                Plot("BollingerBands", "bandwidth", _bb.BandWidth);
                Plot("BollingerBands", "percentb", _bb.PercentB);
                Plot("BollingerBands", "price", _bb.Price);
            }
        }
    }
    class BollingerBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bb = self.BB("SPY", 30, 2)
    
        def OnData(self, slice: Slice) -> None:
            if self.bb.IsReady:
                # The current value of self.bb is represented by self.bb.Current.Value
                self.Plot("BollingerBands", "bb", self.bb.Current.Value)
                # Plot all attributes of self.bb
                self.Plot("BollingerBands", "standarddeviation", self.bb.StandardDeviation.Current.Value)
                self.Plot("BollingerBands", "middleband", self.bb.MiddleBand.Current.Value)
                self.Plot("BollingerBands", "upperband", self.bb.UpperBand.Current.Value)
                self.Plot("BollingerBands", "lowerband", self.bb.LowerBand.Current.Value)
                self.Plot("BollingerBands", "bandwidth", self.bb.BandWidth.Current.Value)
                self.Plot("BollingerBands", "percentb", self.bb.PercentB.Current.Value)
                self.Plot("BollingerBands", "price", self.bb.Price.Current.Value)
    

    The following reference table describes the BB method:

    BB() 1/1

                BollingerBands QuantConnect.Algorithm.QCAlgorithm.BB (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          k,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new BollingerBands indicator which will compute the MiddleBand, UpperBand, LowerBand, and StandardDeviation.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a BollingerBands indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class BollingerBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BollingerBands _bb;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bb = new BollingerBands(30, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _bb.Update(bar.EndTime, bar.Close);
            }
    
            if (_bb.IsReady)
            {
                // The current value of _bb is represented by itself (_bb)
                // or _bb.Current.Value
                Plot("BollingerBands", "bb", _bb);
                // Plot all properties of bb
                Plot("BollingerBands", "standarddeviation", _bb.StandardDeviation);
                Plot("BollingerBands", "middleband", _bb.MiddleBand);
                Plot("BollingerBands", "upperband", _bb.UpperBand);
                Plot("BollingerBands", "lowerband", _bb.LowerBand);
                Plot("BollingerBands", "bandwidth", _bb.BandWidth);
                Plot("BollingerBands", "percentb", _bb.PercentB);
                Plot("BollingerBands", "price", _bb.Price);
            }
        }
    }
    class BollingerBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bb = BollingerBands(30, 2)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.bb.Update(bar.EndTime, bar.Close)
    
            if self.bb.IsReady:
                # The current value of self.bb is represented by self.bb.Current.Value
                self.Plot("BollingerBands", "bb", self.bb.Current.Value)
                # Plot all attributes of self.bb
                self.Plot("BollingerBands", "standarddeviation", self.bb.StandardDeviation.Current.Value)
                self.Plot("BollingerBands", "middleband", self.bb.MiddleBand.Current.Value)
                self.Plot("BollingerBands", "upperband", self.bb.UpperBand.Current.Value)
                self.Plot("BollingerBands", "lowerband", self.bb.LowerBand.Current.Value)
                self.Plot("BollingerBands", "bandwidth", self.bb.BandWidth.Current.Value)
                self.Plot("BollingerBands", "percentb", self.bb.PercentB.Current.Value)
                self.Plot("BollingerBands", "price", self.bb.Price.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class BollingerBandsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private BollingerBands _bb;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _bb = new BollingerBands(30, 2);
            RegisterIndicator(_symbol, _bb, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_bb.IsReady)
            {
                // The current value of _bb is represented by itself (_bb)
                // or _bb.Current.Value
                Plot("BollingerBands", "bb", _bb);
                // Plot all properties of bb
                Plot("BollingerBands", "standarddeviation", _bb.StandardDeviation);
                Plot("BollingerBands", "middleband", _bb.MiddleBand);
                Plot("BollingerBands", "upperband", _bb.UpperBand);
                Plot("BollingerBands", "lowerband", _bb.LowerBand);
                Plot("BollingerBands", "bandwidth", _bb.BandWidth);
                Plot("BollingerBands", "percentb", _bb.PercentB);
                Plot("BollingerBands", "price", _bb.Price);
            }
        }
    }
    class BollingerBandsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.bb = BollingerBands(30, 2)
            self.RegisterIndicator(self.symbol, self.bb, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.bb.IsReady:
                # The current value of self.bb is represented by self.bb.Current.Value
                self.Plot("BollingerBands", "bb", self.bb.Current.Value)
                # Plot all attributes of self.bb
                self.Plot("BollingerBands", "standarddeviation", self.bb.StandardDeviation.Current.Value)
                self.Plot("BollingerBands", "middleband", self.bb.MiddleBand.Current.Value)
                self.Plot("BollingerBands", "upperband", self.bb.UpperBand.Current.Value)
                self.Plot("BollingerBands", "lowerband", self.bb.LowerBand.Current.Value)
                self.Plot("BollingerBands", "bandwidth", self.bb.BandWidth.Current.Value)
                self.Plot("BollingerBands", "percentb", self.bb.PercentB.Current.Value)
                self.Plot("BollingerBands", "price", self.bb.Price.Current.Value)
    

    The following reference table describes the BollingerBands constructor:

    BollingerBands() 1/2

                BollingerBands QuantConnect.Indicators.BollingerBands (
        int                 period,
        decimal             k,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the BollingerBands class.

    BollingerBands() 2/2

                BollingerBands QuantConnect.Indicators.BollingerBands (
        string              name,
        int                 period,
        decimal             k,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the BollingerBands class.

    Visualization

    The following image shows plot values of selected properties of BollingerBands using the plotly library.

    BollingerBands line plot.

     

    13.1.21 Chaikin Money Flow

    Introduction

    The Chaikin Money Flow Index (CMF) is a volume-weighted average of accumulation and distribution over a specified period. CMF = n-day Sum of [(((C - L) - (H - C)) / (H - L)) x Vol] / n-day Sum of Vol Where: n = number of periods, typically 21 H = high L = low C = close Vol = volume https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/cmf

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using CMF Indicator

    To create an automatic indicators for ChaikinMoneyFlow , call the CMF helper method from the QCAlgorithm class. The CMF method creates a ChaikinMoneyFlow object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ChaikinMoneyFlowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChaikinMoneyFlow _cmf;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmf = CMF("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_cmf.IsReady)
            {
                // The current value of _cmf is represented by itself (_cmf)
                // or _cmf.Current.Value
                Plot("ChaikinMoneyFlow", "cmf", _cmf);
                
            }
        }
    }
    class ChaikinMoneyFlowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmf = self.CMF("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.cmf.IsReady:
                # The current value of self.cmf is represented by self.cmf.Current.Value
                self.Plot("ChaikinMoneyFlow", "cmf", self.cmf.Current.Value)
                
    

    The following reference table describes the CMF method:

    CMF() 1/1

                ChaikinMoneyFlow QuantConnect.Algorithm.QCAlgorithm.CMF (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ChaikinMoneyFlow indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ChaikinMoneyFlow indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class ChaikinMoneyFlowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChaikinMoneyFlow _cmf;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmf = new ChaikinMoneyFlow(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _cmf.Update(bar);
            }
    
            if (_cmf.IsReady)
            {
                // The current value of _cmf is represented by itself (_cmf)
                // or _cmf.Current.Value
                Plot("ChaikinMoneyFlow", "cmf", _cmf);
                
            }
        }
    }
    class ChaikinMoneyFlowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmf = ChaikinMoneyFlow(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.cmf.Update(bar)
    
            if self.cmf.IsReady:
                # The current value of self.cmf is represented by self.cmf.Current.Value
                self.Plot("ChaikinMoneyFlow", "cmf", self.cmf.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ChaikinMoneyFlowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChaikinMoneyFlow _cmf;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmf = new ChaikinMoneyFlow(20);
            RegisterIndicator(_symbol, _cmf, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_cmf.IsReady)
            {
                // The current value of _cmf is represented by itself (_cmf)
                // or _cmf.Current.Value
                Plot("ChaikinMoneyFlow", "cmf", _cmf);
                
            }
        }
    }
    class ChaikinMoneyFlowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmf = ChaikinMoneyFlow(20)
            self.RegisterIndicator(self.symbol, self.cmf, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.cmf.IsReady:
                # The current value of self.cmf is represented by self.cmf.Current.Value
                self.Plot("ChaikinMoneyFlow", "cmf", self.cmf.Current.Value)
                
    

    The following reference table describes the ChaikinMoneyFlow constructor:

    ChaikinMoneyFlow() 1/1

                ChaikinMoneyFlow QuantConnect.Indicators.ChaikinMoneyFlow (
        string  name,
        int     period
       )
            

    Initializes a new instance of the ChaikinMoneyFlow class.

    Visualization

    The following image shows plot values of selected properties of ChaikinMoneyFlow using the plotly library.

    ChaikinMoneyFlow line plot.

     

    13.1.22 Chande Momentum Oscillator

    Introduction

    This indicator computes the Chande Momentum Oscillator (CMO). CMO calculation is mostly identical to RSI. The only difference is in the last step of calculation: RSI = gain / (gain+loss) CMO = (gain-loss) / (gain+loss)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using CMO Indicator

    To create an automatic indicators for ChandeMomentumOscillator , call the CMO helper method from the QCAlgorithm class. The CMO method creates a ChandeMomentumOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ChandeMomentumOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChandeMomentumOscillator _cmo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmo = CMO("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_cmo.IsReady)
            {
                // The current value of _cmo is represented by itself (_cmo)
                // or _cmo.Current.Value
                Plot("ChandeMomentumOscillator", "cmo", _cmo);
                
            }
        }
    }
    class ChandeMomentumOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmo = self.CMO("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.cmo.IsReady:
                # The current value of self.cmo is represented by self.cmo.Current.Value
                self.Plot("ChandeMomentumOscillator", "cmo", self.cmo.Current.Value)
                
    

    The following reference table describes the CMO method:

    CMO() 1/1

                ChandeMomentumOscillator QuantConnect.Algorithm.QCAlgorithm.CMO (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ChandeMomentumOscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ChandeMomentumOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class ChandeMomentumOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChandeMomentumOscillator _cmo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmo = new ChandeMomentumOscillator(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _cmo.Update(bar.EndTime, bar.Close);
            }
    
            if (_cmo.IsReady)
            {
                // The current value of _cmo is represented by itself (_cmo)
                // or _cmo.Current.Value
                Plot("ChandeMomentumOscillator", "cmo", _cmo);
                
            }
        }
    }
    class ChandeMomentumOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmo = ChandeMomentumOscillator(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.cmo.Update(bar.EndTime, bar.Close)
    
            if self.cmo.IsReady:
                # The current value of self.cmo is represented by self.cmo.Current.Value
                self.Plot("ChandeMomentumOscillator", "cmo", self.cmo.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ChandeMomentumOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ChandeMomentumOscillator _cmo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cmo = new ChandeMomentumOscillator(20);
            RegisterIndicator(_symbol, _cmo, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_cmo.IsReady)
            {
                // The current value of _cmo is represented by itself (_cmo)
                // or _cmo.Current.Value
                Plot("ChandeMomentumOscillator", "cmo", _cmo);
                
            }
        }
    }
    class ChandeMomentumOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cmo = ChandeMomentumOscillator(20)
            self.RegisterIndicator(self.symbol, self.cmo, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.cmo.IsReady:
                # The current value of self.cmo is represented by self.cmo.Current.Value
                self.Plot("ChandeMomentumOscillator", "cmo", self.cmo.Current.Value)
                
    

    The following reference table describes the ChandeMomentumOscillator constructor:

    ChandeMomentumOscillator() 1/2

                ChandeMomentumOscillator QuantConnect.Indicators.ChandeMomentumOscillator (
        int  period
       )
            

    Initializes a new instance of the ChandeMomentumOscillato class using the specified period.

    ChandeMomentumOscillator() 2/2

                ChandeMomentumOscillator QuantConnect.Indicators.ChandeMomentumOscillator (
        string  name,
        int     period
       )
            

    Initializes a new instance of the ChandeMomentumOscillato class using the specified name and period.

    Visualization

    The following image shows plot values of selected properties of ChandeMomentumOscillator using the plotly library.

    ChandeMomentumOscillator line plot.

     

    13.1.23 Commodity Channel Index

    Introduction

    This indicator represents the traditional commodity channel index (CCI) CCI = (Typical Price - 20-period SMA of TP) / (.015 * Mean Deviation) Typical Price (TP) = (High + Low + Close)/3 Constant = 0.015 There are four steps to calculating the Mean Deviation, first, subtract the most recent 20-period average of the typical price from each period's typical price. Second, take the absolute values of these numbers. Third, sum the absolute values. Fourth, divide by the total number of periods (20).

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using CCI Indicator

    To create an automatic indicators for CommodityChannelIndex , call the CCI helper method from the QCAlgorithm class. The CCI method creates a CommodityChannelIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class CommodityChannelIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CommodityChannelIndex _cci;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cci = CCI("SPY", 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_cci.IsReady)
            {
                // The current value of _cci is represented by itself (_cci)
                // or _cci.Current.Value
                Plot("CommodityChannelIndex", "cci", _cci);
                // Plot all properties of cci
                Plot("CommodityChannelIndex", "typicalpriceaverage", _cci.TypicalPriceAverage);
                Plot("CommodityChannelIndex", "typicalpricemeandeviation", _cci.TypicalPriceMeanDeviation);
            }
        }
    }
    class CommodityChannelIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cci = self.CCI("SPY", 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.cci.IsReady:
                # The current value of self.cci is represented by self.cci.Current.Value
                self.Plot("CommodityChannelIndex", "cci", self.cci.Current.Value)
                # Plot all attributes of self.cci
                self.Plot("CommodityChannelIndex", "typicalpriceaverage", self.cci.TypicalPriceAverage.Current.Value)
                self.Plot("CommodityChannelIndex", "typicalpricemeandeviation", self.cci.TypicalPriceMeanDeviation.Current.Value)
    

    The following reference table describes the CCI method:

    CCI() 1/1

                CommodityChannelIndex QuantConnect.Algorithm.QCAlgorithm.CCI (
        Symbol                                symbol,
        Int32                                 period,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new CommodityChannelIndex indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a CommodityChannelIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class CommodityChannelIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CommodityChannelIndex _cci;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cci = new CommodityChannelIndex(20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _cci.Update(bar);
            }
    
            if (_cci.IsReady)
            {
                // The current value of _cci is represented by itself (_cci)
                // or _cci.Current.Value
                Plot("CommodityChannelIndex", "cci", _cci);
                // Plot all properties of cci
                Plot("CommodityChannelIndex", "typicalpriceaverage", _cci.TypicalPriceAverage);
                Plot("CommodityChannelIndex", "typicalpricemeandeviation", _cci.TypicalPriceMeanDeviation);
            }
        }
    }
    class CommodityChannelIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cci = CommodityChannelIndex(20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.cci.Update(bar)
    
            if self.cci.IsReady:
                # The current value of self.cci is represented by self.cci.Current.Value
                self.Plot("CommodityChannelIndex", "cci", self.cci.Current.Value)
                # Plot all attributes of self.cci
                self.Plot("CommodityChannelIndex", "typicalpriceaverage", self.cci.TypicalPriceAverage.Current.Value)
                self.Plot("CommodityChannelIndex", "typicalpricemeandeviation", self.cci.TypicalPriceMeanDeviation.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class CommodityChannelIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CommodityChannelIndex _cci;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cci = new CommodityChannelIndex(20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _cci, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_cci.IsReady)
            {
                // The current value of _cci is represented by itself (_cci)
                // or _cci.Current.Value
                Plot("CommodityChannelIndex", "cci", _cci);
                // Plot all properties of cci
                Plot("CommodityChannelIndex", "typicalpriceaverage", _cci.TypicalPriceAverage);
                Plot("CommodityChannelIndex", "typicalpricemeandeviation", _cci.TypicalPriceMeanDeviation);
            }
        }
    }
    class CommodityChannelIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cci = CommodityChannelIndex(20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.cci, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.cci.IsReady:
                # The current value of self.cci is represented by self.cci.Current.Value
                self.Plot("CommodityChannelIndex", "cci", self.cci.Current.Value)
                # Plot all attributes of self.cci
                self.Plot("CommodityChannelIndex", "typicalpriceaverage", self.cci.TypicalPriceAverage.Current.Value)
                self.Plot("CommodityChannelIndex", "typicalpricemeandeviation", self.cci.TypicalPriceMeanDeviation.Current.Value)
    

    The following reference table describes the CommodityChannelIndex constructor:

    CommodityChannelIndex() 1/2

                CommodityChannelIndex QuantConnect.Indicators.CommodityChannelIndex (
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the CommodityChannelIndex class.

    CommodityChannelIndex() 2/2

                CommodityChannelIndex QuantConnect.Indicators.CommodityChannelIndex (
        string              name,
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the CommodityChannelIndex class.

    Visualization

    The following image shows plot values of selected properties of CommodityChannelIndex using the plotly library.

    CommodityChannelIndex line plot.

     

    13.1.24 Coppock Curve

    Introduction

    A momentum indicator developed by Edwin “Sedge” Coppock in October 1965. The goal of this indicator is to identify long-term buying opportunities in the S&P500 and Dow Industrials. source

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using CC Indicator

    To create an automatic indicators for CoppockCurve , call the CC helper method from the QCAlgorithm class. The CC method creates a CoppockCurve object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class CoppockCurveAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CoppockCurve _cc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cc = CC("SPY", 11, 14, 10);
        }
    
        public override void OnData(Slice data)
        {
            if (_cc.IsReady)
            {
                // The current value of _cc is represented by itself (_cc)
                // or _cc.Current.Value
                Plot("CoppockCurve", "cc", _cc);
                
            }
        }
    }
    class CoppockCurveAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cc = self.CC("SPY", 11, 14, 10)
    
        def OnData(self, slice: Slice) -> None:
            if self.cc.IsReady:
                # The current value of self.cc is represented by self.cc.Current.Value
                self.Plot("CoppockCurve", "cc", self.cc.Current.Value)
                
    

    The following reference table describes the CC method:

    CC() 1/1

                CoppockCurve QuantConnect.Algorithm.QCAlgorithm.CC (
        Symbol                           symbol,
        *Int32                           shortRocPeriod,
        *Int32                           longRocPeriod,
        *Int32                           lwmaPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Initializes a new instance of the CoppockCurve" indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a CoppockCurve indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class CoppockCurveAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CoppockCurve _cc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cc = new CoppockCurve(11, 14, 10);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _cc.Update(bar.EndTime, bar.Close);
            }
    
            if (_cc.IsReady)
            {
                // The current value of _cc is represented by itself (_cc)
                // or _cc.Current.Value
                Plot("CoppockCurve", "cc", _cc);
                
            }
        }
    }
    class CoppockCurveAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cc = CoppockCurve(11, 14, 10)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.cc.Update(bar.EndTime, bar.Close)
    
            if self.cc.IsReady:
                # The current value of self.cc is represented by self.cc.Current.Value
                self.Plot("CoppockCurve", "cc", self.cc.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class CoppockCurveAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private CoppockCurve _cc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _cc = new CoppockCurve(11, 14, 10);
            RegisterIndicator(_symbol, _cc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_cc.IsReady)
            {
                // The current value of _cc is represented by itself (_cc)
                // or _cc.Current.Value
                Plot("CoppockCurve", "cc", _cc);
                
            }
        }
    }
    class CoppockCurveAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.cc = CoppockCurve(11, 14, 10)
            self.RegisterIndicator(self.symbol, self.cc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.cc.IsReady:
                # The current value of self.cc is represented by self.cc.Current.Value
                self.Plot("CoppockCurve", "cc", self.cc.Current.Value)
                
    

    The following reference table describes the CoppockCurve constructor:

    CoppockCurve() 1/3

                CoppockCurve QuantConnect.Indicators.CoppockCurve (
        
       )
            

    Initializes a new instance of the CoppockCurve indicator with its default values.

    CoppockCurve() 2/3

                CoppockCurve QuantConnect.Indicators.CoppockCurve (
        int  shortRocPeriod,
        int  longRocPeriod,
        int  lwmaPeriod
       )
            

    Initializes a new instance of the CoppockCurv indicator.

    CoppockCurve() 3/3

                CoppockCurve QuantConnect.Indicators.CoppockCurve (
        string  name,
        int     shortRocPeriod,
        int     longRocPeriod,
        int     lwmaPeriod
       )
            

    Initializes a new instance of the CoppockCurve indicator.

    Visualization

    The following image shows plot values of selected properties of CoppockCurve using the plotly library.

    CoppockCurve line plot.

     

    13.1.25 De Marker Indicator

    Introduction

    In the DeMarker strategy, for some period of size N, set: DeMax = High - Previous High, and DeMin = Previous Low - Low where, in the prior, if either term is less than zero (DeMax or DeMin), set it to zero. We can now define the indicator itself, DEM, as: DEM = MA(DeMax)/(MA(DeMax)+MA(DeMin)) where MA denotes a Moving Average of period N. https://www.investopedia.com/terms/d/demarkerindicator.asp

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using DEM Indicator

    To create an automatic indicators for DeMarkerIndicator , call the DEM helper method from the QCAlgorithm class. The DEM method creates a DeMarkerIndicator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DeMarkerIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DeMarkerIndicator _dem;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dem = DEM("SPY", 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_dem.IsReady)
            {
                // The current value of _dem is represented by itself (_dem)
                // or _dem.Current.Value
                Plot("DeMarkerIndicator", "dem", _dem);
                
            }
        }
    }
    class DeMarkerIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dem = self.DEM("SPY", 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.dem.IsReady:
                # The current value of self.dem is represented by self.dem.Current.Value
                self.Plot("DeMarkerIndicator", "dem", self.dem.Current.Value)
                
    

    The following reference table describes the DEM method:

    DEM() 1/1

                DeMarkerIndicator QuantConnect.Algorithm.QCAlgorithm.DEM (
        Symbol                            symbol,
        Int32                             period,
        MovingAverageType                 type,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new DeMarker Indicator (DEM), an oscillator-type indicator measuring changes in terms of an asset's High and Low tradebar values.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a DeMarkerIndicator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class DeMarkerIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DeMarkerIndicator _dem;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dem = new DeMarkerIndicator(20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dem.Update(bar);
            }
    
            if (_dem.IsReady)
            {
                // The current value of _dem is represented by itself (_dem)
                // or _dem.Current.Value
                Plot("DeMarkerIndicator", "dem", _dem);
                
            }
        }
    }
    class DeMarkerIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dem = DeMarkerIndicator(20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dem.Update(bar)
    
            if self.dem.IsReady:
                # The current value of self.dem is represented by self.dem.Current.Value
                self.Plot("DeMarkerIndicator", "dem", self.dem.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DeMarkerIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DeMarkerIndicator _dem;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dem = new DeMarkerIndicator(20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _dem, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dem.IsReady)
            {
                // The current value of _dem is represented by itself (_dem)
                // or _dem.Current.Value
                Plot("DeMarkerIndicator", "dem", _dem);
                
            }
        }
    }
    class DeMarkerIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dem = DeMarkerIndicator(20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.dem, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dem.IsReady:
                # The current value of self.dem is represented by self.dem.Current.Value
                self.Plot("DeMarkerIndicator", "dem", self.dem.Current.Value)
                
    

    The following reference table describes the DeMarkerIndicator constructor:

    DeMarkerIndicator() 1/2

                DeMarkerIndicator QuantConnect.Indicators.DeMarkerIndicator (
        int                 period,
        *MovingAverageType  type
       )
            

    Initializes a new instance of the DeMarkerIndicator class with the specified period.

    DeMarkerIndicator() 2/2

                DeMarkerIndicator QuantConnect.Indicators.DeMarkerIndicator (
        string              name,
        int                 period,
        *MovingAverageType  type
       )
            

    Initializes a new instance of the DeMarkerIndicator class with the specified name and period.

    Visualization

    The following image shows plot values of selected properties of DeMarkerIndicator using the plotly library.

    DeMarkerIndicator line plot.

     

    13.1.26 Delay

    Introduction

    An indicator that delays its input for a certain period

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using Delay Indicator

    Delay does not have an automatic indicator implementation available.

    You can manually create a Delay indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class DelayAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Delay _delay;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _delay = new Delay(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _delay.Update(bar.EndTime, bar.Close);
            }
    
            if (_delay.IsReady)
            {
                // The current value of _delay is represented by itself (_delay)
                // or _delay.Current.Value
                Plot("Delay", "delay", _delay);
                
            }
        }
    }
    class DelayAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.delay = Delay(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.delay.Update(bar.EndTime, bar.Close)
    
            if self.delay.IsReady:
                # The current value of self.delay is represented by self.delay.Current.Value
                self.Plot("Delay", "delay", self.delay.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DelayAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Delay _delay;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _delay = new Delay(SPY);
            RegisterIndicator(_symbol, _delay, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_delay.IsReady)
            {
                // The current value of _delay is represented by itself (_delay)
                // or _delay.Current.Value
                Plot("Delay", "delay", _delay);
                
            }
        }
    }
    class DelayAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.delay = Delay(SPY)
            self.RegisterIndicator(self.symbol, self.delay, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.delay.IsReady:
                # The current value of self.delay is represented by self.delay.Current.Value
                self.Plot("Delay", "delay", self.delay.Current.Value)
                
    

    The following reference table describes the Delay constructor:

    Delay() 1/2

                Delay QuantConnect.Indicators.Delay (
        int   period,
       )
            

    Initializes a new instance of the Delay class.

    Delay() 2/2

                Delay QuantConnect.Indicators.Delay (
        string    name,
        int       period,
       )
            

    Initializes a new instance of the Delay class.

    Visualization

    The following image shows plot values of selected properties of Delay using the plotly library.

    Delay line plot.

     

    13.1.27 Detrended Price Oscillator

    Introduction

    The Detrended Price Oscillator is an indicator designed to remove trend from price and make it easier to identify cycles. DPO does not extend to the last date because it is based on a displaced moving average. Is estimated as Price {X/2 + 1} periods ago less the X-period simple moving average. E.g.DPO(20) equals price 11 days ago less the 20-day SMA.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using DPO Indicator

    To create an automatic indicators for DetrendedPriceOscillator , call the DPO helper method from the QCAlgorithm class. The DPO method creates a DetrendedPriceOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DetrendedPriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DetrendedPriceOscillator _dpo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dpo = DPO("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_dpo.IsReady)
            {
                // The current value of _dpo is represented by itself (_dpo)
                // or _dpo.Current.Value
                Plot("DetrendedPriceOscillator", "dpo", _dpo);
                
            }
        }
    }
    class DetrendedPriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dpo = self.DPO("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.dpo.IsReady:
                # The current value of self.dpo is represented by self.dpo.Current.Value
                self.Plot("DetrendedPriceOscillator", "dpo", self.dpo.Current.Value)
                
    

    The following reference table describes the DPO method:

    DPO() 1/1

                DetrendedPriceOscillator QuantConnect.Algorithm.QCAlgorithm.DPO (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new DetrendedPriceOscillator" indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DetrendedPriceOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class DetrendedPriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DetrendedPriceOscillator _dpo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dpo = new DetrendedPriceOscillator(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dpo.Update(bar.EndTime, bar.Close);
            }
    
            if (_dpo.IsReady)
            {
                // The current value of _dpo is represented by itself (_dpo)
                // or _dpo.Current.Value
                Plot("DetrendedPriceOscillator", "dpo", _dpo);
                
            }
        }
    }
    class DetrendedPriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dpo = DetrendedPriceOscillator(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dpo.Update(bar.EndTime, bar.Close)
    
            if self.dpo.IsReady:
                # The current value of self.dpo is represented by self.dpo.Current.Value
                self.Plot("DetrendedPriceOscillator", "dpo", self.dpo.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DetrendedPriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DetrendedPriceOscillator _dpo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dpo = new DetrendedPriceOscillator(20);
            RegisterIndicator(_symbol, _dpo, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dpo.IsReady)
            {
                // The current value of _dpo is represented by itself (_dpo)
                // or _dpo.Current.Value
                Plot("DetrendedPriceOscillator", "dpo", _dpo);
                
            }
        }
    }
    class DetrendedPriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dpo = DetrendedPriceOscillator(20)
            self.RegisterIndicator(self.symbol, self.dpo, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dpo.IsReady:
                # The current value of self.dpo is represented by self.dpo.Current.Value
                self.Plot("DetrendedPriceOscillator", "dpo", self.dpo.Current.Value)
                
    

    The following reference table describes the DetrendedPriceOscillator constructor:

    DetrendedPriceOscillator() 1/2

                DetrendedPriceOscillator QuantConnect.Indicators.DetrendedPriceOscillator (
        string  name,
        int     period
       )
            

    Initializes a new instance of the DetrendedPriceOscillator class.

    DetrendedPriceOscillator() 2/2

                DetrendedPriceOscillator QuantConnect.Indicators.DetrendedPriceOscillator (
        int  period
       )
            

    Initializes a new instance of the DetrendedPriceOscillator class.

    Visualization

    The following image shows plot values of selected properties of DetrendedPriceOscillator using the plotly library.

    DetrendedPriceOscillator line plot.

     

    13.1.28 Donchian Channel

    Introduction

    This indicator computes the upper and lower band of the Donchian Channel. The upper band is computed by finding the highest high over the given period. The lower band is computed by finding the lowest low over the given period. The primary output value of the indicator is the mean of the upper and lower band for the given timeframe.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using DCH Indicator

    To create an automatic indicators for DonchianChannel , call the DCH helper method from the QCAlgorithm class. The DCH method creates a DonchianChannel object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DonchianChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DonchianChannel _dch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dch = DCH("SPY", 20, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_dch.IsReady)
            {
                // The current value of _dch is represented by itself (_dch)
                // or _dch.Current.Value
                Plot("DonchianChannel", "dch", _dch);
                // Plot all properties of dch
                Plot("DonchianChannel", "upperband", _dch.UpperBand);
                Plot("DonchianChannel", "lowerband", _dch.LowerBand);
            }
        }
    }
    class DonchianChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dch = self.DCH("SPY", 20, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.dch.IsReady:
                # The current value of self.dch is represented by self.dch.Current.Value
                self.Plot("DonchianChannel", "dch", self.dch.Current.Value)
                # Plot all attributes of self.dch
                self.Plot("DonchianChannel", "upperband", self.dch.UpperBand.Current.Value)
                self.Plot("DonchianChannel", "lowerband", self.dch.LowerBand.Current.Value)
    

    The following reference table describes the DCH method:

    DCH() 1/2

                DonchianChannel QuantConnect.Algorithm.QCAlgorithm.DCH (
        Symbol                                symbol,
        Int32                                 upperPeriod,
        Int32                                 lowerPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Donchian Channel indicator which will compute the Upper Band and Lower Band. The indicator will be automatically updated on the given resolution.

    DCH() 2/2

                DonchianChannel QuantConnect.Algorithm.QCAlgorithm.DCH (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Overload shorthand to create a new symmetric Donchian Channel indicator which has the upper and lower channels set to the same period length.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DonchianChannel indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class DonchianChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DonchianChannel _dch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dch = new DonchianChannel(20, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dch.Update(bar);
            }
    
            if (_dch.IsReady)
            {
                // The current value of _dch is represented by itself (_dch)
                // or _dch.Current.Value
                Plot("DonchianChannel", "dch", _dch);
                // Plot all properties of dch
                Plot("DonchianChannel", "upperband", _dch.UpperBand);
                Plot("DonchianChannel", "lowerband", _dch.LowerBand);
            }
        }
    }
    class DonchianChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dch = DonchianChannel(20, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dch.Update(bar)
    
            if self.dch.IsReady:
                # The current value of self.dch is represented by self.dch.Current.Value
                self.Plot("DonchianChannel", "dch", self.dch.Current.Value)
                # Plot all attributes of self.dch
                self.Plot("DonchianChannel", "upperband", self.dch.UpperBand.Current.Value)
                self.Plot("DonchianChannel", "lowerband", self.dch.LowerBand.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DonchianChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DonchianChannel _dch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dch = new DonchianChannel(20, 20);
            RegisterIndicator(_symbol, _dch, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dch.IsReady)
            {
                // The current value of _dch is represented by itself (_dch)
                // or _dch.Current.Value
                Plot("DonchianChannel", "dch", _dch);
                // Plot all properties of dch
                Plot("DonchianChannel", "upperband", _dch.UpperBand);
                Plot("DonchianChannel", "lowerband", _dch.LowerBand);
            }
        }
    }
    class DonchianChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dch = DonchianChannel(20, 20)
            self.RegisterIndicator(self.symbol, self.dch, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dch.IsReady:
                # The current value of self.dch is represented by self.dch.Current.Value
                self.Plot("DonchianChannel", "dch", self.dch.Current.Value)
                # Plot all attributes of self.dch
                self.Plot("DonchianChannel", "upperband", self.dch.UpperBand.Current.Value)
                self.Plot("DonchianChannel", "lowerband", self.dch.LowerBand.Current.Value)
    

    The following reference table describes the DonchianChannel constructor:

    DonchianChannel() 1/4

                DonchianChannel QuantConnect.Indicators.DonchianChannel (
        int  period
       )
            

    Initializes a new instance of the DonchianChanne class.

    DonchianChannel() 2/4

                DonchianChannel QuantConnect.Indicators.DonchianChannel (
        int  upperPeriod,
        int  lowerPeriod
       )
            

    Initializes a new instance of the DonchianChanne class.

    DonchianChannel() 3/4

                DonchianChannel QuantConnect.Indicators.DonchianChannel (
        string  name,
        int     period
       )
            

    Initializes a new instance of the DonchianChanne class.

    DonchianChannel() 4/4

                DonchianChannel QuantConnect.Indicators.DonchianChannel (
        string  name,
        int     upperPeriod,
        int     lowerPeriod
       )
            

    Initializes a new instance of the DonchianChanne class.

    Visualization

    The following image shows plot values of selected properties of DonchianChannel using the plotly library.

    DonchianChannel line plot.

     

    13.1.29 Double Exponential Moving Average

    Introduction

    This indicator computes the Double Exponential Moving Average (DEMA). The Double Exponential Moving Average is calculated with the following formula: EMA2 = EMA(EMA(t,period),period) DEMA = 2 * EMA(t,period) - EMA2 The Generalized DEMA (GD) is calculated with the following formula: GD = (volumeFactor+1) * EMA(t,period) - volumeFactor * EMA2

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using DEMA Indicator

    To create an automatic indicators for DoubleExponentialMovingAverage , call the DEMA helper method from the QCAlgorithm class. The DEMA method creates a DoubleExponentialMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class DoubleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DoubleExponentialMovingAverage _dema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dema = DEMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_dema.IsReady)
            {
                // The current value of _dema is represented by itself (_dema)
                // or _dema.Current.Value
                Plot("DoubleExponentialMovingAverage", "dema", _dema);
                
            }
        }
    }
    class DoubleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dema = self.DEMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.dema.IsReady:
                # The current value of self.dema is represented by self.dema.Current.Value
                self.Plot("DoubleExponentialMovingAverage", "dema", self.dema.Current.Value)
                
    

    The following reference table describes the DEMA method:

    DEMA() 1/1

                DoubleExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.DEMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new DoubleExponentialMovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a DoubleExponentialMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class DoubleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DoubleExponentialMovingAverage _dema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dema = new DoubleExponentialMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _dema.Update(bar.EndTime, bar.Close);
            }
    
            if (_dema.IsReady)
            {
                // The current value of _dema is represented by itself (_dema)
                // or _dema.Current.Value
                Plot("DoubleExponentialMovingAverage", "dema", _dema);
                
            }
        }
    }
    class DoubleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dema = DoubleExponentialMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.dema.Update(bar.EndTime, bar.Close)
    
            if self.dema.IsReady:
                # The current value of self.dema is represented by self.dema.Current.Value
                self.Plot("DoubleExponentialMovingAverage", "dema", self.dema.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class DoubleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private DoubleExponentialMovingAverage _dema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _dema = new DoubleExponentialMovingAverage(20);
            RegisterIndicator(_symbol, _dema, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_dema.IsReady)
            {
                // The current value of _dema is represented by itself (_dema)
                // or _dema.Current.Value
                Plot("DoubleExponentialMovingAverage", "dema", _dema);
                
            }
        }
    }
    class DoubleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.dema = DoubleExponentialMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.dema, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.dema.IsReady:
                # The current value of self.dema is represented by self.dema.Current.Value
                self.Plot("DoubleExponentialMovingAverage", "dema", self.dema.Current.Value)
                
    

    The following reference table describes the DoubleExponentialMovingAverage constructor:

    DoubleExponentialMovingAverage() 1/2

                DoubleExponentialMovingAverage QuantConnect.Indicators.DoubleExponentialMovingAverage (
        string    name,
        int       period,
        *decimal  volumeFactor
       )
            

    Initializes a new instance of the DoubleExponentialMovingAverag class using the specified name and period.

    DoubleExponentialMovingAverage() 2/2

                DoubleExponentialMovingAverage QuantConnect.Indicators.DoubleExponentialMovingAverage (
        int       period,
        *decimal  volumeFactor
       )
            

    Initializes a new instance of the DoubleExponentialMovingAverag class using the specified period.

    Visualization

    The following image shows plot values of selected properties of DoubleExponentialMovingAverage using the plotly library.

    DoubleExponentialMovingAverage line plot.

     

    13.1.30 Ease Of Movement Value

    Introduction

    This indicator computes the n-period Ease of Movement Value using the following: MID = (high_1 + low_1)/2 - (high_0 + low_0)/2 RATIO = (currentVolume/10000) / (high_1 - low_1) EMV = MID/RATIO _SMA = n-period of EMV Returns _SMA source

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using EMV Indicator

    To create an automatic indicators for EaseOfMovementValue , call the EMV helper method from the QCAlgorithm class. The EMV method creates a EaseOfMovementValue object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class EaseOfMovementValueAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EaseOfMovementValue _emv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _emv = EMV("SPY", 1, 10000);
        }
    
        public override void OnData(Slice data)
        {
            if (_emv.IsReady)
            {
                // The current value of _emv is represented by itself (_emv)
                // or _emv.Current.Value
                Plot("EaseOfMovementValue", "emv", _emv);
                
            }
        }
    }
    class EaseOfMovementValueAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.emv = self.EMV("SPY", 1, 10000)
    
        def OnData(self, slice: Slice) -> None:
            if self.emv.IsReady:
                # The current value of self.emv is represented by self.emv.Current.Value
                self.Plot("EaseOfMovementValue", "emv", self.emv.Current.Value)
                
    

    The following reference table describes the EMV method:

    EMV() 1/1

                EaseOfMovementValue QuantConnect.Algorithm.QCAlgorithm.EMV (
        Symbol                            symbol,
        *Int32                            period,
        *Int32                            scale,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an EaseOfMovementValue indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a EaseOfMovementValue indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class EaseOfMovementValueAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EaseOfMovementValue _emv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _emv = new EaseOfMovementValue(1, 10000);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _emv.Update(bar);
            }
    
            if (_emv.IsReady)
            {
                // The current value of _emv is represented by itself (_emv)
                // or _emv.Current.Value
                Plot("EaseOfMovementValue", "emv", _emv);
                
            }
        }
    }
    class EaseOfMovementValueAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.emv = EaseOfMovementValue(1, 10000)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.emv.Update(bar)
    
            if self.emv.IsReady:
                # The current value of self.emv is represented by self.emv.Current.Value
                self.Plot("EaseOfMovementValue", "emv", self.emv.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class EaseOfMovementValueAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private EaseOfMovementValue _emv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _emv = new EaseOfMovementValue(1, 10000);
            RegisterIndicator(_symbol, _emv, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_emv.IsReady)
            {
                // The current value of _emv is represented by itself (_emv)
                // or _emv.Current.Value
                Plot("EaseOfMovementValue", "emv", _emv);
                
            }
        }
    }
    class EaseOfMovementValueAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.emv = EaseOfMovementValue(1, 10000)
            self.RegisterIndicator(self.symbol, self.emv, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.emv.IsReady:
                # The current value of self.emv is represented by self.emv.Current.Value
                self.Plot("EaseOfMovementValue", "emv", self.emv.Current.Value)
                
    

    The following reference table describes the EaseOfMovementValue constructor:

    EaseOfMovementValue() 1/2

                EaseOfMovementValue QuantConnect.Indicators.EaseOfMovementValue (
        *int  period,
        *int  scale
       )
            

    Initializeds a new instance of the EaseOfMovement class using the specufued period.

    EaseOfMovementValue() 2/2

                EaseOfMovementValue QuantConnect.Indicators.EaseOfMovementValue (
        string  name,
        int     period,
        int     scale
       )
            

    Creates a new EaseOfMovement indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of EaseOfMovementValue using the plotly library.

    EaseOfMovementValue line plot.

     

    13.1.31 Exponential Moving Average

    Introduction

    This indicator represents the traditional exponential moving average indicator (EMA). When the indicator is ready, the first value of the EMA is equivalent to the simple moving average. After the first EMA value, the EMA value is a function of the previous EMA value. Therefore, depending on the number of samples you feed into the indicator, it can provide different EMA values for a single security and lookback period. To make the indicator values consistent across time, warm up the indicator with all the trailing security price history.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using EMA Indicator

    To create an automatic indicators for ExponentialMovingAverage , call the EMA helper method from the QCAlgorithm class. The EMA method creates a ExponentialMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ExponentialMovingAverage _ema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ema = EMA("SPY", 20, 0.5);
        }
    
        public override void OnData(Slice data)
        {
            if (_ema.IsReady)
            {
                // The current value of _ema is represented by itself (_ema)
                // or _ema.Current.Value
                Plot("ExponentialMovingAverage", "ema", _ema);
                
            }
        }
    }
    class ExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ema = self.EMA("SPY", 20, 0.5)
    
        def OnData(self, slice: Slice) -> None:
            if self.ema.IsReady:
                # The current value of self.ema is represented by self.ema.Current.Value
                self.Plot("ExponentialMovingAverage", "ema", self.ema.Current.Value)
                
    

    The following reference table describes the EMA method:

    EMA() 1/2

                ExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.EMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    EMA() 2/2

                ExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.EMA (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          smoothingFactor,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ExponentialMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class ExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ExponentialMovingAverage _ema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ema = new ExponentialMovingAverage(20, 0.5);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ema.Update(bar.EndTime, bar.Close);
            }
    
            if (_ema.IsReady)
            {
                // The current value of _ema is represented by itself (_ema)
                // or _ema.Current.Value
                Plot("ExponentialMovingAverage", "ema", _ema);
                
            }
        }
    }
    class ExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ema = ExponentialMovingAverage(20, 0.5)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ema.Update(bar.EndTime, bar.Close)
    
            if self.ema.IsReady:
                # The current value of self.ema is represented by self.ema.Current.Value
                self.Plot("ExponentialMovingAverage", "ema", self.ema.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ExponentialMovingAverage _ema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ema = new ExponentialMovingAverage(20, 0.5);
            RegisterIndicator(_symbol, _ema, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ema.IsReady)
            {
                // The current value of _ema is represented by itself (_ema)
                // or _ema.Current.Value
                Plot("ExponentialMovingAverage", "ema", _ema);
                
            }
        }
    }
    class ExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ema = ExponentialMovingAverage(20, 0.5)
            self.RegisterIndicator(self.symbol, self.ema, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ema.IsReady:
                # The current value of self.ema is represented by self.ema.Current.Value
                self.Plot("ExponentialMovingAverage", "ema", self.ema.Current.Value)
                
    

    The following reference table describes the ExponentialMovingAverage constructor:

    ExponentialMovingAverage() 1/4

                ExponentialMovingAverage QuantConnect.Indicators.ExponentialMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the ExponentialMovingAverage class with the specified name and period.

    ExponentialMovingAverage() 2/4

                ExponentialMovingAverage QuantConnect.Indicators.ExponentialMovingAverage (
        string   name,
        int      period,
        decimal  smoothingFactor
       )
            

    Initializes a new instance of the ExponentialMovingAverage class with the specified name and period.

    ExponentialMovingAverage() 3/4

                ExponentialMovingAverage QuantConnect.Indicators.ExponentialMovingAverage (
        int  period
       )
            

    Initializes a new instance of the ExponentialMovingAverage class with the default name and period.

    ExponentialMovingAverage() 4/4

                ExponentialMovingAverage QuantConnect.Indicators.ExponentialMovingAverage (
        int      period,
        decimal  smoothingFactor
       )
            

    Initializes a new instance of the ExponentialMovingAverage class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of ExponentialMovingAverage using the plotly library.

    ExponentialMovingAverage line plot.

     

    13.1.32 Filtered Identity

    Introduction

    This indicator represents an indicator that is a ready after ingesting a single sample and always returns the same value as it is given if it passes a filter condition

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using FilteredIdentity Indicator

    To create an automatic indicators for FilteredIdentity , call the FilteredIdentity helper method from the QCAlgorithm class. The FilteredIdentity method creates a FilteredIdentity object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class FilteredIdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FilteredIdentity _filteredidentity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _filteredidentity = FilteredIdentity("SPY", filter = lambda x: x.Close > x.Open);
        }
    
        public override void OnData(Slice data)
        {
            if (_filteredidentity.IsReady)
            {
                // The current value of _filteredidentity is represented by itself (_filteredidentity)
                // or _filteredidentity.Current.Value
                Plot("FilteredIdentity", "filteredidentity", _filteredidentity);
                
            }
        }
    }
    class FilteredIdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.filteredidentity = self.FilteredIdentity("SPY", filter = lambda x: x.Close > x.Open)
    
        def OnData(self, slice: Slice) -> None:
            if self.filteredidentity.IsReady:
                # The current value of self.filteredidentity is represented by self.filteredidentity.Current.Value
                self.Plot("FilteredIdentity", "filteredidentity", self.filteredidentity.Current.Value)
                
    

    The following reference table describes the FilteredIdentity method:

    Warning: include(/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/filteredidentity.html): failed to open stream: No such file or directory in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49 Warning: include(): Failed opening '/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/filteredidentity.html' for inclusion (include_path='/var/www/beta/core/libraries/Google:/var/www/beta:.:/usr/share/php') in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a FilteredIdentity indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class FilteredIdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FilteredIdentity _filteredidentity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _filteredidentity = new FilteredIdentity(filter = lambda x: x.Close > x.Open);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _filteredidentity.Update(bar.EndTime, bar.Close);
            }
    
            if (_filteredidentity.IsReady)
            {
                // The current value of _filteredidentity is represented by itself (_filteredidentity)
                // or _filteredidentity.Current.Value
                Plot("FilteredIdentity", "filteredidentity", _filteredidentity);
                
            }
        }
    }
    class FilteredIdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.filteredidentity = FilteredIdentity(filter = lambda x: x.Close > x.Open)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.filteredidentity.Update(bar.EndTime, bar.Close)
    
            if self.filteredidentity.IsReady:
                # The current value of self.filteredidentity is represented by self.filteredidentity.Current.Value
                self.Plot("FilteredIdentity", "filteredidentity", self.filteredidentity.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class FilteredIdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FilteredIdentity _filteredidentity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _filteredidentity = new FilteredIdentity(filter = lambda x: x.Close > x.Open);
            RegisterIndicator(_symbol, _filteredidentity, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_filteredidentity.IsReady)
            {
                // The current value of _filteredidentity is represented by itself (_filteredidentity)
                // or _filteredidentity.Current.Value
                Plot("FilteredIdentity", "filteredidentity", _filteredidentity);
                
            }
        }
    }
    class FilteredIdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.filteredidentity = FilteredIdentity(filter = lambda x: x.Close > x.Open)
            self.RegisterIndicator(self.symbol, self.filteredidentity, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.filteredidentity.IsReady:
                # The current value of self.filteredidentity is represented by self.filteredidentity.Current.Value
                self.Plot("FilteredIdentity", "filteredidentity", self.filteredidentity.Current.Value)
                
    

    The following reference table describes the FilteredIdentity constructor:

    FilteredIdentity() 1/1

                FilteredIdentity QuantConnect.Indicators.FilteredIdentity (
        string                 name,
        Func  filter
       )
            

    Initializes a new instance of the FilteredIdentity indicator with the specified name.

    Visualization

    The following image shows plot values of selected properties of FilteredIdentity using the plotly library.

    FilteredIdentity line plot.

     

    13.1.33 Fisher Transform

    Introduction

    The Fisher transform is a mathematical process which is used to convert any data set to a modified data set whose Probability Distribution Function is approximately Gaussian. Once the Fisher transform is computed, the transformed data can then be analyzed in terms of it's deviation from the mean. The equation is y = .5 * ln [ 1 + x / 1 - x ] where x is the input y is the output ln is the natural logarithm The Fisher transform has much sharper turning points than other indicators such as MACD For more info, read chapter 1 of Cybernetic Analysis for Stocks and Futures by John F. Ehlers We are implementing the latest version of this indicator found at Fig. 4 of http://www.mesasoftware.com/papers/UsingTheFisherTransform.pdf

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using FISH Indicator

    To create an automatic indicators for FisherTransform , call the FISH helper method from the QCAlgorithm class. The FISH method creates a FisherTransform object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class FisherTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FisherTransform _fish;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _fish = FISH("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_fish.IsReady)
            {
                // The current value of _fish is represented by itself (_fish)
                // or _fish.Current.Value
                Plot("FisherTransform", "fish", _fish);
                
            }
        }
    }
    class FisherTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.fish = self.FISH("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.fish.IsReady:
                # The current value of self.fish is represented by self.fish.Current.Value
                self.Plot("FisherTransform", "fish", self.fish.Current.Value)
                
    

    The following reference table describes the FISH method:

    FISH() 1/1

                FisherTransform QuantConnect.Algorithm.QCAlgorithm.FISH (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an FisherTransform indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a FisherTransform indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class FisherTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FisherTransform _fish;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _fish = new FisherTransform(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _fish.Update(bar);
            }
    
            if (_fish.IsReady)
            {
                // The current value of _fish is represented by itself (_fish)
                // or _fish.Current.Value
                Plot("FisherTransform", "fish", _fish);
                
            }
        }
    }
    class FisherTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.fish = FisherTransform(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.fish.Update(bar)
    
            if self.fish.IsReady:
                # The current value of self.fish is represented by self.fish.Current.Value
                self.Plot("FisherTransform", "fish", self.fish.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class FisherTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FisherTransform _fish;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _fish = new FisherTransform(20);
            RegisterIndicator(_symbol, _fish, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_fish.IsReady)
            {
                // The current value of _fish is represented by itself (_fish)
                // or _fish.Current.Value
                Plot("FisherTransform", "fish", _fish);
                
            }
        }
    }
    class FisherTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.fish = FisherTransform(20)
            self.RegisterIndicator(self.symbol, self.fish, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.fish.IsReady:
                # The current value of self.fish is represented by self.fish.Current.Value
                self.Plot("FisherTransform", "fish", self.fish.Current.Value)
                
    

    The following reference table describes the FisherTransform constructor:

    FisherTransform() 1/2

                FisherTransform QuantConnect.Indicators.FisherTransform (
        int  period
       )
            

    Initializes a new instance of the FisherTransform class with the default name and period.

    FisherTransform() 2/2

                FisherTransform QuantConnect.Indicators.FisherTransform (
        string  name,
        int     period
       )
            

    A Fisher Transform of Prices.

    Visualization

    The following image shows plot values of selected properties of FisherTransform using the plotly library.

    FisherTransform line plot.

     

    13.1.34 Fractal Adaptive Moving Average

    Introduction

    The Fractal Adaptive Moving Average (FRAMA) by John Ehlers

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using FRAMA Indicator

    To create an automatic indicators for FractalAdaptiveMovingAverage , call the FRAMA helper method from the QCAlgorithm class. The FRAMA method creates a FractalAdaptiveMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class FractalAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FractalAdaptiveMovingAverage _frama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _frama = FRAMA("SPY", 20, 198);
        }
    
        public override void OnData(Slice data)
        {
            if (_frama.IsReady)
            {
                // The current value of _frama is represented by itself (_frama)
                // or _frama.Current.Value
                Plot("FractalAdaptiveMovingAverage", "frama", _frama);
                
            }
        }
    }
    class FractalAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.frama = self.FRAMA("SPY", 20, 198)
    
        def OnData(self, slice: Slice) -> None:
            if self.frama.IsReady:
                # The current value of self.frama is represented by self.frama.Current.Value
                self.Plot("FractalAdaptiveMovingAverage", "frama", self.frama.Current.Value)
                
    

    The following reference table describes the FRAMA method:

    FRAMA() 1/1

                FractalAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.FRAMA (
        Symbol                                symbol,
        Int32                                 period,
        *Int32                                longPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates an FractalAdaptiveMovingAverage (FRAMA) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a FractalAdaptiveMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class FractalAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FractalAdaptiveMovingAverage _frama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _frama = new FractalAdaptiveMovingAverage(20, 198);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _frama.Update(bar);
            }
    
            if (_frama.IsReady)
            {
                // The current value of _frama is represented by itself (_frama)
                // or _frama.Current.Value
                Plot("FractalAdaptiveMovingAverage", "frama", _frama);
                
            }
        }
    }
    class FractalAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.frama = FractalAdaptiveMovingAverage(20, 198)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.frama.Update(bar)
    
            if self.frama.IsReady:
                # The current value of self.frama is represented by self.frama.Current.Value
                self.Plot("FractalAdaptiveMovingAverage", "frama", self.frama.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class FractalAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private FractalAdaptiveMovingAverage _frama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _frama = new FractalAdaptiveMovingAverage(20, 198);
            RegisterIndicator(_symbol, _frama, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_frama.IsReady)
            {
                // The current value of _frama is represented by itself (_frama)
                // or _frama.Current.Value
                Plot("FractalAdaptiveMovingAverage", "frama", _frama);
                
            }
        }
    }
    class FractalAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.frama = FractalAdaptiveMovingAverage(20, 198)
            self.RegisterIndicator(self.symbol, self.frama, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.frama.IsReady:
                # The current value of self.frama is represented by self.frama.Current.Value
                self.Plot("FractalAdaptiveMovingAverage", "frama", self.frama.Current.Value)
                
    

    The following reference table describes the FractalAdaptiveMovingAverage constructor:

    FractalAdaptiveMovingAverage() 1/3

                FractalAdaptiveMovingAverage QuantConnect.Indicators.FractalAdaptiveMovingAverage (
        string  name,
        int     n,
        int     longPeriod
       )
            

    Initializes a new instance of the average class.

    FractalAdaptiveMovingAverage() 2/3

                FractalAdaptiveMovingAverage QuantConnect.Indicators.FractalAdaptiveMovingAverage (
        int  n,
        int  longPeriod
       )
            

    Initializes a new instance of the average class.

    FractalAdaptiveMovingAverage() 3/3

                FractalAdaptiveMovingAverage QuantConnect.Indicators.FractalAdaptiveMovingAverage (
        int  n
       )
            

    Initializes a new instance of the average class.

    Visualization

    The following image shows plot values of selected properties of FractalAdaptiveMovingAverage using the plotly library.

    FractalAdaptiveMovingAverage line plot.

     

    13.1.35 Heikin Ashi

    Introduction

    This indicator computes the Heikin-Ashi bar (HA) The Heikin-Ashi bar is calculated using the following formulas: HA_Close[0] = (Open[0] + High[0] + Low[0] + Close[0]) / 4 HA_Open[0] = (HA_Open[1] + HA_Close[1]) / 2 HA_High[0] = MAX(High[0], HA_Open[0], HA_Close[0]) HA_Low[0] = MIN(Low[0], HA_Open[0], HA_Close[0])

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using HeikinAshi Indicator

    To create an automatic indicators for HeikinAshi , call the HeikinAshi helper method from the QCAlgorithm class. The HeikinAshi method creates a HeikinAshi object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HeikinAshiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HeikinAshi _heikinashi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _heikinashi = HeikinAshi("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_heikinashi.IsReady)
            {
                // The current value of _heikinashi is represented by itself (_heikinashi)
                // or _heikinashi.Current.Value
                Plot("HeikinAshi", "heikinashi", _heikinashi);
                // Plot all properties of heikinashi
                Plot("HeikinAshi", "open", _heikinashi.Open);
                Plot("HeikinAshi", "high", _heikinashi.High);
                Plot("HeikinAshi", "low", _heikinashi.Low);
                Plot("HeikinAshi", "close", _heikinashi.Close);
                Plot("HeikinAshi", "volume", _heikinashi.Volume);
            }
        }
    }
    class HeikinAshiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.heikinashi = self.HeikinAshi("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.heikinashi.IsReady:
                # The current value of self.heikinashi is represented by self.heikinashi.Current.Value
                self.Plot("HeikinAshi", "heikinashi", self.heikinashi.Current.Value)
                # Plot all attributes of self.heikinashi
                self.Plot("HeikinAshi", "open", self.heikinashi.Open.Current.Value)
                self.Plot("HeikinAshi", "high", self.heikinashi.High.Current.Value)
                self.Plot("HeikinAshi", "low", self.heikinashi.Low.Current.Value)
                self.Plot("HeikinAshi", "close", self.heikinashi.Close.Current.Value)
                self.Plot("HeikinAshi", "volume", self.heikinashi.Volume.Current.Value)
    

    The following reference table describes the HeikinAshi method:

    Warning: include(/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/heikinashi.html): failed to open stream: No such file or directory in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49 Warning: include(): Failed opening '/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/heikinashi.html' for inclusion (include_path='/var/www/beta/core/libraries/Google:/var/www/beta:.:/usr/share/php') in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HeikinAshi indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class HeikinAshiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HeikinAshi _heikinashi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _heikinashi = new HeikinAshi("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _heikinashi.Update(bar);
            }
    
            if (_heikinashi.IsReady)
            {
                // The current value of _heikinashi is represented by itself (_heikinashi)
                // or _heikinashi.Current.Value
                Plot("HeikinAshi", "heikinashi", _heikinashi);
                // Plot all properties of heikinashi
                Plot("HeikinAshi", "open", _heikinashi.Open);
                Plot("HeikinAshi", "high", _heikinashi.High);
                Plot("HeikinAshi", "low", _heikinashi.Low);
                Plot("HeikinAshi", "close", _heikinashi.Close);
                Plot("HeikinAshi", "volume", _heikinashi.Volume);
            }
        }
    }
    class HeikinAshiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.heikinashi = HeikinAshi("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.heikinashi.Update(bar)
    
            if self.heikinashi.IsReady:
                # The current value of self.heikinashi is represented by self.heikinashi.Current.Value
                self.Plot("HeikinAshi", "heikinashi", self.heikinashi.Current.Value)
                # Plot all attributes of self.heikinashi
                self.Plot("HeikinAshi", "open", self.heikinashi.Open.Current.Value)
                self.Plot("HeikinAshi", "high", self.heikinashi.High.Current.Value)
                self.Plot("HeikinAshi", "low", self.heikinashi.Low.Current.Value)
                self.Plot("HeikinAshi", "close", self.heikinashi.Close.Current.Value)
                self.Plot("HeikinAshi", "volume", self.heikinashi.Volume.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HeikinAshiAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HeikinAshi _heikinashi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _heikinashi = new HeikinAshi("SPY");
            RegisterIndicator(_symbol, _heikinashi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_heikinashi.IsReady)
            {
                // The current value of _heikinashi is represented by itself (_heikinashi)
                // or _heikinashi.Current.Value
                Plot("HeikinAshi", "heikinashi", _heikinashi);
                // Plot all properties of heikinashi
                Plot("HeikinAshi", "open", _heikinashi.Open);
                Plot("HeikinAshi", "high", _heikinashi.High);
                Plot("HeikinAshi", "low", _heikinashi.Low);
                Plot("HeikinAshi", "close", _heikinashi.Close);
                Plot("HeikinAshi", "volume", _heikinashi.Volume);
            }
        }
    }
    class HeikinAshiAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.heikinashi = HeikinAshi("SPY")
            self.RegisterIndicator(self.symbol, self.heikinashi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.heikinashi.IsReady:
                # The current value of self.heikinashi is represented by self.heikinashi.Current.Value
                self.Plot("HeikinAshi", "heikinashi", self.heikinashi.Current.Value)
                # Plot all attributes of self.heikinashi
                self.Plot("HeikinAshi", "open", self.heikinashi.Open.Current.Value)
                self.Plot("HeikinAshi", "high", self.heikinashi.High.Current.Value)
                self.Plot("HeikinAshi", "low", self.heikinashi.Low.Current.Value)
                self.Plot("HeikinAshi", "close", self.heikinashi.Close.Current.Value)
                self.Plot("HeikinAshi", "volume", self.heikinashi.Volume.Current.Value)
    

    The following reference table describes the HeikinAshi constructor:

    HeikinAshi() 1/2

                HeikinAshi QuantConnect.Indicators.HeikinAshi (
        string  name
       )
            

    Initializes a new instance of the HeikinAsh class using the specified name.

    HeikinAshi() 2/2

                HeikinAshi QuantConnect.Indicators.HeikinAshi (
        
       )
            

    Initializes a new instance of the HeikinAsh class.

    Visualization

    The following image shows plot values of selected properties of HeikinAshi using the plotly library.

    HeikinAshi line plot.

     

    13.1.36 Hilbert Transform

    Introduction

    This indicator computes the Hilbert Transform Indicator by John Ehlers. By using present and prior price differences, and some feedback, price values are split into their complex number components of real (inPhase) and imaginary (quadrature) parts. source

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using HilbertTransform Indicator

    To create an automatic indicators for HilbertTransform , call the HilbertTransform helper method from the QCAlgorithm class. The HilbertTransform method creates a HilbertTransform object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HilbertTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HilbertTransform _hilberttransform;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hilberttransform = HilbertTransform(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (_hilberttransform.IsReady)
            {
                // The current value of _hilberttransform is represented by itself (_hilberttransform)
                // or _hilberttransform.Current.Value
                Plot("HilbertTransform", "hilberttransform", _hilberttransform);
                // Plot all properties of hilberttransform
                Plot("HilbertTransform", "inphase", _hilberttransform.InPhase);
                Plot("HilbertTransform", "quadrature", _hilberttransform.Quadrature);
            }
        }
    }
    class HilbertTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hilberttransform = self.HilbertTransform(SPY)
    
        def OnData(self, slice: Slice) -> None:
            if self.hilberttransform.IsReady:
                # The current value of self.hilberttransform is represented by self.hilberttransform.Current.Value
                self.Plot("HilbertTransform", "hilberttransform", self.hilberttransform.Current.Value)
                # Plot all attributes of self.hilberttransform
                self.Plot("HilbertTransform", "inphase", self.hilberttransform.InPhase.Current.Value)
                self.Plot("HilbertTransform", "quadrature", self.hilberttransform.Quadrature.Current.Value)
    

    The following reference table describes the HilbertTransform method:

    Warning: include(/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/hilberttransform.html): failed to open stream: No such file or directory in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49 Warning: include(): Failed opening '/tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/qcalgorithm-api/hilberttransform.html' for inclusion (include_path='/var/www/beta/core/libraries/Google:/var/www/beta:.:/usr/share/php') in /tmp/docs/66ff9868a796ca0d2cb20bf1fc3dc0875dca18f0/Resources/indicators/using-indicator.php on line 49

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HilbertTransform indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class HilbertTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HilbertTransform _hilberttransform;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hilberttransform = new HilbertTransform(SPY);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hilberttransform.Update(bar.EndTime, bar.Close);
            }
    
            if (_hilberttransform.IsReady)
            {
                // The current value of _hilberttransform is represented by itself (_hilberttransform)
                // or _hilberttransform.Current.Value
                Plot("HilbertTransform", "hilberttransform", _hilberttransform);
                // Plot all properties of hilberttransform
                Plot("HilbertTransform", "inphase", _hilberttransform.InPhase);
                Plot("HilbertTransform", "quadrature", _hilberttransform.Quadrature);
            }
        }
    }
    class HilbertTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hilberttransform = HilbertTransform(SPY)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hilberttransform.Update(bar.EndTime, bar.Close)
    
            if self.hilberttransform.IsReady:
                # The current value of self.hilberttransform is represented by self.hilberttransform.Current.Value
                self.Plot("HilbertTransform", "hilberttransform", self.hilberttransform.Current.Value)
                # Plot all attributes of self.hilberttransform
                self.Plot("HilbertTransform", "inphase", self.hilberttransform.InPhase.Current.Value)
                self.Plot("HilbertTransform", "quadrature", self.hilberttransform.Quadrature.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HilbertTransformAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HilbertTransform _hilberttransform;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hilberttransform = new HilbertTransform(SPY);
            RegisterIndicator(_symbol, _hilberttransform, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hilberttransform.IsReady)
            {
                // The current value of _hilberttransform is represented by itself (_hilberttransform)
                // or _hilberttransform.Current.Value
                Plot("HilbertTransform", "hilberttransform", _hilberttransform);
                // Plot all properties of hilberttransform
                Plot("HilbertTransform", "inphase", _hilberttransform.InPhase);
                Plot("HilbertTransform", "quadrature", _hilberttransform.Quadrature);
            }
        }
    }
    class HilbertTransformAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hilberttransform = HilbertTransform(SPY)
            self.RegisterIndicator(self.symbol, self.hilberttransform, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hilberttransform.IsReady:
                # The current value of self.hilberttransform is represented by self.hilberttransform.Current.Value
                self.Plot("HilbertTransform", "hilberttransform", self.hilberttransform.Current.Value)
                # Plot all attributes of self.hilberttransform
                self.Plot("HilbertTransform", "inphase", self.hilberttransform.InPhase.Current.Value)
                self.Plot("HilbertTransform", "quadrature", self.hilberttransform.Quadrature.Current.Value)
    

    The following reference table describes the HilbertTransform constructor:

    HilbertTransform() 1/2

                HilbertTransform QuantConnect.Indicators.HilbertTransform (
        string  name
       )
            

    Creates a new Hilbert Transform indicator.

    HilbertTransform() 2/2

                HilbertTransform QuantConnect.Indicators.HilbertTransform (
        
       )
            

    Creates a new Hilbert Transform indicator with default name and default params.

    Visualization

    The following image shows plot values of selected properties of HilbertTransform using the plotly library.

    HilbertTransform line plot.

     

    13.1.37 Hull Moving Average

    Introduction

    Produces a Hull Moving Average as explained at http://www.alanhull.com/hull-moving-average/ and derived from the instructions for the Excel VBA code at http://finance4traders.blogspot.com/2009/06/how-to-calculate-hull-moving-average.html

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using HMA Indicator

    To create an automatic indicators for HullMovingAverage , call the HMA helper method from the QCAlgorithm class. The HMA method creates a HullMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class HullMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HullMovingAverage _hma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hma = HMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_hma.IsReady)
            {
                // The current value of _hma is represented by itself (_hma)
                // or _hma.Current.Value
                Plot("HullMovingAverage", "hma", _hma);
                
            }
        }
    }
    class HullMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hma = self.HMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.hma.IsReady:
                # The current value of self.hma is represented by self.hma.Current.Value
                self.Plot("HullMovingAverage", "hma", self.hma.Current.Value)
                
    

    The following reference table describes the HMA method:

    HMA() 1/1

                HullMovingAverage QuantConnect.Algorithm.QCAlgorithm.HMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new HullMovingAverage indicator. The Hull moving average is a series of nested weighted moving averages, is fast and smooth.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a HullMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class HullMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HullMovingAverage _hma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hma = new HullMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _hma.Update(bar.EndTime, bar.Close);
            }
    
            if (_hma.IsReady)
            {
                // The current value of _hma is represented by itself (_hma)
                // or _hma.Current.Value
                Plot("HullMovingAverage", "hma", _hma);
                
            }
        }
    }
    class HullMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hma = HullMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.hma.Update(bar.EndTime, bar.Close)
    
            if self.hma.IsReady:
                # The current value of self.hma is represented by self.hma.Current.Value
                self.Plot("HullMovingAverage", "hma", self.hma.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class HullMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private HullMovingAverage _hma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _hma = new HullMovingAverage(20);
            RegisterIndicator(_symbol, _hma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_hma.IsReady)
            {
                // The current value of _hma is represented by itself (_hma)
                // or _hma.Current.Value
                Plot("HullMovingAverage", "hma", _hma);
                
            }
        }
    }
    class HullMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.hma = HullMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.hma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.hma.IsReady:
                # The current value of self.hma is represented by self.hma.Current.Value
                self.Plot("HullMovingAverage", "hma", self.hma.Current.Value)
                
    

    The following reference table describes the HullMovingAverage constructor:

    HullMovingAverage() 1/2

                HullMovingAverage QuantConnect.Indicators.HullMovingAverage (
        string  name,
        int     period
       )
            

    A Hull Moving Average.

    HullMovingAverage() 2/2

                HullMovingAverage QuantConnect.Indicators.HullMovingAverage (
        int  period
       )
            

    A Hull Moving Average.

    Visualization

    The following image shows plot values of selected properties of HullMovingAverage using the plotly library.

    HullMovingAverage line plot.

     

    13.1.38 Ichimoku Kinko Hyo

    Introduction

    This indicator computes the Ichimoku Kinko Hyo indicator. It consists of the following main indicators: Tenkan-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 9) Kijun-sen: (Highest High + Lowest Low) / 2 for the specific period (normally 26) Senkou A Span: (Tenkan-sen + Kijun-sen )/ 2 from a specific number of periods ago (normally 26) Senkou B Span: (Highest High + Lowest Low) / 2 for the specific period (normally 52), from a specific number of periods ago (normally 26)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ICHIMOKU Indicator

    To create an automatic indicators for IchimokuKinkoHyo , call the ICHIMOKU helper method from the QCAlgorithm class. The ICHIMOKU method creates a IchimokuKinkoHyo object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class IchimokuKinkoHyoAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IchimokuKinkoHyo _ichimoku;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ichimoku = ICHIMOKU("SPY", 9, 26, 17, 52, 26, 26);
        }
    
        public override void OnData(Slice data)
        {
            if (_ichimoku.IsReady)
            {
                // The current value of _ichimoku is represented by itself (_ichimoku)
                // or _ichimoku.Current.Value
                Plot("IchimokuKinkoHyo", "ichimoku", _ichimoku);
                // Plot all properties of ichimoku
                Plot("IchimokuKinkoHyo", "tenkan", _ichimoku.Tenkan);
                Plot("IchimokuKinkoHyo", "kijun", _ichimoku.Kijun);
                Plot("IchimokuKinkoHyo", "senkoua", _ichimoku.SenkouA);
                Plot("IchimokuKinkoHyo", "senkoub", _ichimoku.SenkouB);
                Plot("IchimokuKinkoHyo", "chikou", _ichimoku.Chikou);
                Plot("IchimokuKinkoHyo", "tenkanmaximum", _ichimoku.TenkanMaximum);
                Plot("IchimokuKinkoHyo", "tenkanminimum", _ichimoku.TenkanMinimum);
                Plot("IchimokuKinkoHyo", "kijunmaximum", _ichimoku.KijunMaximum);
                Plot("IchimokuKinkoHyo", "kijunminimum", _ichimoku.KijunMinimum);
                Plot("IchimokuKinkoHyo", "senkoubmaximum", _ichimoku.SenkouBMaximum);
                Plot("IchimokuKinkoHyo", "senkoubminimum", _ichimoku.SenkouBMinimum);
                Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", _ichimoku.DelayedTenkanSenkouA);
                Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", _ichimoku.DelayedKijunSenkouA);
                Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", _ichimoku.DelayedMaximumSenkouB);
                Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", _ichimoku.DelayedMinimumSenkouB);
            }
        }
    }
    class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ichimoku = self.ICHIMOKU("SPY", 9, 26, 17, 52, 26, 26)
    
        def OnData(self, slice: Slice) -> None:
            if self.ichimoku.IsReady:
                # The current value of self.ichimoku is represented by self.ichimoku.Current.Value
                self.Plot("IchimokuKinkoHyo", "ichimoku", self.ichimoku.Current.Value)
                # Plot all attributes of self.ichimoku
                self.Plot("IchimokuKinkoHyo", "tenkan", self.ichimoku.Tenkan.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijun", self.ichimoku.Kijun.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoua", self.ichimoku.SenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoub", self.ichimoku.SenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "chikou", self.ichimoku.Chikou.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanmaximum", self.ichimoku.TenkanMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanminimum", self.ichimoku.TenkanMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunmaximum", self.ichimoku.KijunMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunminimum", self.ichimoku.KijunMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubmaximum", self.ichimoku.SenkouBMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubminimum", self.ichimoku.SenkouBMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", self.ichimoku.DelayedTenkanSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", self.ichimoku.DelayedKijunSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", self.ichimoku.DelayedMaximumSenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", self.ichimoku.DelayedMinimumSenkouB.Current.Value)
    

    The following reference table describes the ICHIMOKU method:

    ICHIMOKU() 1/1

                IchimokuKinkoHyo QuantConnect.Algorithm.QCAlgorithm.ICHIMOKU (
        Symbol                            symbol,
        Int32                             tenkanPeriod,
        Int32                             kijunPeriod,
        Int32                             senkouAPeriod,
        Int32                             senkouBPeriod,
        Int32                             senkouADelayPeriod,
        Int32                             senkouBDelayPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a IchimokuKinkoHyo indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class IchimokuKinkoHyoAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IchimokuKinkoHyo _ichimoku;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ichimoku = new IchimokuKinkoHyo(9, 26, 17, 52, 26, 26);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ichimoku.Update(bar);
            }
    
            if (_ichimoku.IsReady)
            {
                // The current value of _ichimoku is represented by itself (_ichimoku)
                // or _ichimoku.Current.Value
                Plot("IchimokuKinkoHyo", "ichimoku", _ichimoku);
                // Plot all properties of ichimoku
                Plot("IchimokuKinkoHyo", "tenkan", _ichimoku.Tenkan);
                Plot("IchimokuKinkoHyo", "kijun", _ichimoku.Kijun);
                Plot("IchimokuKinkoHyo", "senkoua", _ichimoku.SenkouA);
                Plot("IchimokuKinkoHyo", "senkoub", _ichimoku.SenkouB);
                Plot("IchimokuKinkoHyo", "chikou", _ichimoku.Chikou);
                Plot("IchimokuKinkoHyo", "tenkanmaximum", _ichimoku.TenkanMaximum);
                Plot("IchimokuKinkoHyo", "tenkanminimum", _ichimoku.TenkanMinimum);
                Plot("IchimokuKinkoHyo", "kijunmaximum", _ichimoku.KijunMaximum);
                Plot("IchimokuKinkoHyo", "kijunminimum", _ichimoku.KijunMinimum);
                Plot("IchimokuKinkoHyo", "senkoubmaximum", _ichimoku.SenkouBMaximum);
                Plot("IchimokuKinkoHyo", "senkoubminimum", _ichimoku.SenkouBMinimum);
                Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", _ichimoku.DelayedTenkanSenkouA);
                Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", _ichimoku.DelayedKijunSenkouA);
                Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", _ichimoku.DelayedMaximumSenkouB);
                Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", _ichimoku.DelayedMinimumSenkouB);
            }
        }
    }
    class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ichimoku = IchimokuKinkoHyo(9, 26, 17, 52, 26, 26)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ichimoku.Update(bar)
    
            if self.ichimoku.IsReady:
                # The current value of self.ichimoku is represented by self.ichimoku.Current.Value
                self.Plot("IchimokuKinkoHyo", "ichimoku", self.ichimoku.Current.Value)
                # Plot all attributes of self.ichimoku
                self.Plot("IchimokuKinkoHyo", "tenkan", self.ichimoku.Tenkan.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijun", self.ichimoku.Kijun.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoua", self.ichimoku.SenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoub", self.ichimoku.SenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "chikou", self.ichimoku.Chikou.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanmaximum", self.ichimoku.TenkanMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanminimum", self.ichimoku.TenkanMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunmaximum", self.ichimoku.KijunMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunminimum", self.ichimoku.KijunMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubmaximum", self.ichimoku.SenkouBMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubminimum", self.ichimoku.SenkouBMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", self.ichimoku.DelayedTenkanSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", self.ichimoku.DelayedKijunSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", self.ichimoku.DelayedMaximumSenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", self.ichimoku.DelayedMinimumSenkouB.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class IchimokuKinkoHyoAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IchimokuKinkoHyo _ichimoku;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ichimoku = new IchimokuKinkoHyo(9, 26, 17, 52, 26, 26);
            RegisterIndicator(_symbol, _ichimoku, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ichimoku.IsReady)
            {
                // The current value of _ichimoku is represented by itself (_ichimoku)
                // or _ichimoku.Current.Value
                Plot("IchimokuKinkoHyo", "ichimoku", _ichimoku);
                // Plot all properties of ichimoku
                Plot("IchimokuKinkoHyo", "tenkan", _ichimoku.Tenkan);
                Plot("IchimokuKinkoHyo", "kijun", _ichimoku.Kijun);
                Plot("IchimokuKinkoHyo", "senkoua", _ichimoku.SenkouA);
                Plot("IchimokuKinkoHyo", "senkoub", _ichimoku.SenkouB);
                Plot("IchimokuKinkoHyo", "chikou", _ichimoku.Chikou);
                Plot("IchimokuKinkoHyo", "tenkanmaximum", _ichimoku.TenkanMaximum);
                Plot("IchimokuKinkoHyo", "tenkanminimum", _ichimoku.TenkanMinimum);
                Plot("IchimokuKinkoHyo", "kijunmaximum", _ichimoku.KijunMaximum);
                Plot("IchimokuKinkoHyo", "kijunminimum", _ichimoku.KijunMinimum);
                Plot("IchimokuKinkoHyo", "senkoubmaximum", _ichimoku.SenkouBMaximum);
                Plot("IchimokuKinkoHyo", "senkoubminimum", _ichimoku.SenkouBMinimum);
                Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", _ichimoku.DelayedTenkanSenkouA);
                Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", _ichimoku.DelayedKijunSenkouA);
                Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", _ichimoku.DelayedMaximumSenkouB);
                Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", _ichimoku.DelayedMinimumSenkouB);
            }
        }
    }
    class IchimokuKinkoHyoAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ichimoku = IchimokuKinkoHyo(9, 26, 17, 52, 26, 26)
            self.RegisterIndicator(self.symbol, self.ichimoku, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ichimoku.IsReady:
                # The current value of self.ichimoku is represented by self.ichimoku.Current.Value
                self.Plot("IchimokuKinkoHyo", "ichimoku", self.ichimoku.Current.Value)
                # Plot all attributes of self.ichimoku
                self.Plot("IchimokuKinkoHyo", "tenkan", self.ichimoku.Tenkan.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijun", self.ichimoku.Kijun.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoua", self.ichimoku.SenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoub", self.ichimoku.SenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "chikou", self.ichimoku.Chikou.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanmaximum", self.ichimoku.TenkanMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "tenkanminimum", self.ichimoku.TenkanMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunmaximum", self.ichimoku.KijunMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "kijunminimum", self.ichimoku.KijunMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubmaximum", self.ichimoku.SenkouBMaximum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "senkoubminimum", self.ichimoku.SenkouBMinimum.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedtenkansenkoua", self.ichimoku.DelayedTenkanSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedkijunsenkoua", self.ichimoku.DelayedKijunSenkouA.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedmaximumsenkoub", self.ichimoku.DelayedMaximumSenkouB.Current.Value)
                self.Plot("IchimokuKinkoHyo", "delayedminimumsenkoub", self.ichimoku.DelayedMinimumSenkouB.Current.Value)
    

    The following reference table describes the IchimokuKinkoHyo constructor:

    IchimokuKinkoHyo() 1/2

                IchimokuKinkoHyo QuantConnect.Indicators.IchimokuKinkoHyo (
        *int  tenkanPeriod,
        *int  kijunPeriod,
        *int  senkouAPeriod,
        *int  senkouBPeriod,
        *int  senkouADelayPeriod,
        *int  senkouBDelayPeriod
       )
            

    Creates a new IchimokuKinkoHyo indicator from the specific periods.

    IchimokuKinkoHyo() 2/2

                IchimokuKinkoHyo QuantConnect.Indicators.IchimokuKinkoHyo (
        string  name,
        *int    tenkanPeriod,
        *int    kijunPeriod,
        *int    senkouAPeriod,
        *int    senkouBPeriod,
        *int    senkouADelayPeriod,
        *int    senkouBDelayPeriod
       )
            

    Creates a new IchimokuKinkoHyo indicator from the specific periods.

    Visualization

    The following image shows plot values of selected properties of IchimokuKinkoHyo using the plotly library.

    IchimokuKinkoHyo line plot.

     

    13.1.39 Identity

    Introduction

    This indicator represents an indicator that is a ready after ingesting a single sample and always returns the same value as it is given.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using Identity Indicator

    To create an automatic indicators for Identity , call the Identity helper method from the QCAlgorithm class. The Identity method creates a Identity object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class IdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Identity _identity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identity = Identity("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_identity.IsReady)
            {
                // The current value of _identity is represented by itself (_identity)
                // or _identity.Current.Value
                Plot("Identity", "identity", _identity);
                
            }
        }
    }
    class IdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identity = self.Identity("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.identity.IsReady:
                # The current value of self.identity is represented by self.identity.Current.Value
                self.Plot("Identity", "identity", self.identity.Current.Value)
                
    

    The following reference table describes the Identity method:

    Identity() 1/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    Identity() 2/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        Resolution                       resolution,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    Identity() 3/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        TimeSpan                         resolution,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Identity indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class IdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Identity _identity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identity = new Identity("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _identity.Update(bar.EndTime, bar.Close);
            }
    
            if (_identity.IsReady)
            {
                // The current value of _identity is represented by itself (_identity)
                // or _identity.Current.Value
                Plot("Identity", "identity", _identity);
                
            }
        }
    }
    class IdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identity = Identity("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.identity.Update(bar.EndTime, bar.Close)
    
            if self.identity.IsReady:
                # The current value of self.identity is represented by self.identity.Current.Value
                self.Plot("Identity", "identity", self.identity.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class IdentityAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Identity _identity;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _identity = new Identity("SPY");
            RegisterIndicator(_symbol, _identity, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_identity.IsReady)
            {
                // The current value of _identity is represented by itself (_identity)
                // or _identity.Current.Value
                Plot("Identity", "identity", _identity);
                
            }
        }
    }
    class IdentityAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.identity = Identity("SPY")
            self.RegisterIndicator(self.symbol, self.identity, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.identity.IsReady:
                # The current value of self.identity is represented by self.identity.Current.Value
                self.Plot("Identity", "identity", self.identity.Current.Value)
                
    

    The following reference table describes the Identity constructor:

    Identity() 1/1

                Identity QuantConnect.Indicators.Identity (
        string  name
       )
            

    Initializes a new instance of the Identity indicator with the specified name.

    Visualization

    The following image shows plot values of selected properties of Identity using the plotly library.

    Identity line plot.

     

    13.1.40 Intraday Vwap

    Introduction

    Defines the canonical intraday VWAP indicator

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using VWAP Indicator

    To create an automatic indicators for IntradayVwap , call the VWAP helper method from the QCAlgorithm class. The VWAP method creates a IntradayVwap object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class IntradayVwapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IntradayVwap _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = VWAP("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("IntradayVwap", "vwap", _vwap);
                
            }
        }
    }
    class IntradayVwapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = self.VWAP("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("IntradayVwap", "vwap", self.vwap.Current.Value)
                
    

    The following reference table describes the VWAP method:

    VWAP() 1/2

                VolumeWeightedAveragePriceIndicator QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an VolumeWeightedAveragePrice (VWAP) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    VWAP() 2/2

                IntradayVwap QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol  symbol
       )
            

    Creates the canonical VWAP indicator that resets each day. The indicator will be automatically updated on the security's configured resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a IntradayVwap indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class IntradayVwapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IntradayVwap _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = new IntradayVwap("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _vwap.Update(bar.EndTime, bar.Close);
            }
    
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("IntradayVwap", "vwap", _vwap);
                
            }
        }
    }
    class IntradayVwapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = IntradayVwap("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.vwap.Update(bar.EndTime, bar.Close)
    
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("IntradayVwap", "vwap", self.vwap.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class IntradayVwapAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private IntradayVwap _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = new IntradayVwap("SPY");
            RegisterIndicator(_symbol, _vwap, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("IntradayVwap", "vwap", _vwap);
                
            }
        }
    }
    class IntradayVwapAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = IntradayVwap("SPY")
            self.RegisterIndicator(self.symbol, self.vwap, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("IntradayVwap", "vwap", self.vwap.Current.Value)
                
    

    The following reference table describes the IntradayVwap constructor:

    IntradayVwap() 1/1

                IntradayVwap QuantConnect.Indicators.IntradayVwap (
        string  name
       )
            

    Initializes a new instance of the IntradayVwa class.

    Visualization

    The following image shows plot values of selected properties of IntradayVwap using the plotly library.

    IntradayVwap line plot.

     

    13.1.41 Kaufman Adaptive Moving Average

    Introduction

    This indicator computes the Kaufman Adaptive Moving Average (KAMA). The Kaufman Adaptive Moving Average is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:kaufman_s_adaptive_moving_average

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using KAMA Indicator

    To create an automatic indicators for KaufmanAdaptiveMovingAverage , call the KAMA helper method from the QCAlgorithm class. The KAMA method creates a KaufmanAdaptiveMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class KaufmanAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanAdaptiveMovingAverage _kama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kama = KAMA("SPY", 20, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_kama.IsReady)
            {
                // The current value of _kama is represented by itself (_kama)
                // or _kama.Current.Value
                Plot("KaufmanAdaptiveMovingAverage", "kama", _kama);
                
            }
        }
    }
    class KaufmanAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kama = self.KAMA("SPY", 20, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.kama.IsReady:
                # The current value of self.kama is represented by self.kama.Current.Value
                self.Plot("KaufmanAdaptiveMovingAverage", "kama", self.kama.Current.Value)
                
    

    The following reference table describes the KAMA method:

    KAMA() 1/2

                KaufmanAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.KAMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new KaufmanAdaptiveMovingAverage indicator.

    KAMA() 2/2

                KaufmanAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.KAMA (
        Symbol                           symbol,
        Int32                            period,
        Int32                            fastEmaPeriod,
        Int32                            slowEmaPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new KaufmanAdaptiveMovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a KaufmanAdaptiveMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class KaufmanAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanAdaptiveMovingAverage _kama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kama = new KaufmanAdaptiveMovingAverage(20, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _kama.Update(bar.EndTime, bar.Close);
            }
    
            if (_kama.IsReady)
            {
                // The current value of _kama is represented by itself (_kama)
                // or _kama.Current.Value
                Plot("KaufmanAdaptiveMovingAverage", "kama", _kama);
                
            }
        }
    }
    class KaufmanAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kama = KaufmanAdaptiveMovingAverage(20, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.kama.Update(bar.EndTime, bar.Close)
    
            if self.kama.IsReady:
                # The current value of self.kama is represented by self.kama.Current.Value
                self.Plot("KaufmanAdaptiveMovingAverage", "kama", self.kama.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class KaufmanAdaptiveMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanAdaptiveMovingAverage _kama;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kama = new KaufmanAdaptiveMovingAverage(20, 10, 20);
            RegisterIndicator(_symbol, _kama, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_kama.IsReady)
            {
                // The current value of _kama is represented by itself (_kama)
                // or _kama.Current.Value
                Plot("KaufmanAdaptiveMovingAverage", "kama", _kama);
                
            }
        }
    }
    class KaufmanAdaptiveMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kama = KaufmanAdaptiveMovingAverage(20, 10, 20)
            self.RegisterIndicator(self.symbol, self.kama, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.kama.IsReady:
                # The current value of self.kama is represented by self.kama.Current.Value
                self.Plot("KaufmanAdaptiveMovingAverage", "kama", self.kama.Current.Value)
                
    

    The following reference table describes the KaufmanAdaptiveMovingAverage constructor:

    KaufmanAdaptiveMovingAverage() 1/2

                KaufmanAdaptiveMovingAverage QuantConnect.Indicators.KaufmanAdaptiveMovingAverage (
        string  name,
        int     period,
        *int    fastEmaPeriod,
        *int    slowEmaPeriod
       )
            

    Initializes a new instance of the KaufmanAdaptiveMovingAverag class using the specified name and period.

    KaufmanAdaptiveMovingAverage() 2/2

                KaufmanAdaptiveMovingAverage QuantConnect.Indicators.KaufmanAdaptiveMovingAverage (
        int   period,
        *int  fastEmaPeriod,
        *int  slowEmaPeriod
       )
            

    Initializes a new instance of the KaufmanAdaptiveMovingAverag class using the specified period.

    Visualization

    The following image shows plot values of selected properties of KaufmanAdaptiveMovingAverage using the plotly library.

    KaufmanAdaptiveMovingAverage line plot.

     

    13.1.42 Kaufman Efficiency Ratio

    Introduction

    This indicator computes the Kaufman Efficiency Ratio (KER). The Kaufman Efficiency Ratio is calculated as explained here: https://www.marketvolume.com/technicalanalysis/efficiencyratio.asp

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using KER Indicator

    To create an automatic indicators for KaufmanEfficiencyRatio , call the KER helper method from the QCAlgorithm class. The KER method creates a KaufmanEfficiencyRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class KaufmanEfficiencyRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanEfficiencyRatio _ker;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ker = KER("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_ker.IsReady)
            {
                // The current value of _ker is represented by itself (_ker)
                // or _ker.Current.Value
                Plot("KaufmanEfficiencyRatio", "ker", _ker);
                
            }
        }
    }
    class KaufmanEfficiencyRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ker = self.KER("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.ker.IsReady:
                # The current value of self.ker is represented by self.ker.Current.Value
                self.Plot("KaufmanEfficiencyRatio", "ker", self.ker.Current.Value)
                
    

    The following reference table describes the KER method:

    KER() 1/1

                KaufmanEfficiencyRatio QuantConnect.Algorithm.QCAlgorithm.KER (
        Symbol                           symbol,
        *Int32                           period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an KaufmanEfficiencyRatio indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a KaufmanEfficiencyRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class KaufmanEfficiencyRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanEfficiencyRatio _ker;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ker = new KaufmanEfficiencyRatio(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ker.Update(bar.EndTime, bar.Close);
            }
    
            if (_ker.IsReady)
            {
                // The current value of _ker is represented by itself (_ker)
                // or _ker.Current.Value
                Plot("KaufmanEfficiencyRatio", "ker", _ker);
                
            }
        }
    }
    class KaufmanEfficiencyRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ker = KaufmanEfficiencyRatio(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ker.Update(bar.EndTime, bar.Close)
    
            if self.ker.IsReady:
                # The current value of self.ker is represented by self.ker.Current.Value
                self.Plot("KaufmanEfficiencyRatio", "ker", self.ker.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class KaufmanEfficiencyRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KaufmanEfficiencyRatio _ker;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ker = new KaufmanEfficiencyRatio(20);
            RegisterIndicator(_symbol, _ker, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ker.IsReady)
            {
                // The current value of _ker is represented by itself (_ker)
                // or _ker.Current.Value
                Plot("KaufmanEfficiencyRatio", "ker", _ker);
                
            }
        }
    }
    class KaufmanEfficiencyRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ker = KaufmanEfficiencyRatio(20)
            self.RegisterIndicator(self.symbol, self.ker, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ker.IsReady:
                # The current value of self.ker is represented by self.ker.Current.Value
                self.Plot("KaufmanEfficiencyRatio", "ker", self.ker.Current.Value)
                
    

    The following reference table describes the KaufmanEfficiencyRatio constructor:

    KaufmanEfficiencyRatio() 1/2

                KaufmanEfficiencyRatio QuantConnect.Indicators.KaufmanEfficiencyRatio (
        string  name,
        int     period
       )
            

    Initializes a new instance of the KaufmanEfficiencyRati class using the specified name and period.

    KaufmanEfficiencyRatio() 2/2

                KaufmanEfficiencyRatio QuantConnect.Indicators.KaufmanEfficiencyRatio (
        int  period
       )
            

    Initializes a new instance of the KaufmanEfficiencyRati class using the specified period.

    Visualization

    The following image shows plot values of selected properties of KaufmanEfficiencyRatio using the plotly library.

    KaufmanEfficiencyRatio line plot.

     

    13.1.43 Keltner Channels

    Introduction

    This indicator creates a moving average (middle band) with an upper band and lower band fixed at k average True range multiples away from the middle band.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using KCH Indicator

    To create an automatic indicators for KeltnerChannels , call the KCH helper method from the QCAlgorithm class. The KCH method creates a KeltnerChannels object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class KeltnerChannelsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KeltnerChannels _kch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kch = KCH("SPY", 20, 2, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_kch.IsReady)
            {
                // The current value of _kch is represented by itself (_kch)
                // or _kch.Current.Value
                Plot("KeltnerChannels", "kch", _kch);
                // Plot all properties of kch
                Plot("KeltnerChannels", "middleband", _kch.MiddleBand);
                Plot("KeltnerChannels", "upperband", _kch.UpperBand);
                Plot("KeltnerChannels", "lowerband", _kch.LowerBand);
                Plot("KeltnerChannels", "averagetruerange", _kch.AverageTrueRange);
            }
        }
    }
    class KeltnerChannelsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kch = self.KCH("SPY", 20, 2, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.kch.IsReady:
                # The current value of self.kch is represented by self.kch.Current.Value
                self.Plot("KeltnerChannels", "kch", self.kch.Current.Value)
                # Plot all attributes of self.kch
                self.Plot("KeltnerChannels", "middleband", self.kch.MiddleBand.Current.Value)
                self.Plot("KeltnerChannels", "upperband", self.kch.UpperBand.Current.Value)
                self.Plot("KeltnerChannels", "lowerband", self.kch.LowerBand.Current.Value)
                self.Plot("KeltnerChannels", "averagetruerange", self.kch.AverageTrueRange.Current.Value)
    

    The following reference table describes the KCH method:

    KCH() 1/1

                KeltnerChannels QuantConnect.Algorithm.QCAlgorithm.KCH (
        Symbol                                symbol,
        Int32                                 period,
        Decimal                               k,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Keltner Channels indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a KeltnerChannels indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class KeltnerChannelsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KeltnerChannels _kch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kch = new KeltnerChannels(20, 2, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _kch.Update(bar);
            }
    
            if (_kch.IsReady)
            {
                // The current value of _kch is represented by itself (_kch)
                // or _kch.Current.Value
                Plot("KeltnerChannels", "kch", _kch);
                // Plot all properties of kch
                Plot("KeltnerChannels", "middleband", _kch.MiddleBand);
                Plot("KeltnerChannels", "upperband", _kch.UpperBand);
                Plot("KeltnerChannels", "lowerband", _kch.LowerBand);
                Plot("KeltnerChannels", "averagetruerange", _kch.AverageTrueRange);
            }
        }
    }
    class KeltnerChannelsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kch = KeltnerChannels(20, 2, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.kch.Update(bar)
    
            if self.kch.IsReady:
                # The current value of self.kch is represented by self.kch.Current.Value
                self.Plot("KeltnerChannels", "kch", self.kch.Current.Value)
                # Plot all attributes of self.kch
                self.Plot("KeltnerChannels", "middleband", self.kch.MiddleBand.Current.Value)
                self.Plot("KeltnerChannels", "upperband", self.kch.UpperBand.Current.Value)
                self.Plot("KeltnerChannels", "lowerband", self.kch.LowerBand.Current.Value)
                self.Plot("KeltnerChannels", "averagetruerange", self.kch.AverageTrueRange.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class KeltnerChannelsAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private KeltnerChannels _kch;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _kch = new KeltnerChannels(20, 2, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _kch, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_kch.IsReady)
            {
                // The current value of _kch is represented by itself (_kch)
                // or _kch.Current.Value
                Plot("KeltnerChannels", "kch", _kch);
                // Plot all properties of kch
                Plot("KeltnerChannels", "middleband", _kch.MiddleBand);
                Plot("KeltnerChannels", "upperband", _kch.UpperBand);
                Plot("KeltnerChannels", "lowerband", _kch.LowerBand);
                Plot("KeltnerChannels", "averagetruerange", _kch.AverageTrueRange);
            }
        }
    }
    class KeltnerChannelsAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.kch = KeltnerChannels(20, 2, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.kch, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.kch.IsReady:
                # The current value of self.kch is represented by self.kch.Current.Value
                self.Plot("KeltnerChannels", "kch", self.kch.Current.Value)
                # Plot all attributes of self.kch
                self.Plot("KeltnerChannels", "middleband", self.kch.MiddleBand.Current.Value)
                self.Plot("KeltnerChannels", "upperband", self.kch.UpperBand.Current.Value)
                self.Plot("KeltnerChannels", "lowerband", self.kch.LowerBand.Current.Value)
                self.Plot("KeltnerChannels", "averagetruerange", self.kch.AverageTrueRange.Current.Value)
    

    The following reference table describes the KeltnerChannels constructor:

    KeltnerChannels() 1/2

                KeltnerChannels QuantConnect.Indicators.KeltnerChannels (
        int                 period,
        decimal             k,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the KeltnerChannels class.

    KeltnerChannels() 2/2

                KeltnerChannels QuantConnect.Indicators.KeltnerChannels (
        string              name,
        int                 period,
        decimal             k,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the KeltnerChannels class.

    Visualization

    The following image shows plot values of selected properties of KeltnerChannels using the plotly library.

    KeltnerChannels line plot.

     

    13.1.44 Least Squares Moving Average

    Introduction

    The Least Squares Moving Average (LSMA) first calculates a least squares regression line over the preceding time periods, and then projects it forward to the current period. In essence, it calculates what the value would be if the regression line continued. source

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using LSMA Indicator

    To create an automatic indicators for LeastSquaresMovingAverage , call the LSMA helper method from the QCAlgorithm class. The LSMA method creates a LeastSquaresMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LeastSquaresMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LeastSquaresMovingAverage _lsma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lsma = LSMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_lsma.IsReady)
            {
                // The current value of _lsma is represented by itself (_lsma)
                // or _lsma.Current.Value
                Plot("LeastSquaresMovingAverage", "lsma", _lsma);
                // Plot all properties of lsma
                Plot("LeastSquaresMovingAverage", "intercept", _lsma.Intercept);
                Plot("LeastSquaresMovingAverage", "slope", _lsma.Slope);
            }
        }
    }
    class LeastSquaresMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lsma = self.LSMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.lsma.IsReady:
                # The current value of self.lsma is represented by self.lsma.Current.Value
                self.Plot("LeastSquaresMovingAverage", "lsma", self.lsma.Current.Value)
                # Plot all attributes of self.lsma
                self.Plot("LeastSquaresMovingAverage", "intercept", self.lsma.Intercept.Current.Value)
                self.Plot("LeastSquaresMovingAverage", "slope", self.lsma.Slope.Current.Value)
    

    The following reference table describes the LSMA method:

    LSMA() 1/1

                LeastSquaresMovingAverage QuantConnect.Algorithm.QCAlgorithm.LSMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates and registers a new Least Squares Moving Average instance.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LeastSquaresMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class LeastSquaresMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LeastSquaresMovingAverage _lsma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lsma = new LeastSquaresMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _lsma.Update(bar.EndTime, bar.Close);
            }
    
            if (_lsma.IsReady)
            {
                // The current value of _lsma is represented by itself (_lsma)
                // or _lsma.Current.Value
                Plot("LeastSquaresMovingAverage", "lsma", _lsma);
                // Plot all properties of lsma
                Plot("LeastSquaresMovingAverage", "intercept", _lsma.Intercept);
                Plot("LeastSquaresMovingAverage", "slope", _lsma.Slope);
            }
        }
    }
    class LeastSquaresMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lsma = LeastSquaresMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.lsma.Update(bar.EndTime, bar.Close)
    
            if self.lsma.IsReady:
                # The current value of self.lsma is represented by self.lsma.Current.Value
                self.Plot("LeastSquaresMovingAverage", "lsma", self.lsma.Current.Value)
                # Plot all attributes of self.lsma
                self.Plot("LeastSquaresMovingAverage", "intercept", self.lsma.Intercept.Current.Value)
                self.Plot("LeastSquaresMovingAverage", "slope", self.lsma.Slope.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LeastSquaresMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LeastSquaresMovingAverage _lsma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lsma = new LeastSquaresMovingAverage(20);
            RegisterIndicator(_symbol, _lsma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_lsma.IsReady)
            {
                // The current value of _lsma is represented by itself (_lsma)
                // or _lsma.Current.Value
                Plot("LeastSquaresMovingAverage", "lsma", _lsma);
                // Plot all properties of lsma
                Plot("LeastSquaresMovingAverage", "intercept", _lsma.Intercept);
                Plot("LeastSquaresMovingAverage", "slope", _lsma.Slope);
            }
        }
    }
    class LeastSquaresMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lsma = LeastSquaresMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.lsma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.lsma.IsReady:
                # The current value of self.lsma is represented by self.lsma.Current.Value
                self.Plot("LeastSquaresMovingAverage", "lsma", self.lsma.Current.Value)
                # Plot all attributes of self.lsma
                self.Plot("LeastSquaresMovingAverage", "intercept", self.lsma.Intercept.Current.Value)
                self.Plot("LeastSquaresMovingAverage", "slope", self.lsma.Slope.Current.Value)
    

    The following reference table describes the LeastSquaresMovingAverage constructor:

    LeastSquaresMovingAverage() 1/2

                LeastSquaresMovingAverage QuantConnect.Indicators.LeastSquaresMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the LeastSquaresMovingAverag class.

    LeastSquaresMovingAverage() 2/2

                LeastSquaresMovingAverage QuantConnect.Indicators.LeastSquaresMovingAverage (
        int  period
       )
            

    Initializes a new instance of the LeastSquaresMovingAverag class.

    Visualization

    The following image shows plot values of selected properties of LeastSquaresMovingAverage using the plotly library.

    LeastSquaresMovingAverage line plot.

     

    13.1.45 Linear Weighted Moving Average

    Introduction

    This indicator represents the traditional Weighted Moving Average indicator. The weight are linearly distributed according to the number of periods in the indicator. For example, a 4 period indicator will have a numerator of (4 * window[0]) + (3 * window[1]) + (2 * window[2]) + window[3] and a denominator of 4 + 3 + 2 + 1 = 10 During the warm up period, IsReady will return False, but the LWMA will still be computed correctly because the denominator will be the minimum of Samples factorial or Size factorial and the computation iterates over that minimum value. The RollingWindow of inputs is created when the indicator is created. A RollingWindow of LWMAs is not saved. That is up to the caller.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using LWMA Indicator

    To create an automatic indicators for LinearWeightedMovingAverage , call the LWMA helper method from the QCAlgorithm class. The LWMA method creates a LinearWeightedMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LinearWeightedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LinearWeightedMovingAverage _lwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lwma = LWMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_lwma.IsReady)
            {
                // The current value of _lwma is represented by itself (_lwma)
                // or _lwma.Current.Value
                Plot("LinearWeightedMovingAverage", "lwma", _lwma);
                
            }
        }
    }
    class LinearWeightedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lwma = self.LWMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.lwma.IsReady:
                # The current value of self.lwma is represented by self.lwma.Current.Value
                self.Plot("LinearWeightedMovingAverage", "lwma", self.lwma.Current.Value)
                
    

    The following reference table describes the LWMA method:

    LWMA() 1/1

                LinearWeightedMovingAverage QuantConnect.Algorithm.QCAlgorithm.LWMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new LinearWeightedMovingAverage indicator. This indicator will linearly distribute the weights across the periods.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LinearWeightedMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class LinearWeightedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LinearWeightedMovingAverage _lwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lwma = new LinearWeightedMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _lwma.Update(bar.EndTime, bar.Close);
            }
    
            if (_lwma.IsReady)
            {
                // The current value of _lwma is represented by itself (_lwma)
                // or _lwma.Current.Value
                Plot("LinearWeightedMovingAverage", "lwma", _lwma);
                
            }
        }
    }
    class LinearWeightedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lwma = LinearWeightedMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.lwma.Update(bar.EndTime, bar.Close)
    
            if self.lwma.IsReady:
                # The current value of self.lwma is represented by self.lwma.Current.Value
                self.Plot("LinearWeightedMovingAverage", "lwma", self.lwma.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LinearWeightedMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LinearWeightedMovingAverage _lwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _lwma = new LinearWeightedMovingAverage(20);
            RegisterIndicator(_symbol, _lwma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_lwma.IsReady)
            {
                // The current value of _lwma is represented by itself (_lwma)
                // or _lwma.Current.Value
                Plot("LinearWeightedMovingAverage", "lwma", _lwma);
                
            }
        }
    }
    class LinearWeightedMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.lwma = LinearWeightedMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.lwma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.lwma.IsReady:
                # The current value of self.lwma is represented by self.lwma.Current.Value
                self.Plot("LinearWeightedMovingAverage", "lwma", self.lwma.Current.Value)
                
    

    The following reference table describes the LinearWeightedMovingAverage constructor:

    LinearWeightedMovingAverage() 1/2

                LinearWeightedMovingAverage QuantConnect.Indicators.LinearWeightedMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the LinearWeightedMovingAverage class with the specified name and period.

    LinearWeightedMovingAverage() 2/2

                LinearWeightedMovingAverage QuantConnect.Indicators.LinearWeightedMovingAverage (
        int  period
       )
            

    Initializes a new instance of the LinearWeightedMovingAverage class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of LinearWeightedMovingAverage using the plotly library.

    LinearWeightedMovingAverage line plot.

     

    13.1.46 Log Return

    Introduction

    This indicator represents the LogReturn indicator (LOGR) - log returns are useful for identifying price convergence/divergence in a given period - logr = log (current price / last price in period)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using LOGR Indicator

    To create an automatic indicators for LogReturn , call the LOGR helper method from the QCAlgorithm class. The LOGR method creates a LogReturn object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class LogReturnAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LogReturn _logr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _logr = LOGR("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_logr.IsReady)
            {
                // The current value of _logr is represented by itself (_logr)
                // or _logr.Current.Value
                Plot("LogReturn", "logr", _logr);
                
            }
        }
    }
    class LogReturnAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.logr = self.LOGR("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.logr.IsReady:
                # The current value of self.logr is represented by self.logr.Current.Value
                self.Plot("LogReturn", "logr", self.logr.Current.Value)
                
    

    The following reference table describes the LOGR method:

    LOGR() 1/1

                LogReturn QuantConnect.Algorithm.QCAlgorithm.LOGR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new LogReturn indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a LogReturn indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class LogReturnAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LogReturn _logr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _logr = new LogReturn(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _logr.Update(bar.EndTime, bar.Close);
            }
    
            if (_logr.IsReady)
            {
                // The current value of _logr is represented by itself (_logr)
                // or _logr.Current.Value
                Plot("LogReturn", "logr", _logr);
                
            }
        }
    }
    class LogReturnAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.logr = LogReturn(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.logr.Update(bar.EndTime, bar.Close)
    
            if self.logr.IsReady:
                # The current value of self.logr is represented by self.logr.Current.Value
                self.Plot("LogReturn", "logr", self.logr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class LogReturnAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private LogReturn _logr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _logr = new LogReturn(20);
            RegisterIndicator(_symbol, _logr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_logr.IsReady)
            {
                // The current value of _logr is represented by itself (_logr)
                // or _logr.Current.Value
                Plot("LogReturn", "logr", _logr);
                
            }
        }
    }
    class LogReturnAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.logr = LogReturn(20)
            self.RegisterIndicator(self.symbol, self.logr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.logr.IsReady:
                # The current value of self.logr is represented by self.logr.Current.Value
                self.Plot("LogReturn", "logr", self.logr.Current.Value)
                
    

    The following reference table describes the LogReturn constructor:

    LogReturn() 1/2

                LogReturn QuantConnect.Indicators.LogReturn (
        string  name,
        int     period
       )
            

    Initializes a new instance of the LogReturn class with the specified name and period.

    LogReturn() 2/2

                LogReturn QuantConnect.Indicators.LogReturn (
        int  period
       )
            

    Initializes a new instance of the LogReturn class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of LogReturn using the plotly library.

    LogReturn line plot.

     

    13.1.47 Mass Index

    Introduction

    The Mass Index uses the high-low range to identify trend reversals based on range expansions. In this sense, the Mass Index is a volatility indicator that does not have a directional bias. Instead, the Mass Index identifies range bulges that can foreshadow a reversal of the current trend. Developed by Donald Dorsey.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MASS Indicator

    To create an automatic indicators for MassIndex , call the MASS helper method from the QCAlgorithm class. The MASS method creates a MassIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MassIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MassIndex _mass;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mass = MASS("SPY", 9, 25);
        }
    
        public override void OnData(Slice data)
        {
            if (_mass.IsReady)
            {
                // The current value of _mass is represented by itself (_mass)
                // or _mass.Current.Value
                Plot("MassIndex", "mass", _mass);
                
            }
        }
    }
    class MassIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mass = self.MASS("SPY", 9, 25)
    
        def OnData(self, slice: Slice) -> None:
            if self.mass.IsReady:
                # The current value of self.mass is represented by self.mass.Current.Value
                self.Plot("MassIndex", "mass", self.mass.Current.Value)
                
    

    The following reference table describes the MASS method:

    MASS() 1/1

                MassIndex QuantConnect.Algorithm.QCAlgorithm.MASS (
        Symbol                            symbol,
        *Int32                            emaPeriod,
        *Int32                            sumPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Mass Index indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MassIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MassIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MassIndex _mass;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mass = new MassIndex(9, 25);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mass.Update(bar);
            }
    
            if (_mass.IsReady)
            {
                // The current value of _mass is represented by itself (_mass)
                // or _mass.Current.Value
                Plot("MassIndex", "mass", _mass);
                
            }
        }
    }
    class MassIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mass = MassIndex(9, 25)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mass.Update(bar)
    
            if self.mass.IsReady:
                # The current value of self.mass is represented by self.mass.Current.Value
                self.Plot("MassIndex", "mass", self.mass.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MassIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MassIndex _mass;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mass = new MassIndex(9, 25);
            RegisterIndicator(_symbol, _mass, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mass.IsReady)
            {
                // The current value of _mass is represented by itself (_mass)
                // or _mass.Current.Value
                Plot("MassIndex", "mass", _mass);
                
            }
        }
    }
    class MassIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mass = MassIndex(9, 25)
            self.RegisterIndicator(self.symbol, self.mass, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mass.IsReady:
                # The current value of self.mass is represented by self.mass.Current.Value
                self.Plot("MassIndex", "mass", self.mass.Current.Value)
                
    

    The following reference table describes the MassIndex constructor:

    MassIndex() 1/2

                MassIndex QuantConnect.Indicators.MassIndex (
        string  name,
        int     emaPeriod,
        int     sumPeriod
       )
            

    Initializes a new instance of the MassInde class.

    MassIndex() 2/2

                MassIndex QuantConnect.Indicators.MassIndex (
        *int  emaPeriod,
        *int  sumPeriod
       )
            

    Initializes a new instance of the MassInde class.

    Visualization

    The following image shows plot values of selected properties of MassIndex using the plotly library.

    MassIndex line plot.

     

    13.1.48 Maximum

    Introduction

    This indicator represents an indicator capable of tracking the maximum value and how many periods ago it occurred

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MAX Indicator

    To create an automatic indicators for Maximum , call the MAX helper method from the QCAlgorithm class. The MAX method creates a Maximum object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MaximumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Maximum _max;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _max = MAX("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_max.IsReady)
            {
                // The current value of _max is represented by itself (_max)
                // or _max.Current.Value
                Plot("Maximum", "max", _max);
                // Plot all properties of max
                Plot("Maximum", "periodssincemaximum", _max.PeriodsSinceMaximum);
            }
        }
    }
    class MaximumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.max = self.MAX("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.max.IsReady:
                # The current value of self.max is represented by self.max.Current.Value
                self.Plot("Maximum", "max", self.max.Current.Value)
                # Plot all attributes of self.max
                self.Plot("Maximum", "periodssincemaximum", self.max.PeriodsSinceMaximum.Current.Value)
    

    The following reference table describes the MAX method:

    MAX() 1/1

                Maximum QuantConnect.Algorithm.QCAlgorithm.MAX (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Maximum indicator to compute the maximum value.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Maximum indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MaximumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Maximum _max;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _max = new Maximum(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _max.Update(bar.EndTime, bar.Close);
            }
    
            if (_max.IsReady)
            {
                // The current value of _max is represented by itself (_max)
                // or _max.Current.Value
                Plot("Maximum", "max", _max);
                // Plot all properties of max
                Plot("Maximum", "periodssincemaximum", _max.PeriodsSinceMaximum);
            }
        }
    }
    class MaximumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.max = Maximum(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.max.Update(bar.EndTime, bar.Close)
    
            if self.max.IsReady:
                # The current value of self.max is represented by self.max.Current.Value
                self.Plot("Maximum", "max", self.max.Current.Value)
                # Plot all attributes of self.max
                self.Plot("Maximum", "periodssincemaximum", self.max.PeriodsSinceMaximum.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MaximumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Maximum _max;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _max = new Maximum(20);
            RegisterIndicator(_symbol, _max, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_max.IsReady)
            {
                // The current value of _max is represented by itself (_max)
                // or _max.Current.Value
                Plot("Maximum", "max", _max);
                // Plot all properties of max
                Plot("Maximum", "periodssincemaximum", _max.PeriodsSinceMaximum);
            }
        }
    }
    class MaximumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.max = Maximum(20)
            self.RegisterIndicator(self.symbol, self.max, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.max.IsReady:
                # The current value of self.max is represented by self.max.Current.Value
                self.Plot("Maximum", "max", self.max.Current.Value)
                # Plot all attributes of self.max
                self.Plot("Maximum", "periodssincemaximum", self.max.PeriodsSinceMaximum.Current.Value)
    

    The following reference table describes the Maximum constructor:

    Maximum() 1/2

                Maximum QuantConnect.Indicators.Maximum (
        int  period
       )
            

    Creates a new Maximum indicator with the specified period.

    Maximum() 2/2

                Maximum QuantConnect.Indicators.Maximum (
        string  name,
        int     period
       )
            

    Creates a new Maximum indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of Maximum using the plotly library.

    Maximum line plot.

     

    13.1.49 Mc Clellan Oscillator

    Introduction

    The McClellan Oscillator is a market breadth indicator which was developed by Sherman and Marian McClellan. It is based on the difference between the number of advancing and declining periods.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MOSC Indicator

    To create an automatic indicators for McClellanOscillator , call the MOSC helper method from the QCAlgorithm class. The MOSC method creates a McClellanOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class McClellanOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanOscillator _mosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mosc = MOSC(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_mosc.IsReady)
            {
                // The current value of _mosc is represented by itself (_mosc)
                // or _mosc.Current.Value
                Plot("McClellanOscillator", "mosc", _mosc);
                // Plot all properties of mosc
                Plot("McClellanOscillator", "emafast", _mosc.EMAFast);
                Plot("McClellanOscillator", "emaslow", _mosc.EMASlow);
                Plot("McClellanOscillator", "addifference", _mosc.ADDifference);
            }
        }
    }
    class McClellanOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mosc = self.MOSC(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.mosc.IsReady:
                # The current value of self.mosc is represented by self.mosc.Current.Value
                self.Plot("McClellanOscillator", "mosc", self.mosc.Current.Value)
                # Plot all attributes of self.mosc
                self.Plot("McClellanOscillator", "emafast", self.mosc.EMAFast.Current.Value)
                self.Plot("McClellanOscillator", "emaslow", self.mosc.EMASlow.Current.Value)
                self.Plot("McClellanOscillator", "addifference", self.mosc.ADDifference.Current.Value)
    

    The following reference table describes the MOSC method:

    MOSC() 1/2

                McClellanOscillator QuantConnect.Algorithm.QCAlgorithm.MOSC (
        IEnumerable<Symbol>         symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Oscillator indicator.

    MOSC() 2/2

                McClellanOscillator QuantConnect.Algorithm.QCAlgorithm.MOSC (
        Symbol>                        symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Oscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a McClellanOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class McClellanOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanOscillator _mosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mosc = new McClellanOscillator("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mosc.Update(bar);
            }
    
            if (_mosc.IsReady)
            {
                // The current value of _mosc is represented by itself (_mosc)
                // or _mosc.Current.Value
                Plot("McClellanOscillator", "mosc", _mosc);
                // Plot all properties of mosc
                Plot("McClellanOscillator", "emafast", _mosc.EMAFast);
                Plot("McClellanOscillator", "emaslow", _mosc.EMASlow);
                Plot("McClellanOscillator", "addifference", _mosc.ADDifference);
            }
        }
    }
    class McClellanOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mosc = McClellanOscillator("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mosc.Update(bar)
    
            if self.mosc.IsReady:
                # The current value of self.mosc is represented by self.mosc.Current.Value
                self.Plot("McClellanOscillator", "mosc", self.mosc.Current.Value)
                # Plot all attributes of self.mosc
                self.Plot("McClellanOscillator", "emafast", self.mosc.EMAFast.Current.Value)
                self.Plot("McClellanOscillator", "emaslow", self.mosc.EMASlow.Current.Value)
                self.Plot("McClellanOscillator", "addifference", self.mosc.ADDifference.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class McClellanOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanOscillator _mosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mosc = new McClellanOscillator("QQQ"]);
            RegisterIndicator(_symbol, _mosc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mosc.IsReady)
            {
                // The current value of _mosc is represented by itself (_mosc)
                // or _mosc.Current.Value
                Plot("McClellanOscillator", "mosc", _mosc);
                // Plot all properties of mosc
                Plot("McClellanOscillator", "emafast", _mosc.EMAFast);
                Plot("McClellanOscillator", "emaslow", _mosc.EMASlow);
                Plot("McClellanOscillator", "addifference", _mosc.ADDifference);
            }
        }
    }
    class McClellanOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mosc = McClellanOscillator("QQQ"])
            self.RegisterIndicator(self.symbol, self.mosc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mosc.IsReady:
                # The current value of self.mosc is represented by self.mosc.Current.Value
                self.Plot("McClellanOscillator", "mosc", self.mosc.Current.Value)
                # Plot all attributes of self.mosc
                self.Plot("McClellanOscillator", "emafast", self.mosc.EMAFast.Current.Value)
                self.Plot("McClellanOscillator", "emaslow", self.mosc.EMASlow.Current.Value)
                self.Plot("McClellanOscillator", "addifference", self.mosc.ADDifference.Current.Value)
    

    The following reference table describes the McClellanOscillator constructor:

    McClellanOscillator() 1/2

                McClellanOscillator QuantConnect.Indicators.McClellanOscillator (
        string  name,
        *int    fastPeriod,
        *int    slowPeriod
       )
            

    The slow period of EMA of advance decline difference.

    McClellanOscillator() 2/2

                McClellanOscillator QuantConnect.Indicators.McClellanOscillator (
        *int  fastPeriod,
        *int  slowPeriod
       )
            

    The slow period of EMA of advance decline difference.

    Visualization

    The following image shows plot values of selected properties of McClellanOscillator using the plotly library.

    McClellanOscillator line plot.

     

    13.1.50 Mc Clellan Summation Index

    Introduction

    The McClellan Summation Index (MSI) is a market breadth indicator that is based on the rolling average of difference between the number of advancing and declining issues on a stock exchange. It is generally considered as is a long-term version of the

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MSI Indicator

    To create an automatic indicators for McClellanSummationIndex , call the MSI helper method from the QCAlgorithm class. The MSI method creates a McClellanSummationIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class McClellanSummationIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanSummationIndex _msi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _msi = MSI(["SPY", "QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (_msi.IsReady)
            {
                // The current value of _msi is represented by itself (_msi)
                // or _msi.Current.Value
                Plot("McClellanSummationIndex", "msi", _msi);
                // Plot all properties of msi
                Plot("McClellanSummationIndex", "mcclellanoscillator", _msi.McClellanOscillator);
            }
        }
    }
    class McClellanSummationIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.msi = self.MSI(["SPY", "QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            if self.msi.IsReady:
                # The current value of self.msi is represented by self.msi.Current.Value
                self.Plot("McClellanSummationIndex", "msi", self.msi.Current.Value)
                # Plot all attributes of self.msi
                self.Plot("McClellanSummationIndex", "mcclellanoscillator", self.msi.McClellanOscillator.Current.Value)
    

    The following reference table describes the MSI method:

    MSI() 1/2

                McClellanSummationIndex QuantConnect.Algorithm.QCAlgorithm.MSI (
        IEnumerable<Symbol>         symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Summation Index indicator.

    MSI() 2/2

                McClellanSummationIndex QuantConnect.Algorithm.QCAlgorithm.MSI (
        Symbol>                        symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Summation Index indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a McClellanSummationIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class McClellanSummationIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanSummationIndex _msi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _msi = new McClellanSummationIndex("QQQ"]);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _msi.Update(bar);
            }
    
            if (_msi.IsReady)
            {
                // The current value of _msi is represented by itself (_msi)
                // or _msi.Current.Value
                Plot("McClellanSummationIndex", "msi", _msi);
                // Plot all properties of msi
                Plot("McClellanSummationIndex", "mcclellanoscillator", _msi.McClellanOscillator);
            }
        }
    }
    class McClellanSummationIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.msi = McClellanSummationIndex("QQQ"])
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.msi.Update(bar)
    
            if self.msi.IsReady:
                # The current value of self.msi is represented by self.msi.Current.Value
                self.Plot("McClellanSummationIndex", "msi", self.msi.Current.Value)
                # Plot all attributes of self.msi
                self.Plot("McClellanSummationIndex", "mcclellanoscillator", self.msi.McClellanOscillator.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class McClellanSummationIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private McClellanSummationIndex _msi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _msi = new McClellanSummationIndex("QQQ"]);
            RegisterIndicator(_symbol, _msi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_msi.IsReady)
            {
                // The current value of _msi is represented by itself (_msi)
                // or _msi.Current.Value
                Plot("McClellanSummationIndex", "msi", _msi);
                // Plot all properties of msi
                Plot("McClellanSummationIndex", "mcclellanoscillator", _msi.McClellanOscillator);
            }
        }
    }
    class McClellanSummationIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.msi = McClellanSummationIndex("QQQ"])
            self.RegisterIndicator(self.symbol, self.msi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.msi.IsReady:
                # The current value of self.msi is represented by self.msi.Current.Value
                self.Plot("McClellanSummationIndex", "msi", self.msi.Current.Value)
                # Plot all attributes of self.msi
                self.Plot("McClellanSummationIndex", "mcclellanoscillator", self.msi.McClellanOscillator.Current.Value)
    

    The following reference table describes the McClellanSummationIndex constructor:

    McClellanSummationIndex() 1/2

                McClellanSummationIndex QuantConnect.Indicators.McClellanSummationIndex (
        string  name,
        *int    fastPeriod,
        *int    slowPeriod
       )
            

    The slow period of EMA of advance decline difference.

    McClellanSummationIndex() 2/2

                McClellanSummationIndex QuantConnect.Indicators.McClellanSummationIndex (
        *int  fastPeriod,
        *int  slowPeriod
       )
            

    The slow period of EMA of advance decline difference.

    Visualization

    The following image shows plot values of selected properties of McClellanSummationIndex using the plotly library.

    McClellanSummationIndex line plot.

     

    13.1.51 Mean Absolute Deviation

    Introduction

    This indicator computes the n-period mean absolute deviation.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MAD Indicator

    To create an automatic indicators for MeanAbsoluteDeviation , call the MAD helper method from the QCAlgorithm class. The MAD method creates a MeanAbsoluteDeviation object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MeanAbsoluteDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MeanAbsoluteDeviation _mad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mad = MAD("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_mad.IsReady)
            {
                // The current value of _mad is represented by itself (_mad)
                // or _mad.Current.Value
                Plot("MeanAbsoluteDeviation", "mad", _mad);
                // Plot all properties of mad
                Plot("MeanAbsoluteDeviation", "mean", _mad.Mean);
            }
        }
    }
    class MeanAbsoluteDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mad = self.MAD("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.mad.IsReady:
                # The current value of self.mad is represented by self.mad.Current.Value
                self.Plot("MeanAbsoluteDeviation", "mad", self.mad.Current.Value)
                # Plot all attributes of self.mad
                self.Plot("MeanAbsoluteDeviation", "mean", self.mad.Mean.Current.Value)
    

    The following reference table describes the MAD method:

    MAD() 1/1

                MeanAbsoluteDeviation QuantConnect.Algorithm.QCAlgorithm.MAD (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MeanAbsoluteDeviation indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MeanAbsoluteDeviation indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MeanAbsoluteDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MeanAbsoluteDeviation _mad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mad = new MeanAbsoluteDeviation(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mad.Update(bar.EndTime, bar.Close);
            }
    
            if (_mad.IsReady)
            {
                // The current value of _mad is represented by itself (_mad)
                // or _mad.Current.Value
                Plot("MeanAbsoluteDeviation", "mad", _mad);
                // Plot all properties of mad
                Plot("MeanAbsoluteDeviation", "mean", _mad.Mean);
            }
        }
    }
    class MeanAbsoluteDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mad = MeanAbsoluteDeviation(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mad.Update(bar.EndTime, bar.Close)
    
            if self.mad.IsReady:
                # The current value of self.mad is represented by self.mad.Current.Value
                self.Plot("MeanAbsoluteDeviation", "mad", self.mad.Current.Value)
                # Plot all attributes of self.mad
                self.Plot("MeanAbsoluteDeviation", "mean", self.mad.Mean.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MeanAbsoluteDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MeanAbsoluteDeviation _mad;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mad = new MeanAbsoluteDeviation(20);
            RegisterIndicator(_symbol, _mad, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mad.IsReady)
            {
                // The current value of _mad is represented by itself (_mad)
                // or _mad.Current.Value
                Plot("MeanAbsoluteDeviation", "mad", _mad);
                // Plot all properties of mad
                Plot("MeanAbsoluteDeviation", "mean", _mad.Mean);
            }
        }
    }
    class MeanAbsoluteDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mad = MeanAbsoluteDeviation(20)
            self.RegisterIndicator(self.symbol, self.mad, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mad.IsReady:
                # The current value of self.mad is represented by self.mad.Current.Value
                self.Plot("MeanAbsoluteDeviation", "mad", self.mad.Current.Value)
                # Plot all attributes of self.mad
                self.Plot("MeanAbsoluteDeviation", "mean", self.mad.Mean.Current.Value)
    

    The following reference table describes the MeanAbsoluteDeviation constructor:

    MeanAbsoluteDeviation() 1/2

                MeanAbsoluteDeviation QuantConnect.Indicators.MeanAbsoluteDeviation (
        int  period
       )
            

    Evaluates the mean absolute deviation of samples in the lookback period.

    MeanAbsoluteDeviation() 2/2

                MeanAbsoluteDeviation QuantConnect.Indicators.MeanAbsoluteDeviation (
        string  name,
        int     period
       )
            

    Evaluates the mean absolute deviation of samples in the look-back period.

    Visualization

    The following image shows plot values of selected properties of MeanAbsoluteDeviation using the plotly library.

    MeanAbsoluteDeviation line plot.

     

    13.1.52 Mid Point

    Introduction

    This indicator computes the MidPoint (MIDPOINT) The MidPoint is calculated using the following formula: MIDPOINT = (Highest Value + Lowest Value) / 2

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MIDPOINT Indicator

    To create an automatic indicators for MidPoint , call the MIDPOINT helper method from the QCAlgorithm class. The MIDPOINT method creates a MidPoint object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MidPointAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPoint _midpoint;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midpoint = MIDPOINT("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_midpoint.IsReady)
            {
                // The current value of _midpoint is represented by itself (_midpoint)
                // or _midpoint.Current.Value
                Plot("MidPoint", "midpoint", _midpoint);
                
            }
        }
    }
    class MidPointAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midpoint = self.MIDPOINT("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.midpoint.IsReady:
                # The current value of self.midpoint is represented by self.midpoint.Current.Value
                self.Plot("MidPoint", "midpoint", self.midpoint.Current.Value)
                
    

    The following reference table describes the MIDPOINT method:

    MIDPOINT() 1/1

                MidPoint QuantConnect.Algorithm.QCAlgorithm.MIDPOINT (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MidPoint indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MidPoint indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MidPointAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPoint _midpoint;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midpoint = new MidPoint(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _midpoint.Update(bar.EndTime, bar.Close);
            }
    
            if (_midpoint.IsReady)
            {
                // The current value of _midpoint is represented by itself (_midpoint)
                // or _midpoint.Current.Value
                Plot("MidPoint", "midpoint", _midpoint);
                
            }
        }
    }
    class MidPointAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midpoint = MidPoint(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.midpoint.Update(bar.EndTime, bar.Close)
    
            if self.midpoint.IsReady:
                # The current value of self.midpoint is represented by self.midpoint.Current.Value
                self.Plot("MidPoint", "midpoint", self.midpoint.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MidPointAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPoint _midpoint;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midpoint = new MidPoint(20);
            RegisterIndicator(_symbol, _midpoint, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_midpoint.IsReady)
            {
                // The current value of _midpoint is represented by itself (_midpoint)
                // or _midpoint.Current.Value
                Plot("MidPoint", "midpoint", _midpoint);
                
            }
        }
    }
    class MidPointAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midpoint = MidPoint(20)
            self.RegisterIndicator(self.symbol, self.midpoint, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.midpoint.IsReady:
                # The current value of self.midpoint is represented by self.midpoint.Current.Value
                self.Plot("MidPoint", "midpoint", self.midpoint.Current.Value)
                
    

    The following reference table describes the MidPoint constructor:

    MidPoint() 1/2

                MidPoint QuantConnect.Indicators.MidPoint (
        string  name,
        int     period
       )
            

    Initializes a new instance of the MidPoin class using the specified name and period.

    MidPoint() 2/2

                MidPoint QuantConnect.Indicators.MidPoint (
        int  period
       )
            

    Initializes a new instance of the MidPoin class using the specified period.

    Visualization

    The following image shows plot values of selected properties of MidPoint using the plotly library.

    MidPoint line plot.

     

    13.1.53 Mid Price

    Introduction

    This indicator computes the MidPrice (MIDPRICE). The MidPrice is calculated using the following formula: MIDPRICE = (Highest High + Lowest Low) / 2

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MIDPRICE Indicator

    To create an automatic indicators for MidPrice , call the MIDPRICE helper method from the QCAlgorithm class. The MIDPRICE method creates a MidPrice object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MidPriceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPrice _midprice;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midprice = MIDPRICE("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_midprice.IsReady)
            {
                // The current value of _midprice is represented by itself (_midprice)
                // or _midprice.Current.Value
                Plot("MidPrice", "midprice", _midprice);
                
            }
        }
    }
    class MidPriceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midprice = self.MIDPRICE("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.midprice.IsReady:
                # The current value of self.midprice is represented by self.midprice.Current.Value
                self.Plot("MidPrice", "midprice", self.midprice.Current.Value)
                
    

    The following reference table describes the MIDPRICE method:

    MIDPRICE() 1/1

                MidPrice QuantConnect.Algorithm.QCAlgorithm.MIDPRICE (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new MidPrice indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MidPrice indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class MidPriceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPrice _midprice;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midprice = new MidPrice(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _midprice.Update(bar);
            }
    
            if (_midprice.IsReady)
            {
                // The current value of _midprice is represented by itself (_midprice)
                // or _midprice.Current.Value
                Plot("MidPrice", "midprice", _midprice);
                
            }
        }
    }
    class MidPriceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midprice = MidPrice(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.midprice.Update(bar)
    
            if self.midprice.IsReady:
                # The current value of self.midprice is represented by self.midprice.Current.Value
                self.Plot("MidPrice", "midprice", self.midprice.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MidPriceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MidPrice _midprice;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _midprice = new MidPrice(20);
            RegisterIndicator(_symbol, _midprice, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_midprice.IsReady)
            {
                // The current value of _midprice is represented by itself (_midprice)
                // or _midprice.Current.Value
                Plot("MidPrice", "midprice", _midprice);
                
            }
        }
    }
    class MidPriceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.midprice = MidPrice(20)
            self.RegisterIndicator(self.symbol, self.midprice, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.midprice.IsReady:
                # The current value of self.midprice is represented by self.midprice.Current.Value
                self.Plot("MidPrice", "midprice", self.midprice.Current.Value)
                
    

    The following reference table describes the MidPrice constructor:

    MidPrice() 1/2

                MidPrice QuantConnect.Indicators.MidPrice (
        string  name,
        int     period
       )
            

    Initializes a new instance of the MidPric class using the specified name and period.

    MidPrice() 2/2

                MidPrice QuantConnect.Indicators.MidPrice (
        int  period
       )
            

    Initializes a new instance of the MidPric class using the specified period.

    Visualization

    The following image shows plot values of selected properties of MidPrice using the plotly library.

    MidPrice line plot.

     

    13.1.54 Minimum

    Introduction

    This indicator represents an indicator capable of tracking the minimum value and how many periods ago it occurred

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MIN Indicator

    To create an automatic indicators for Minimum , call the MIN helper method from the QCAlgorithm class. The MIN method creates a Minimum object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MinimumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Minimum _min;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _min = MIN("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_min.IsReady)
            {
                // The current value of _min is represented by itself (_min)
                // or _min.Current.Value
                Plot("Minimum", "min", _min);
                // Plot all properties of min
                Plot("Minimum", "periodssinceminimum", _min.PeriodsSinceMinimum);
            }
        }
    }
    class MinimumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.min = self.MIN("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.min.IsReady:
                # The current value of self.min is represented by self.min.Current.Value
                self.Plot("Minimum", "min", self.min.Current.Value)
                # Plot all attributes of self.min
                self.Plot("Minimum", "periodssinceminimum", self.min.PeriodsSinceMinimum.Current.Value)
    

    The following reference table describes the MIN method:

    MIN() 1/1

                Minimum QuantConnect.Algorithm.QCAlgorithm.MIN (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Minimum indicator to compute the minimum value.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Minimum indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MinimumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Minimum _min;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _min = new Minimum(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _min.Update(bar.EndTime, bar.Close);
            }
    
            if (_min.IsReady)
            {
                // The current value of _min is represented by itself (_min)
                // or _min.Current.Value
                Plot("Minimum", "min", _min);
                // Plot all properties of min
                Plot("Minimum", "periodssinceminimum", _min.PeriodsSinceMinimum);
            }
        }
    }
    class MinimumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.min = Minimum(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.min.Update(bar.EndTime, bar.Close)
    
            if self.min.IsReady:
                # The current value of self.min is represented by self.min.Current.Value
                self.Plot("Minimum", "min", self.min.Current.Value)
                # Plot all attributes of self.min
                self.Plot("Minimum", "periodssinceminimum", self.min.PeriodsSinceMinimum.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MinimumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Minimum _min;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _min = new Minimum(20);
            RegisterIndicator(_symbol, _min, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_min.IsReady)
            {
                // The current value of _min is represented by itself (_min)
                // or _min.Current.Value
                Plot("Minimum", "min", _min);
                // Plot all properties of min
                Plot("Minimum", "periodssinceminimum", _min.PeriodsSinceMinimum);
            }
        }
    }
    class MinimumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.min = Minimum(20)
            self.RegisterIndicator(self.symbol, self.min, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.min.IsReady:
                # The current value of self.min is represented by self.min.Current.Value
                self.Plot("Minimum", "min", self.min.Current.Value)
                # Plot all attributes of self.min
                self.Plot("Minimum", "periodssinceminimum", self.min.PeriodsSinceMinimum.Current.Value)
    

    The following reference table describes the Minimum constructor:

    Minimum() 1/2

                Minimum QuantConnect.Indicators.Minimum (
        int  period
       )
            

    Creates a new Minimum indicator with the specified period.

    Minimum() 2/2

                Minimum QuantConnect.Indicators.Minimum (
        string  name,
        int     period
       )
            

    Creates a new Minimum indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of Minimum using the plotly library.

    Minimum line plot.

     

    13.1.55 Momentum

    Introduction

    This indicator computes the n-period change in a value using the following: value_0 - value_n

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MOM Indicator

    To create an automatic indicators for Momentum , call the MOM helper method from the QCAlgorithm class. The MOM method creates a Momentum object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MomentumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Momentum _mom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mom = MOM("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_mom.IsReady)
            {
                // The current value of _mom is represented by itself (_mom)
                // or _mom.Current.Value
                Plot("Momentum", "mom", _mom);
                
            }
        }
    }
    class MomentumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mom = self.MOM("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.mom.IsReady:
                # The current value of self.mom is represented by self.mom.Current.Value
                self.Plot("Momentum", "mom", self.mom.Current.Value)
                
    

    The following reference table describes the MOM method:

    MOM() 1/1

                Momentum QuantConnect.Algorithm.QCAlgorithm.MOM (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Momentum indicator. This will compute the absolute n-period change in the security. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Momentum indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MomentumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Momentum _mom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mom = new Momentum(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mom.Update(bar.EndTime, bar.Close);
            }
    
            if (_mom.IsReady)
            {
                // The current value of _mom is represented by itself (_mom)
                // or _mom.Current.Value
                Plot("Momentum", "mom", _mom);
                
            }
        }
    }
    class MomentumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mom = Momentum(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mom.Update(bar.EndTime, bar.Close)
    
            if self.mom.IsReady:
                # The current value of self.mom is represented by self.mom.Current.Value
                self.Plot("Momentum", "mom", self.mom.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MomentumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Momentum _mom;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mom = new Momentum(20);
            RegisterIndicator(_symbol, _mom, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mom.IsReady)
            {
                // The current value of _mom is represented by itself (_mom)
                // or _mom.Current.Value
                Plot("Momentum", "mom", _mom);
                
            }
        }
    }
    class MomentumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mom = Momentum(20)
            self.RegisterIndicator(self.symbol, self.mom, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mom.IsReady:
                # The current value of self.mom is represented by self.mom.Current.Value
                self.Plot("Momentum", "mom", self.mom.Current.Value)
                
    

    The following reference table describes the Momentum constructor:

    Momentum() 1/2

                Momentum QuantConnect.Indicators.Momentum (
        int  period
       )
            

    Creates a new Momentum indicator with the specified period.

    Momentum() 2/2

                Momentum QuantConnect.Indicators.Momentum (
        string  name,
        int     period
       )
            

    Creates a new Momentum indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of Momentum using the plotly library.

    Momentum line plot.

     

    13.1.56 Momentum Percent

    Introduction

    This indicator computes the n-period percentage rate of change in a value using the following: 100 * (value_0 - value_n) / value_n This indicator yields the same results of RateOfChangePercent

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MOMP Indicator

    To create an automatic indicators for MomentumPercent , call the MOMP helper method from the QCAlgorithm class. The MOMP method creates a MomentumPercent object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MomentumPercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomentumPercent _momp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momp = MOMP("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_momp.IsReady)
            {
                // The current value of _momp is represented by itself (_momp)
                // or _momp.Current.Value
                Plot("MomentumPercent", "momp", _momp);
                
            }
        }
    }
    class MomentumPercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momp = self.MOMP("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.momp.IsReady:
                # The current value of self.momp is represented by self.momp.Current.Value
                self.Plot("MomentumPercent", "momp", self.momp.Current.Value)
                
    

    The following reference table describes the MOMP method:

    MOMP() 1/1

                MomentumPercent QuantConnect.Algorithm.QCAlgorithm.MOMP (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MomentumPercent indicator. This will compute the n-period percent change in the security. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MomentumPercent indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MomentumPercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomentumPercent _momp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momp = new MomentumPercent(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _momp.Update(bar.EndTime, bar.Close);
            }
    
            if (_momp.IsReady)
            {
                // The current value of _momp is represented by itself (_momp)
                // or _momp.Current.Value
                Plot("MomentumPercent", "momp", _momp);
                
            }
        }
    }
    class MomentumPercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momp = MomentumPercent(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.momp.Update(bar.EndTime, bar.Close)
    
            if self.momp.IsReady:
                # The current value of self.momp is represented by self.momp.Current.Value
                self.Plot("MomentumPercent", "momp", self.momp.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MomentumPercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomentumPercent _momp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momp = new MomentumPercent(20);
            RegisterIndicator(_symbol, _momp, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_momp.IsReady)
            {
                // The current value of _momp is represented by itself (_momp)
                // or _momp.Current.Value
                Plot("MomentumPercent", "momp", _momp);
                
            }
        }
    }
    class MomentumPercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momp = MomentumPercent(20)
            self.RegisterIndicator(self.symbol, self.momp, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.momp.IsReady:
                # The current value of self.momp is represented by self.momp.Current.Value
                self.Plot("MomentumPercent", "momp", self.momp.Current.Value)
                
    

    The following reference table describes the MomentumPercent constructor:

    MomentumPercent() 1/2

                MomentumPercent QuantConnect.Indicators.MomentumPercent (
        int  period
       )
            

    Creates a new MomentumPercent indicator with the specified period.

    MomentumPercent() 2/2

                MomentumPercent QuantConnect.Indicators.MomentumPercent (
        string  name,
        int     period
       )
            

    Creates a new MomentumPercent indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of MomentumPercent using the plotly library.

    MomentumPercent line plot.

     

    13.1.57 Momersion Indicator

    Introduction

    Oscillator indicator that measures momentum and mean-reversion over a specified period n. source Harris, Michael. "Momersion Indicator." Price Action Lab., 13 Aug. 2015. Web.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MOMERSION Indicator

    To create an automatic indicators for MomersionIndicator , call the MOMERSION helper method from the QCAlgorithm class. The MOMERSION method creates a MomersionIndicator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MomersionIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomersionIndicator _momersion;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momersion = MOMERSION("SPY", 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_momersion.IsReady)
            {
                // The current value of _momersion is represented by itself (_momersion)
                // or _momersion.Current.Value
                Plot("MomersionIndicator", "momersion", _momersion);
                
            }
        }
    }
    class MomersionIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momersion = self.MOMERSION("SPY", 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.momersion.IsReady:
                # The current value of self.momersion is represented by self.momersion.Current.Value
                self.Plot("MomersionIndicator", "momersion", self.momersion.Current.Value)
                
    

    The following reference table describes the MOMERSION method:

    MOMERSION() 1/1

                MomersionIndicator QuantConnect.Algorithm.QCAlgorithm.MOMERSION (
        Symbol                           symbol,
        Nullable<Int32>            minPeriod,
        Int32                            fullPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Momersion indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MomersionIndicator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MomersionIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomersionIndicator _momersion;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momersion = new MomersionIndicator(10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _momersion.Update(bar.EndTime, bar.Close);
            }
    
            if (_momersion.IsReady)
            {
                // The current value of _momersion is represented by itself (_momersion)
                // or _momersion.Current.Value
                Plot("MomersionIndicator", "momersion", _momersion);
                
            }
        }
    }
    class MomersionIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momersion = MomersionIndicator(10, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.momersion.Update(bar.EndTime, bar.Close)
    
            if self.momersion.IsReady:
                # The current value of self.momersion is represented by self.momersion.Current.Value
                self.Plot("MomersionIndicator", "momersion", self.momersion.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MomersionIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MomersionIndicator _momersion;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _momersion = new MomersionIndicator(10, 20);
            RegisterIndicator(_symbol, _momersion, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_momersion.IsReady)
            {
                // The current value of _momersion is represented by itself (_momersion)
                // or _momersion.Current.Value
                Plot("MomersionIndicator", "momersion", _momersion);
                
            }
        }
    }
    class MomersionIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.momersion = MomersionIndicator(10, 20)
            self.RegisterIndicator(self.symbol, self.momersion, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.momersion.IsReady:
                # The current value of self.momersion is represented by self.momersion.Current.Value
                self.Plot("MomersionIndicator", "momersion", self.momersion.Current.Value)
                
    

    The following reference table describes the MomersionIndicator constructor:

    MomersionIndicator() 1/3

                MomersionIndicator QuantConnect.Indicators.MomersionIndicator (
        string  name,
        int?    minPeriod,
        int     fullPeriod
       )
            

    Initializes a new instance of the MomersionIndicato class.

    MomersionIndicator() 2/3

                MomersionIndicator QuantConnect.Indicators.MomersionIndicator (
        int?  minPeriod,
        int   fullPeriod
       )
            

    Initializes a new instance of the MomersionIndicato class.

    MomersionIndicator() 3/3

                MomersionIndicator QuantConnect.Indicators.MomersionIndicator (
        int  fullPeriod
       )
            

    Initializes a new instance of the MomersionIndicato class.

    Visualization

    The following image shows plot values of selected properties of MomersionIndicator using the plotly library.

    MomersionIndicator line plot.

     

    13.1.58 Money Flow Index

    Introduction

    The Money Flow Index (MFI) is an oscillator that uses both price and volume to measure buying and selling pressure Typical Price = (High + Low + Close)/3 Money Flow = Typical Price x Volume Positive Money Flow = Sum of the money flows of all days where the typical price is greater than the previous day's typical price Negative Money Flow = Sum of the money flows of all days where the typical price is less than the previous day's typical price Money Flow Ratio = (14-period Positive Money Flow)/(14-period Negative Money Flow) Money Flow Index = 100 x Positive Money Flow / ( Positive Money Flow + Negative Money Flow)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MFI Indicator

    To create an automatic indicators for MoneyFlowIndex , call the MFI helper method from the QCAlgorithm class. The MFI method creates a MoneyFlowIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MoneyFlowIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MoneyFlowIndex _mfi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mfi = MFI("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_mfi.IsReady)
            {
                // The current value of _mfi is represented by itself (_mfi)
                // or _mfi.Current.Value
                Plot("MoneyFlowIndex", "mfi", _mfi);
                // Plot all properties of mfi
                Plot("MoneyFlowIndex", "positivemoneyflow", _mfi.PositiveMoneyFlow);
                Plot("MoneyFlowIndex", "negativemoneyflow", _mfi.NegativeMoneyFlow);
                Plot("MoneyFlowIndex", "previoustypicalprice", _mfi.PreviousTypicalPrice);
            }
        }
    }
    class MoneyFlowIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mfi = self.MFI("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.mfi.IsReady:
                # The current value of self.mfi is represented by self.mfi.Current.Value
                self.Plot("MoneyFlowIndex", "mfi", self.mfi.Current.Value)
                # Plot all attributes of self.mfi
                self.Plot("MoneyFlowIndex", "positivemoneyflow", self.mfi.PositiveMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "negativemoneyflow", self.mfi.NegativeMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "previoustypicalprice", self.mfi.PreviousTypicalPrice.Current.Value)
    

    The following reference table describes the MFI method:

    MFI() 1/1

                MoneyFlowIndex QuantConnect.Algorithm.QCAlgorithm.MFI (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MoneyFlowIndex indicator. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a MoneyFlowIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class MoneyFlowIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MoneyFlowIndex _mfi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mfi = new MoneyFlowIndex(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _mfi.Update(bar);
            }
    
            if (_mfi.IsReady)
            {
                // The current value of _mfi is represented by itself (_mfi)
                // or _mfi.Current.Value
                Plot("MoneyFlowIndex", "mfi", _mfi);
                // Plot all properties of mfi
                Plot("MoneyFlowIndex", "positivemoneyflow", _mfi.PositiveMoneyFlow);
                Plot("MoneyFlowIndex", "negativemoneyflow", _mfi.NegativeMoneyFlow);
                Plot("MoneyFlowIndex", "previoustypicalprice", _mfi.PreviousTypicalPrice);
            }
        }
    }
    class MoneyFlowIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mfi = MoneyFlowIndex(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.mfi.Update(bar)
    
            if self.mfi.IsReady:
                # The current value of self.mfi is represented by self.mfi.Current.Value
                self.Plot("MoneyFlowIndex", "mfi", self.mfi.Current.Value)
                # Plot all attributes of self.mfi
                self.Plot("MoneyFlowIndex", "positivemoneyflow", self.mfi.PositiveMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "negativemoneyflow", self.mfi.NegativeMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "previoustypicalprice", self.mfi.PreviousTypicalPrice.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MoneyFlowIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MoneyFlowIndex _mfi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _mfi = new MoneyFlowIndex(20);
            RegisterIndicator(_symbol, _mfi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_mfi.IsReady)
            {
                // The current value of _mfi is represented by itself (_mfi)
                // or _mfi.Current.Value
                Plot("MoneyFlowIndex", "mfi", _mfi);
                // Plot all properties of mfi
                Plot("MoneyFlowIndex", "positivemoneyflow", _mfi.PositiveMoneyFlow);
                Plot("MoneyFlowIndex", "negativemoneyflow", _mfi.NegativeMoneyFlow);
                Plot("MoneyFlowIndex", "previoustypicalprice", _mfi.PreviousTypicalPrice);
            }
        }
    }
    class MoneyFlowIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.mfi = MoneyFlowIndex(20)
            self.RegisterIndicator(self.symbol, self.mfi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.mfi.IsReady:
                # The current value of self.mfi is represented by self.mfi.Current.Value
                self.Plot("MoneyFlowIndex", "mfi", self.mfi.Current.Value)
                # Plot all attributes of self.mfi
                self.Plot("MoneyFlowIndex", "positivemoneyflow", self.mfi.PositiveMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "negativemoneyflow", self.mfi.NegativeMoneyFlow.Current.Value)
                self.Plot("MoneyFlowIndex", "previoustypicalprice", self.mfi.PreviousTypicalPrice.Current.Value)
    

    The following reference table describes the MoneyFlowIndex constructor:

    MoneyFlowIndex() 1/2

                MoneyFlowIndex QuantConnect.Indicators.MoneyFlowIndex (
        int  period
       )
            

    Initializes a new instance of the MoneyFlowIndex class.

    MoneyFlowIndex() 2/2

                MoneyFlowIndex QuantConnect.Indicators.MoneyFlowIndex (
        string  name,
        int     period
       )
            

    Initializes a new instance of the MoneyFlowIndex class.

    Visualization

    The following image shows plot values of selected properties of MoneyFlowIndex using the plotly library.

    MoneyFlowIndex line plot.

     

    13.1.59 Moving Average Convergence Divergence

    Introduction

    This indicator creates two moving averages defined on a base indicator and produces the difference between the fast and slow averages.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using MACD Indicator

    To create an automatic indicators for MovingAverageConvergenceDivergence , call the MACD helper method from the QCAlgorithm class. The MACD method creates a MovingAverageConvergenceDivergence object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class MovingAverageConvergenceDivergenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MovingAverageConvergenceDivergence _macd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _macd = MACD("SPY", 12, 26, 9, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (_macd.IsReady)
            {
                // The current value of _macd is represented by itself (_macd)
                // or _macd.Current.Value
                Plot("MovingAverageConvergenceDivergence", "macd", _macd);
                // Plot all properties of macd
                Plot("MovingAverageConvergenceDivergence", "fast", _macd.Fast);
                Plot("MovingAverageConvergenceDivergence", "slow", _macd.Slow);
                Plot("MovingAverageConvergenceDivergence", "signal", _macd.Signal);
                Plot("MovingAverageConvergenceDivergence", "histogram", _macd.Histogram);
            }
        }
    }
    class MovingAverageConvergenceDivergenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.macd = self.MACD("SPY", 12, 26, 9, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            if self.macd.IsReady:
                # The current value of self.macd is represented by self.macd.Current.Value
                self.Plot("MovingAverageConvergenceDivergence", "macd", self.macd.Current.Value)
                # Plot all attributes of self.macd
                self.Plot("MovingAverageConvergenceDivergence", "fast", self.macd.Fast.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "slow", self.macd.Slow.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "signal", self.macd.Signal.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "histogram", self.macd.Histogram.Current.Value)
    

    The following reference table describes the MACD method:

    MACD() 1/1

                MovingAverageConvergenceDivergence QuantConnect.Algorithm.QCAlgorithm.MACD (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        Int32                            signalPeriod,
        *MovingAverageType               type,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a MACD indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a MovingAverageConvergenceDivergence indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class MovingAverageConvergenceDivergenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MovingAverageConvergenceDivergence _macd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _macd = new MovingAverageConvergenceDivergence(12, 26, 9, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _macd.Update(bar.EndTime, bar.Close);
            }
    
            if (_macd.IsReady)
            {
                // The current value of _macd is represented by itself (_macd)
                // or _macd.Current.Value
                Plot("MovingAverageConvergenceDivergence", "macd", _macd);
                // Plot all properties of macd
                Plot("MovingAverageConvergenceDivergence", "fast", _macd.Fast);
                Plot("MovingAverageConvergenceDivergence", "slow", _macd.Slow);
                Plot("MovingAverageConvergenceDivergence", "signal", _macd.Signal);
                Plot("MovingAverageConvergenceDivergence", "histogram", _macd.Histogram);
            }
        }
    }
    class MovingAverageConvergenceDivergenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.macd = MovingAverageConvergenceDivergence(12, 26, 9, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.macd.Update(bar.EndTime, bar.Close)
    
            if self.macd.IsReady:
                # The current value of self.macd is represented by self.macd.Current.Value
                self.Plot("MovingAverageConvergenceDivergence", "macd", self.macd.Current.Value)
                # Plot all attributes of self.macd
                self.Plot("MovingAverageConvergenceDivergence", "fast", self.macd.Fast.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "slow", self.macd.Slow.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "signal", self.macd.Signal.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "histogram", self.macd.Histogram.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class MovingAverageConvergenceDivergenceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private MovingAverageConvergenceDivergence _macd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _macd = new MovingAverageConvergenceDivergence(12, 26, 9, MovingAverageType.Exponential);
            RegisterIndicator(_symbol, _macd, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_macd.IsReady)
            {
                // The current value of _macd is represented by itself (_macd)
                // or _macd.Current.Value
                Plot("MovingAverageConvergenceDivergence", "macd", _macd);
                // Plot all properties of macd
                Plot("MovingAverageConvergenceDivergence", "fast", _macd.Fast);
                Plot("MovingAverageConvergenceDivergence", "slow", _macd.Slow);
                Plot("MovingAverageConvergenceDivergence", "signal", _macd.Signal);
                Plot("MovingAverageConvergenceDivergence", "histogram", _macd.Histogram);
            }
        }
    }
    class MovingAverageConvergenceDivergenceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.macd = MovingAverageConvergenceDivergence(12, 26, 9, MovingAverageType.Exponential)
            self.RegisterIndicator(self.symbol, self.macd, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.macd.IsReady:
                # The current value of self.macd is represented by self.macd.Current.Value
                self.Plot("MovingAverageConvergenceDivergence", "macd", self.macd.Current.Value)
                # Plot all attributes of self.macd
                self.Plot("MovingAverageConvergenceDivergence", "fast", self.macd.Fast.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "slow", self.macd.Slow.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "signal", self.macd.Signal.Current.Value)
                self.Plot("MovingAverageConvergenceDivergence", "histogram", self.macd.Histogram.Current.Value)
    

    The following reference table describes the MovingAverageConvergenceDivergence constructor:

    MovingAverageConvergenceDivergence() 1/2

                MovingAverageConvergenceDivergence QuantConnect.Indicators.MovingAverageConvergenceDivergence (
        int                 fastPeriod,
        int                 slowPeriod,
        int                 signalPeriod,
        *MovingAverageType  type
       )
            

    Creates a new MACD with the specified parameters.

    MovingAverageConvergenceDivergence() 2/2

                MovingAverageConvergenceDivergence QuantConnect.Indicators.MovingAverageConvergenceDivergence (
        string              name,
        int                 fastPeriod,
        int                 slowPeriod,
        int                 signalPeriod,
        *MovingAverageType  type
       )
            

    Creates a new MACD with the specified parameters.

    Visualization

    The following image shows plot values of selected properties of MovingAverageConvergenceDivergence using the plotly library.

    MovingAverageConvergenceDivergence line plot.

     

    13.1.60 Normalized Average True Range

    Introduction

    This indicator computes the Normalized Average True Range (NATR). The Normalized Average True Range is calculated with the following formula: NATR = (ATR(period) / Close) * 100

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using NATR Indicator

    To create an automatic indicators for NormalizedAverageTrueRange , call the NATR helper method from the QCAlgorithm class. The NATR method creates a NormalizedAverageTrueRange object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class NormalizedAverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private NormalizedAverageTrueRange _natr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _natr = NATR("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_natr.IsReady)
            {
                // The current value of _natr is represented by itself (_natr)
                // or _natr.Current.Value
                Plot("NormalizedAverageTrueRange", "natr", _natr);
                
            }
        }
    }
    class NormalizedAverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.natr = self.NATR("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.natr.IsReady:
                # The current value of self.natr is represented by self.natr.Current.Value
                self.Plot("NormalizedAverageTrueRange", "natr", self.natr.Current.Value)
                
    

    The following reference table describes the NATR method:

    NATR() 1/1

                NormalizedAverageTrueRange QuantConnect.Algorithm.QCAlgorithm.NATR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new NormalizedAverageTrueRange indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a NormalizedAverageTrueRange indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class NormalizedAverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private NormalizedAverageTrueRange _natr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _natr = new NormalizedAverageTrueRange(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _natr.Update(bar);
            }
    
            if (_natr.IsReady)
            {
                // The current value of _natr is represented by itself (_natr)
                // or _natr.Current.Value
                Plot("NormalizedAverageTrueRange", "natr", _natr);
                
            }
        }
    }
    class NormalizedAverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.natr = NormalizedAverageTrueRange(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.natr.Update(bar)
    
            if self.natr.IsReady:
                # The current value of self.natr is represented by self.natr.Current.Value
                self.Plot("NormalizedAverageTrueRange", "natr", self.natr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class NormalizedAverageTrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private NormalizedAverageTrueRange _natr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _natr = new NormalizedAverageTrueRange(20);
            RegisterIndicator(_symbol, _natr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_natr.IsReady)
            {
                // The current value of _natr is represented by itself (_natr)
                // or _natr.Current.Value
                Plot("NormalizedAverageTrueRange", "natr", _natr);
                
            }
        }
    }
    class NormalizedAverageTrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.natr = NormalizedAverageTrueRange(20)
            self.RegisterIndicator(self.symbol, self.natr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.natr.IsReady:
                # The current value of self.natr is represented by self.natr.Current.Value
                self.Plot("NormalizedAverageTrueRange", "natr", self.natr.Current.Value)
                
    

    The following reference table describes the NormalizedAverageTrueRange constructor:

    NormalizedAverageTrueRange() 1/2

                NormalizedAverageTrueRange QuantConnect.Indicators.NormalizedAverageTrueRange (
        string  name,
        int     period
       )
            

    Initializes a new instance of the NormalizedAverageTrueRang class using the specified name and period.

    NormalizedAverageTrueRange() 2/2

                NormalizedAverageTrueRange QuantConnect.Indicators.NormalizedAverageTrueRange (
        int  period
       )
            

    Initializes a new instance of the NormalizedAverageTrueRang class using the specified period.

    Visualization

    The following image shows plot values of selected properties of NormalizedAverageTrueRange using the plotly library.

    NormalizedAverageTrueRange line plot.

     

    13.1.61 On Balance Volume

    Introduction

    This indicator computes the On Balance Volume (OBV). The On Balance Volume is calculated by determining the price of the current close price and previous close price. If the current close price is equivalent to the previous price the OBV remains the same, If the current close price is higher the volume of that day is added to the OBV, while a lower close price will result in negative value.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using OBV Indicator

    To create an automatic indicators for OnBalanceVolume , call the OBV helper method from the QCAlgorithm class. The OBV method creates a OnBalanceVolume object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class OnBalanceVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnBalanceVolume _obv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _obv = OBV("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_obv.IsReady)
            {
                // The current value of _obv is represented by itself (_obv)
                // or _obv.Current.Value
                Plot("OnBalanceVolume", "obv", _obv);
                
            }
        }
    }
    class OnBalanceVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.obv = self.OBV("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.obv.IsReady:
                # The current value of self.obv is represented by self.obv.Current.Value
                self.Plot("OnBalanceVolume", "obv", self.obv.Current.Value)
                
    

    The following reference table describes the OBV method:

    OBV() 1/1

                OnBalanceVolume QuantConnect.Algorithm.QCAlgorithm.OBV (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new On Balance Volume indicator. This will compute the cumulative total volume based on whether the close price being higher or lower than the previous period. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a OnBalanceVolume indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class OnBalanceVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnBalanceVolume _obv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _obv = new OnBalanceVolume("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _obv.Update(bar);
            }
    
            if (_obv.IsReady)
            {
                // The current value of _obv is represented by itself (_obv)
                // or _obv.Current.Value
                Plot("OnBalanceVolume", "obv", _obv);
                
            }
        }
    }
    class OnBalanceVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.obv = OnBalanceVolume("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.obv.Update(bar)
    
            if self.obv.IsReady:
                # The current value of self.obv is represented by self.obv.Current.Value
                self.Plot("OnBalanceVolume", "obv", self.obv.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class OnBalanceVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private OnBalanceVolume _obv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _obv = new OnBalanceVolume("SPY");
            RegisterIndicator(_symbol, _obv, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_obv.IsReady)
            {
                // The current value of _obv is represented by itself (_obv)
                // or _obv.Current.Value
                Plot("OnBalanceVolume", "obv", _obv);
                
            }
        }
    }
    class OnBalanceVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.obv = OnBalanceVolume("SPY")
            self.RegisterIndicator(self.symbol, self.obv, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.obv.IsReady:
                # The current value of self.obv is represented by self.obv.Current.Value
                self.Plot("OnBalanceVolume", "obv", self.obv.Current.Value)
                
    

    The following reference table describes the OnBalanceVolume constructor:

    OnBalanceVolume() 1/2

                OnBalanceVolume QuantConnect.Indicators.OnBalanceVolume (
        
       )
            

    Initializes a new instance of the Indicator class using the specified name.

    OnBalanceVolume() 2/2

                OnBalanceVolume QuantConnect.Indicators.OnBalanceVolume (
        string  name
       )
            

    Initializes a new instance of the Indicator class using the specified name.

    Visualization

    The following image shows plot values of selected properties of OnBalanceVolume using the plotly library.

    OnBalanceVolume line plot.

     

    13.1.62 Parabolic Stop And Reverse

    Introduction

    Parabolic SAR Indicator Based on TA-Lib implementation

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using PSAR Indicator

    To create an automatic indicators for ParabolicStopAndReverse , call the PSAR helper method from the QCAlgorithm class. The PSAR method creates a ParabolicStopAndReverse object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class ParabolicStopAndReverseAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ParabolicStopAndReverse _psar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _psar = PSAR("SPY", 0.02, 0.02, 0.2);
        }
    
        public override void OnData(Slice data)
        {
            if (_psar.IsReady)
            {
                // The current value of _psar is represented by itself (_psar)
                // or _psar.Current.Value
                Plot("ParabolicStopAndReverse", "psar", _psar);
                
            }
        }
    }
    class ParabolicStopAndReverseAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.psar = self.PSAR("SPY", 0.02, 0.02, 0.2)
    
        def OnData(self, slice: Slice) -> None:
            if self.psar.IsReady:
                # The current value of self.psar is represented by self.psar.Current.Value
                self.Plot("ParabolicStopAndReverse", "psar", self.psar.Current.Value)
                
    

    The following reference table describes the PSAR method:

    PSAR() 1/1

                ParabolicStopAndReverse QuantConnect.Algorithm.QCAlgorithm.PSAR (
        Symbol                                symbol,
        *Decimal                              afStart,
        *Decimal                              afIncrement,
        *Decimal                              afMax,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Parabolic SAR indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a ParabolicStopAndReverse indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class ParabolicStopAndReverseAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ParabolicStopAndReverse _psar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _psar = new ParabolicStopAndReverse(0.02, 0.02, 0.2);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _psar.Update(bar);
            }
    
            if (_psar.IsReady)
            {
                // The current value of _psar is represented by itself (_psar)
                // or _psar.Current.Value
                Plot("ParabolicStopAndReverse", "psar", _psar);
                
            }
        }
    }
    class ParabolicStopAndReverseAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.psar = ParabolicStopAndReverse(0.02, 0.02, 0.2)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.psar.Update(bar)
    
            if self.psar.IsReady:
                # The current value of self.psar is represented by self.psar.Current.Value
                self.Plot("ParabolicStopAndReverse", "psar", self.psar.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class ParabolicStopAndReverseAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private ParabolicStopAndReverse _psar;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _psar = new ParabolicStopAndReverse(0.02, 0.02, 0.2);
            RegisterIndicator(_symbol, _psar, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_psar.IsReady)
            {
                // The current value of _psar is represented by itself (_psar)
                // or _psar.Current.Value
                Plot("ParabolicStopAndReverse", "psar", _psar);
                
            }
        }
    }
    class ParabolicStopAndReverseAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.psar = ParabolicStopAndReverse(0.02, 0.02, 0.2)
            self.RegisterIndicator(self.symbol, self.psar, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.psar.IsReady:
                # The current value of self.psar is represented by self.psar.Current.Value
                self.Plot("ParabolicStopAndReverse", "psar", self.psar.Current.Value)
                
    

    The following reference table describes the ParabolicStopAndReverse constructor:

    ParabolicStopAndReverse() 1/2

                ParabolicStopAndReverse QuantConnect.Indicators.ParabolicStopAndReverse (
        string    name,
        *decimal  afStart,
        *decimal  afIncrement,
        *decimal  afMax
       )
            

    Create new Parabolic SAR.

    ParabolicStopAndReverse() 2/2

                ParabolicStopAndReverse QuantConnect.Indicators.ParabolicStopAndReverse (
        *decimal  afStart,
        *decimal  afIncrement,
        *decimal  afMax
       )
            

    Create new Parabolic SAR.

    Visualization

    The following image shows plot values of selected properties of ParabolicStopAndReverse using the plotly library.

    ParabolicStopAndReverse line plot.

     

    13.1.63 Percentage Price Oscillator

    Introduction

    This indicator computes the Percentage Price Oscillator (PPO) The Percentage Price Oscillator is calculated using the following formula: PPO[i] = 100 * (FastMA[i] - SlowMA[i]) / SlowMA[i]

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using PPO Indicator

    To create an automatic indicators for PercentagePriceOscillator , call the PPO helper method from the QCAlgorithm class. The PPO method creates a PercentagePriceOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class PercentagePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PercentagePriceOscillator _ppo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ppo = PPO("SPY", 10, 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_ppo.IsReady)
            {
                // The current value of _ppo is represented by itself (_ppo)
                // or _ppo.Current.Value
                Plot("PercentagePriceOscillator", "ppo", _ppo);
                // Plot all properties of ppo
                Plot("PercentagePriceOscillator", "fast", _ppo.Fast);
                Plot("PercentagePriceOscillator", "slow", _ppo.Slow);
                Plot("PercentagePriceOscillator", "signal", _ppo.Signal);
                Plot("PercentagePriceOscillator", "histogram", _ppo.Histogram);
            }
        }
    }
    class PercentagePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ppo = self.PPO("SPY", 10, 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.ppo.IsReady:
                # The current value of self.ppo is represented by self.ppo.Current.Value
                self.Plot("PercentagePriceOscillator", "ppo", self.ppo.Current.Value)
                # Plot all attributes of self.ppo
                self.Plot("PercentagePriceOscillator", "fast", self.ppo.Fast.Current.Value)
                self.Plot("PercentagePriceOscillator", "slow", self.ppo.Slow.Current.Value)
                self.Plot("PercentagePriceOscillator", "signal", self.ppo.Signal.Current.Value)
                self.Plot("PercentagePriceOscillator", "histogram", self.ppo.Histogram.Current.Value)
    

    The following reference table describes the PPO method:

    PPO() 1/1

                PercentagePriceOscillator QuantConnect.Algorithm.QCAlgorithm.PPO (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        MovingAverageType                movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new PercentagePriceOscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a PercentagePriceOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class PercentagePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PercentagePriceOscillator _ppo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ppo = new PercentagePriceOscillator(10, 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ppo.Update(bar.EndTime, bar.Close);
            }
    
            if (_ppo.IsReady)
            {
                // The current value of _ppo is represented by itself (_ppo)
                // or _ppo.Current.Value
                Plot("PercentagePriceOscillator", "ppo", _ppo);
                // Plot all properties of ppo
                Plot("PercentagePriceOscillator", "fast", _ppo.Fast);
                Plot("PercentagePriceOscillator", "slow", _ppo.Slow);
                Plot("PercentagePriceOscillator", "signal", _ppo.Signal);
                Plot("PercentagePriceOscillator", "histogram", _ppo.Histogram);
            }
        }
    }
    class PercentagePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ppo = PercentagePriceOscillator(10, 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ppo.Update(bar.EndTime, bar.Close)
    
            if self.ppo.IsReady:
                # The current value of self.ppo is represented by self.ppo.Current.Value
                self.Plot("PercentagePriceOscillator", "ppo", self.ppo.Current.Value)
                # Plot all attributes of self.ppo
                self.Plot("PercentagePriceOscillator", "fast", self.ppo.Fast.Current.Value)
                self.Plot("PercentagePriceOscillator", "slow", self.ppo.Slow.Current.Value)
                self.Plot("PercentagePriceOscillator", "signal", self.ppo.Signal.Current.Value)
                self.Plot("PercentagePriceOscillator", "histogram", self.ppo.Histogram.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class PercentagePriceOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PercentagePriceOscillator _ppo;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ppo = new PercentagePriceOscillator(10, 20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _ppo, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ppo.IsReady)
            {
                // The current value of _ppo is represented by itself (_ppo)
                // or _ppo.Current.Value
                Plot("PercentagePriceOscillator", "ppo", _ppo);
                // Plot all properties of ppo
                Plot("PercentagePriceOscillator", "fast", _ppo.Fast);
                Plot("PercentagePriceOscillator", "slow", _ppo.Slow);
                Plot("PercentagePriceOscillator", "signal", _ppo.Signal);
                Plot("PercentagePriceOscillator", "histogram", _ppo.Histogram);
            }
        }
    }
    class PercentagePriceOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ppo = PercentagePriceOscillator(10, 20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.ppo, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ppo.IsReady:
                # The current value of self.ppo is represented by self.ppo.Current.Value
                self.Plot("PercentagePriceOscillator", "ppo", self.ppo.Current.Value)
                # Plot all attributes of self.ppo
                self.Plot("PercentagePriceOscillator", "fast", self.ppo.Fast.Current.Value)
                self.Plot("PercentagePriceOscillator", "slow", self.ppo.Slow.Current.Value)
                self.Plot("PercentagePriceOscillator", "signal", self.ppo.Signal.Current.Value)
                self.Plot("PercentagePriceOscillator", "histogram", self.ppo.Histogram.Current.Value)
    

    The following reference table describes the PercentagePriceOscillator constructor:

    PercentagePriceOscillator() 1/2

                PercentagePriceOscillator QuantConnect.Indicators.PercentagePriceOscillator (
        string              name,
        int                 fastPeriod,
        int                 slowPeriod,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the PercentagePriceOscillato class using the specified name and parameters.

    PercentagePriceOscillator() 2/2

                PercentagePriceOscillator QuantConnect.Indicators.PercentagePriceOscillator (
        int                 fastPeriod,
        int                 slowPeriod,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the PercentagePriceOscillato class using the specified parameters.

    Visualization

    The following image shows plot values of selected properties of PercentagePriceOscillator using the plotly library.

    PercentagePriceOscillator line plot.

     

    13.1.64 Pivot Points High Low

    Introduction

    Pivot Points (High/Low), also known as Bar Count Reversals, indicator. https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/pivot-points-high-low

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using PPHL Indicator

    To create an automatic indicators for PivotPointsHighLow , call the PPHL helper method from the QCAlgorithm class. The PPHL method creates a PivotPointsHighLow object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class PivotPointsHighLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PivotPointsHighLow _pphl;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _pphl = PPHL("SPY", 10, 10, 100);
        }
    
        public override void OnData(Slice data)
        {
            if (_pphl.IsReady)
            {
                // The current value of _pphl is represented by itself (_pphl)
                // or _pphl.Current.Value
                Plot("PivotPointsHighLow", "pphl", _pphl);
                
            }
        }
    }
    class PivotPointsHighLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.pphl = self.PPHL("SPY", 10, 10, 100)
    
        def OnData(self, slice: Slice) -> None:
            if self.pphl.IsReady:
                # The current value of self.pphl is represented by self.pphl.Current.Value
                self.Plot("PivotPointsHighLow", "pphl", self.pphl.Current.Value)
                
    

    The following reference table describes the PPHL method:

    PPHL() 1/1

                PivotPointsHighLow QuantConnect.Algorithm.QCAlgorithm.PPHL (
        Symbol                                symbol,
        Int32                                 lengthHigh,
        Int32                                 lengthLow,
        *Int32                                lastStoredValues,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new PivotPointsHighLow indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a PivotPointsHighLow indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class PivotPointsHighLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PivotPointsHighLow _pphl;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _pphl = new PivotPointsHighLow(10, 10, 100);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _pphl.Update(bar.EndTime, bar.Close);
            }
    
            if (_pphl.IsReady)
            {
                // The current value of _pphl is represented by itself (_pphl)
                // or _pphl.Current.Value
                Plot("PivotPointsHighLow", "pphl", _pphl);
                
            }
        }
    }
    class PivotPointsHighLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.pphl = PivotPointsHighLow(10, 10, 100)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.pphl.Update(bar.EndTime, bar.Close)
    
            if self.pphl.IsReady:
                # The current value of self.pphl is represented by self.pphl.Current.Value
                self.Plot("PivotPointsHighLow", "pphl", self.pphl.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class PivotPointsHighLowAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private PivotPointsHighLow _pphl;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _pphl = new PivotPointsHighLow(10, 10, 100);
            RegisterIndicator(_symbol, _pphl, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_pphl.IsReady)
            {
                // The current value of _pphl is represented by itself (_pphl)
                // or _pphl.Current.Value
                Plot("PivotPointsHighLow", "pphl", _pphl);
                
            }
        }
    }
    class PivotPointsHighLowAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.pphl = PivotPointsHighLow(10, 10, 100)
            self.RegisterIndicator(self.symbol, self.pphl, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.pphl.IsReady:
                # The current value of self.pphl is represented by self.pphl.Current.Value
                self.Plot("PivotPointsHighLow", "pphl", self.pphl.Current.Value)
                
    

    The following reference table describes the PivotPointsHighLow constructor:

    PivotPointsHighLow() 1/3

                PivotPointsHighLow QuantConnect.Indicators.PivotPointsHighLow (
        int   surroundingBarsCount,
        *int  lastStoredValues
       )
            

    Creates a new instance of PivotPointsHighLo indicator with an equal high and low length.

    PivotPointsHighLow() 2/3

                PivotPointsHighLow QuantConnect.Indicators.PivotPointsHighLow (
        int   surroundingBarsCountForHighPoint,
        int   surroundingBarsCountForLowPoint,
        *int  lastStoredValues
       )
            

    Creates a new instance of PivotPointsHighLo indicator.

    PivotPointsHighLow() 3/3

                PivotPointsHighLow QuantConnect.Indicators.PivotPointsHighLow (
        string  name,
        int     surroundingBarsCountForHighPoint,
        int     surroundingBarsCountForLowPoint,
        *int    lastStoredValues
       )
            

    Creates a new instance of PivotPointsHighLo indicator.

    Visualization

    The following image shows plot values of selected properties of PivotPointsHighLow using the plotly library.

    PivotPointsHighLow line plot.

     

    13.1.65 Rate Of Change

    Introduction

    This indicator computes the n-period rate of change in a value using the following: (value_0 - value_n) / value_n

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ROC Indicator

    To create an automatic indicators for RateOfChange , call the ROC helper method from the QCAlgorithm class. The ROC method creates a RateOfChange object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RateOfChangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChange _roc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _roc = ROC("SPY", 10);
        }
    
        public override void OnData(Slice data)
        {
            if (_roc.IsReady)
            {
                // The current value of _roc is represented by itself (_roc)
                // or _roc.Current.Value
                Plot("RateOfChange", "roc", _roc);
                
            }
        }
    }
    class RateOfChangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.roc = self.ROC("SPY", 10)
    
        def OnData(self, slice: Slice) -> None:
            if self.roc.IsReady:
                # The current value of self.roc is represented by self.roc.Current.Value
                self.Plot("RateOfChange", "roc", self.roc.Current.Value)
                
    

    The following reference table describes the ROC method:

    ROC() 1/1

                RateOfChange QuantConnect.Algorithm.QCAlgorithm.ROC (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChange indicator. This will compute the n-period rate of change in the security. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RateOfChange indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RateOfChangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChange _roc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _roc = new RateOfChange(10);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _roc.Update(bar.EndTime, bar.Close);
            }
    
            if (_roc.IsReady)
            {
                // The current value of _roc is represented by itself (_roc)
                // or _roc.Current.Value
                Plot("RateOfChange", "roc", _roc);
                
            }
        }
    }
    class RateOfChangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.roc = RateOfChange(10)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.roc.Update(bar.EndTime, bar.Close)
    
            if self.roc.IsReady:
                # The current value of self.roc is represented by self.roc.Current.Value
                self.Plot("RateOfChange", "roc", self.roc.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RateOfChangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChange _roc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _roc = new RateOfChange(10);
            RegisterIndicator(_symbol, _roc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_roc.IsReady)
            {
                // The current value of _roc is represented by itself (_roc)
                // or _roc.Current.Value
                Plot("RateOfChange", "roc", _roc);
                
            }
        }
    }
    class RateOfChangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.roc = RateOfChange(10)
            self.RegisterIndicator(self.symbol, self.roc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.roc.IsReady:
                # The current value of self.roc is represented by self.roc.Current.Value
                self.Plot("RateOfChange", "roc", self.roc.Current.Value)
                
    

    The following reference table describes the RateOfChange constructor:

    RateOfChange() 1/2

                RateOfChange QuantConnect.Indicators.RateOfChange (
        int  period
       )
            

    Creates a new RateOfChange indicator with the specified period.

    RateOfChange() 2/2

                RateOfChange QuantConnect.Indicators.RateOfChange (
        string  name,
        int     period
       )
            

    Creates a new RateOfChange indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of RateOfChange using the plotly library.

    RateOfChange line plot.

     

    13.1.66 Rate Of Change Percent

    Introduction

    This indicator computes the n-period percentage rate of change in a value using the following: 100 * (value_0 - value_n) / value_n

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ROCP Indicator

    To create an automatic indicators for RateOfChangePercent , call the ROCP helper method from the QCAlgorithm class. The ROCP method creates a RateOfChangePercent object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RateOfChangePercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangePercent _rocp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocp = ROCP("SPY", 10);
        }
    
        public override void OnData(Slice data)
        {
            if (_rocp.IsReady)
            {
                // The current value of _rocp is represented by itself (_rocp)
                // or _rocp.Current.Value
                Plot("RateOfChangePercent", "rocp", _rocp);
                
            }
        }
    }
    class RateOfChangePercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocp = self.ROCP("SPY", 10)
    
        def OnData(self, slice: Slice) -> None:
            if self.rocp.IsReady:
                # The current value of self.rocp is represented by self.rocp.Current.Value
                self.Plot("RateOfChangePercent", "rocp", self.rocp.Current.Value)
                
    

    The following reference table describes the ROCP method:

    ROCP() 1/1

                RateOfChangePercent QuantConnect.Algorithm.QCAlgorithm.ROCP (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChangePercent indicator. This will compute the n-period percentage rate of change in the security. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RateOfChangePercent indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RateOfChangePercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangePercent _rocp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocp = new RateOfChangePercent(10);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rocp.Update(bar.EndTime, bar.Close);
            }
    
            if (_rocp.IsReady)
            {
                // The current value of _rocp is represented by itself (_rocp)
                // or _rocp.Current.Value
                Plot("RateOfChangePercent", "rocp", _rocp);
                
            }
        }
    }
    class RateOfChangePercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocp = RateOfChangePercent(10)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rocp.Update(bar.EndTime, bar.Close)
    
            if self.rocp.IsReady:
                # The current value of self.rocp is represented by self.rocp.Current.Value
                self.Plot("RateOfChangePercent", "rocp", self.rocp.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RateOfChangePercentAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangePercent _rocp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocp = new RateOfChangePercent(10);
            RegisterIndicator(_symbol, _rocp, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rocp.IsReady)
            {
                // The current value of _rocp is represented by itself (_rocp)
                // or _rocp.Current.Value
                Plot("RateOfChangePercent", "rocp", _rocp);
                
            }
        }
    }
    class RateOfChangePercentAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocp = RateOfChangePercent(10)
            self.RegisterIndicator(self.symbol, self.rocp, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rocp.IsReady:
                # The current value of self.rocp is represented by self.rocp.Current.Value
                self.Plot("RateOfChangePercent", "rocp", self.rocp.Current.Value)
                
    

    The following reference table describes the RateOfChangePercent constructor:

    RateOfChangePercent() 1/2

                RateOfChangePercent QuantConnect.Indicators.RateOfChangePercent (
        int  period
       )
            

    Creates a new RateOfChangePercent indicator with the specified period.

    RateOfChangePercent() 2/2

                RateOfChangePercent QuantConnect.Indicators.RateOfChangePercent (
        string  name,
        int     period
       )
            

    Creates a new RateOfChangePercent indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of RateOfChangePercent using the plotly library.

    RateOfChangePercent line plot.

     

    13.1.67 Rate Of Change Ratio

    Introduction

    This indicator computes the Rate Of Change Ratio (ROCR). The Rate Of Change Ratio is calculated with the following formula: ROCR = price / prevPrice

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ROCR Indicator

    To create an automatic indicators for RateOfChangeRatio , call the ROCR helper method from the QCAlgorithm class. The ROCR method creates a RateOfChangeRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RateOfChangeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangeRatio _rocr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocr = ROCR("SPY", 10);
        }
    
        public override void OnData(Slice data)
        {
            if (_rocr.IsReady)
            {
                // The current value of _rocr is represented by itself (_rocr)
                // or _rocr.Current.Value
                Plot("RateOfChangeRatio", "rocr", _rocr);
                
            }
        }
    }
    class RateOfChangeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocr = self.ROCR("SPY", 10)
    
        def OnData(self, slice: Slice) -> None:
            if self.rocr.IsReady:
                # The current value of self.rocr is represented by self.rocr.Current.Value
                self.Plot("RateOfChangeRatio", "rocr", self.rocr.Current.Value)
                
    

    The following reference table describes the ROCR method:

    ROCR() 1/1

                RateOfChangeRatio QuantConnect.Algorithm.QCAlgorithm.ROCR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChangeRatio indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RateOfChangeRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RateOfChangeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangeRatio _rocr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocr = new RateOfChangeRatio(10);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rocr.Update(bar.EndTime, bar.Close);
            }
    
            if (_rocr.IsReady)
            {
                // The current value of _rocr is represented by itself (_rocr)
                // or _rocr.Current.Value
                Plot("RateOfChangeRatio", "rocr", _rocr);
                
            }
        }
    }
    class RateOfChangeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocr = RateOfChangeRatio(10)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rocr.Update(bar.EndTime, bar.Close)
    
            if self.rocr.IsReady:
                # The current value of self.rocr is represented by self.rocr.Current.Value
                self.Plot("RateOfChangeRatio", "rocr", self.rocr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RateOfChangeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RateOfChangeRatio _rocr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rocr = new RateOfChangeRatio(10);
            RegisterIndicator(_symbol, _rocr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rocr.IsReady)
            {
                // The current value of _rocr is represented by itself (_rocr)
                // or _rocr.Current.Value
                Plot("RateOfChangeRatio", "rocr", _rocr);
                
            }
        }
    }
    class RateOfChangeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rocr = RateOfChangeRatio(10)
            self.RegisterIndicator(self.symbol, self.rocr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rocr.IsReady:
                # The current value of self.rocr is represented by self.rocr.Current.Value
                self.Plot("RateOfChangeRatio", "rocr", self.rocr.Current.Value)
                
    

    The following reference table describes the RateOfChangeRatio constructor:

    RateOfChangeRatio() 1/2

                RateOfChangeRatio QuantConnect.Indicators.RateOfChangeRatio (
        string  name,
        int     period
       )
            

    Initializes a new instance of the RateOfChangeRati class using the specified name and period.

    RateOfChangeRatio() 2/2

                RateOfChangeRatio QuantConnect.Indicators.RateOfChangeRatio (
        int  period
       )
            

    Initializes a new instance of the RateOfChangeRati class using the specified period.

    Visualization

    The following image shows plot values of selected properties of RateOfChangeRatio using the plotly library.

    RateOfChangeRatio line plot.

     

    13.1.68 Regression Channel

    Introduction

    The Regression Channel indicator extends the with the inclusion of two (upper and lower) channel lines that are distanced from the linear regression line by a user defined number of standard deviations. Reference: http://www.onlinetradingconcepts.com/TechnicalAnalysis/LinRegChannel.html

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using RC Indicator

    To create an automatic indicators for RegressionChannel , call the RC helper method from the QCAlgorithm class. The RC method creates a RegressionChannel object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RegressionChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RegressionChannel _rc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rc = RC("SPY", 20, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (_rc.IsReady)
            {
                // The current value of _rc is represented by itself (_rc)
                // or _rc.Current.Value
                Plot("RegressionChannel", "rc", _rc);
                // Plot all properties of rc
                Plot("RegressionChannel", "linearregression", _rc.LinearRegression);
                Plot("RegressionChannel", "upperchannel", _rc.UpperChannel);
                Plot("RegressionChannel", "lowerchannel", _rc.LowerChannel);
                Plot("RegressionChannel", "intercept", _rc.Intercept);
                Plot("RegressionChannel", "slope", _rc.Slope);
            }
        }
    }
    class RegressionChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rc = self.RC("SPY", 20, 2)
    
        def OnData(self, slice: Slice) -> None:
            if self.rc.IsReady:
                # The current value of self.rc is represented by self.rc.Current.Value
                self.Plot("RegressionChannel", "rc", self.rc.Current.Value)
                # Plot all attributes of self.rc
                self.Plot("RegressionChannel", "linearregression", self.rc.LinearRegression.Current.Value)
                self.Plot("RegressionChannel", "upperchannel", self.rc.UpperChannel.Current.Value)
                self.Plot("RegressionChannel", "lowerchannel", self.rc.LowerChannel.Current.Value)
                self.Plot("RegressionChannel", "intercept", self.rc.Intercept.Current.Value)
                self.Plot("RegressionChannel", "slope", self.rc.Slope.Current.Value)
    

    The following reference table describes the RC method:

    RC() 1/1

                RegressionChannel QuantConnect.Algorithm.QCAlgorithm.RC (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          k,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RegressionChannel indicator which will compute the LinearRegression, UpperChannel and LowerChannel lines, the intercept and slope.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RegressionChannel indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RegressionChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RegressionChannel _rc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rc = new RegressionChannel(20, 2);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rc.Update(bar.EndTime, bar.Close);
            }
    
            if (_rc.IsReady)
            {
                // The current value of _rc is represented by itself (_rc)
                // or _rc.Current.Value
                Plot("RegressionChannel", "rc", _rc);
                // Plot all properties of rc
                Plot("RegressionChannel", "linearregression", _rc.LinearRegression);
                Plot("RegressionChannel", "upperchannel", _rc.UpperChannel);
                Plot("RegressionChannel", "lowerchannel", _rc.LowerChannel);
                Plot("RegressionChannel", "intercept", _rc.Intercept);
                Plot("RegressionChannel", "slope", _rc.Slope);
            }
        }
    }
    class RegressionChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rc = RegressionChannel(20, 2)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rc.Update(bar.EndTime, bar.Close)
    
            if self.rc.IsReady:
                # The current value of self.rc is represented by self.rc.Current.Value
                self.Plot("RegressionChannel", "rc", self.rc.Current.Value)
                # Plot all attributes of self.rc
                self.Plot("RegressionChannel", "linearregression", self.rc.LinearRegression.Current.Value)
                self.Plot("RegressionChannel", "upperchannel", self.rc.UpperChannel.Current.Value)
                self.Plot("RegressionChannel", "lowerchannel", self.rc.LowerChannel.Current.Value)
                self.Plot("RegressionChannel", "intercept", self.rc.Intercept.Current.Value)
                self.Plot("RegressionChannel", "slope", self.rc.Slope.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RegressionChannelAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RegressionChannel _rc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rc = new RegressionChannel(20, 2);
            RegisterIndicator(_symbol, _rc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rc.IsReady)
            {
                // The current value of _rc is represented by itself (_rc)
                // or _rc.Current.Value
                Plot("RegressionChannel", "rc", _rc);
                // Plot all properties of rc
                Plot("RegressionChannel", "linearregression", _rc.LinearRegression);
                Plot("RegressionChannel", "upperchannel", _rc.UpperChannel);
                Plot("RegressionChannel", "lowerchannel", _rc.LowerChannel);
                Plot("RegressionChannel", "intercept", _rc.Intercept);
                Plot("RegressionChannel", "slope", _rc.Slope);
            }
        }
    }
    class RegressionChannelAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rc = RegressionChannel(20, 2)
            self.RegisterIndicator(self.symbol, self.rc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rc.IsReady:
                # The current value of self.rc is represented by self.rc.Current.Value
                self.Plot("RegressionChannel", "rc", self.rc.Current.Value)
                # Plot all attributes of self.rc
                self.Plot("RegressionChannel", "linearregression", self.rc.LinearRegression.Current.Value)
                self.Plot("RegressionChannel", "upperchannel", self.rc.UpperChannel.Current.Value)
                self.Plot("RegressionChannel", "lowerchannel", self.rc.LowerChannel.Current.Value)
                self.Plot("RegressionChannel", "intercept", self.rc.Intercept.Current.Value)
                self.Plot("RegressionChannel", "slope", self.rc.Slope.Current.Value)
    

    The following reference table describes the RegressionChannel constructor:

    RegressionChannel() 1/2

                RegressionChannel QuantConnect.Indicators.RegressionChannel (
        string   name,
        int      period,
        decimal  k
       )
            

    Initializes a new instance of the RegressionChanne class.

    RegressionChannel() 2/2

                RegressionChannel QuantConnect.Indicators.RegressionChannel (
        int      period,
        decimal  k
       )
            

    Initializes a new instance of the LeastSquaresMovingAverag class.

    Visualization

    The following image shows plot values of selected properties of RegressionChannel using the plotly library.

    RegressionChannel line plot.

     

    13.1.69 Relative Daily Volume

    Introduction

    The Relative Daily Volume indicator is an indicator that compares current cumulative volume to the cumulative volume for a given time of day, measured as a ratio. Current volume from open to current time of day / Average over the past x days from open to current time of day

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using RDV Indicator

    To create an automatic indicators for RelativeDailyVolume , call the RDV helper method from the QCAlgorithm class. The RDV method creates a RelativeDailyVolume object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RelativeDailyVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeDailyVolume _rdv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rdv = RDV("SPY", 2);
        }
    
        public override void OnData(Slice data)
        {
            if (_rdv.IsReady)
            {
                // The current value of _rdv is represented by itself (_rdv)
                // or _rdv.Current.Value
                Plot("RelativeDailyVolume", "rdv", _rdv);
                
            }
        }
    }
    class RelativeDailyVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rdv = self.RDV("SPY", 2)
    
        def OnData(self, slice: Slice) -> None:
            if self.rdv.IsReady:
                # The current value of self.rdv is represented by self.rdv.Current.Value
                self.Plot("RelativeDailyVolume", "rdv", self.rdv.Current.Value)
                
    

    The following reference table describes the RDV method:

    RDV() 1/1

                RelativeDailyVolume QuantConnect.Algorithm.QCAlgorithm.RDV (
        Symbol                            symbol,
        *Int32                            period,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an RelativeDailyVolume indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RelativeDailyVolume indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class RelativeDailyVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeDailyVolume _rdv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rdv = new RelativeDailyVolume(2);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rdv.Update(bar);
            }
    
            if (_rdv.IsReady)
            {
                // The current value of _rdv is represented by itself (_rdv)
                // or _rdv.Current.Value
                Plot("RelativeDailyVolume", "rdv", _rdv);
                
            }
        }
    }
    class RelativeDailyVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rdv = RelativeDailyVolume(2)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rdv.Update(bar)
    
            if self.rdv.IsReady:
                # The current value of self.rdv is represented by self.rdv.Current.Value
                self.Plot("RelativeDailyVolume", "rdv", self.rdv.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RelativeDailyVolumeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeDailyVolume _rdv;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rdv = new RelativeDailyVolume(2);
            RegisterIndicator(_symbol, _rdv, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rdv.IsReady)
            {
                // The current value of _rdv is represented by itself (_rdv)
                // or _rdv.Current.Value
                Plot("RelativeDailyVolume", "rdv", _rdv);
                
            }
        }
    }
    class RelativeDailyVolumeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rdv = RelativeDailyVolume(2)
            self.RegisterIndicator(self.symbol, self.rdv, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rdv.IsReady:
                # The current value of self.rdv is represented by self.rdv.Current.Value
                self.Plot("RelativeDailyVolume", "rdv", self.rdv.Current.Value)
                
    

    The following reference table describes the RelativeDailyVolume constructor:

    RelativeDailyVolume() 1/2

                RelativeDailyVolume QuantConnect.Indicators.RelativeDailyVolume (
        *int  period
       )
            

    Initializes a new instance of the RelativeDailyVolume class using the specified period.

    RelativeDailyVolume() 2/2

                RelativeDailyVolume QuantConnect.Indicators.RelativeDailyVolume (
        string  name,
        int     period
       )
            

    Creates a new RelativeDailyVolume indicator with the specified period.

    Visualization

    The following image shows plot values of selected properties of RelativeDailyVolume using the plotly library.

    RelativeDailyVolume line plot.

     

    13.1.70 Relative Moving Average

    Introduction

    This indicator represents the relative moving average indicator (RMA). RMA = SMA(3 x Period) - SMA(2 x Period) + SMA(1 x Period) per formula: https://www.hybrid-solutions.com/plugins/client-vtl-plugins/free/rma.html

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using RMA Indicator

    To create an automatic indicators for RelativeMovingAverage , call the RMA helper method from the QCAlgorithm class. The RMA method creates a RelativeMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RelativeMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeMovingAverage _rma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rma = RMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_rma.IsReady)
            {
                // The current value of _rma is represented by itself (_rma)
                // or _rma.Current.Value
                Plot("RelativeMovingAverage", "rma", _rma);
                // Plot all properties of rma
                Plot("RelativeMovingAverage", "shortaverage", _rma.ShortAverage);
                Plot("RelativeMovingAverage", "mediumaverage", _rma.MediumAverage);
                Plot("RelativeMovingAverage", "longaverage", _rma.LongAverage);
            }
        }
    }
    class RelativeMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rma = self.RMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.rma.IsReady:
                # The current value of self.rma is represented by self.rma.Current.Value
                self.Plot("RelativeMovingAverage", "rma", self.rma.Current.Value)
                # Plot all attributes of self.rma
                self.Plot("RelativeMovingAverage", "shortaverage", self.rma.ShortAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "mediumaverage", self.rma.MediumAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "longaverage", self.rma.LongAverage.Current.Value)
    

    The following reference table describes the RMA method:

    RMA() 1/1

                RelativeMovingAverage QuantConnect.Algorithm.QCAlgorithm.RMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Relative Moving Average indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a RelativeMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RelativeMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeMovingAverage _rma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rma = new RelativeMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rma.Update(bar.EndTime, bar.Close);
            }
    
            if (_rma.IsReady)
            {
                // The current value of _rma is represented by itself (_rma)
                // or _rma.Current.Value
                Plot("RelativeMovingAverage", "rma", _rma);
                // Plot all properties of rma
                Plot("RelativeMovingAverage", "shortaverage", _rma.ShortAverage);
                Plot("RelativeMovingAverage", "mediumaverage", _rma.MediumAverage);
                Plot("RelativeMovingAverage", "longaverage", _rma.LongAverage);
            }
        }
    }
    class RelativeMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rma = RelativeMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rma.Update(bar.EndTime, bar.Close)
    
            if self.rma.IsReady:
                # The current value of self.rma is represented by self.rma.Current.Value
                self.Plot("RelativeMovingAverage", "rma", self.rma.Current.Value)
                # Plot all attributes of self.rma
                self.Plot("RelativeMovingAverage", "shortaverage", self.rma.ShortAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "mediumaverage", self.rma.MediumAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "longaverage", self.rma.LongAverage.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RelativeMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeMovingAverage _rma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rma = new RelativeMovingAverage(20);
            RegisterIndicator(_symbol, _rma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rma.IsReady)
            {
                // The current value of _rma is represented by itself (_rma)
                // or _rma.Current.Value
                Plot("RelativeMovingAverage", "rma", _rma);
                // Plot all properties of rma
                Plot("RelativeMovingAverage", "shortaverage", _rma.ShortAverage);
                Plot("RelativeMovingAverage", "mediumaverage", _rma.MediumAverage);
                Plot("RelativeMovingAverage", "longaverage", _rma.LongAverage);
            }
        }
    }
    class RelativeMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rma = RelativeMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.rma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rma.IsReady:
                # The current value of self.rma is represented by self.rma.Current.Value
                self.Plot("RelativeMovingAverage", "rma", self.rma.Current.Value)
                # Plot all attributes of self.rma
                self.Plot("RelativeMovingAverage", "shortaverage", self.rma.ShortAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "mediumaverage", self.rma.MediumAverage.Current.Value)
                self.Plot("RelativeMovingAverage", "longaverage", self.rma.LongAverage.Current.Value)
    

    The following reference table describes the RelativeMovingAverage constructor:

    RelativeMovingAverage() 1/2

                RelativeMovingAverage QuantConnect.Indicators.RelativeMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the RelativeMovingAverage class with the specified name and period.

    RelativeMovingAverage() 2/2

                RelativeMovingAverage QuantConnect.Indicators.RelativeMovingAverage (
        int  period
       )
            

    Initializes a new instance of the SimpleMovingAverage class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of RelativeMovingAverage using the plotly library.

    RelativeMovingAverage line plot.

     

    13.1.71 Relative Strength Index

    Introduction

    This indicator represents the Relative Strength Index (RSI) developed by K. Welles Wilder. You can optionally specified a different moving average type to be used in the computation

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using RSI Indicator

    To create an automatic indicators for RelativeStrengthIndex , call the RSI helper method from the QCAlgorithm class. The RSI method creates a RelativeStrengthIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RelativeStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeStrengthIndex _rsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rsi = RSI("SPY", 14);
        }
    
        public override void OnData(Slice data)
        {
            if (_rsi.IsReady)
            {
                // The current value of _rsi is represented by itself (_rsi)
                // or _rsi.Current.Value
                Plot("RelativeStrengthIndex", "rsi", _rsi);
                // Plot all properties of rsi
                Plot("RelativeStrengthIndex", "averageloss", _rsi.AverageLoss);
                Plot("RelativeStrengthIndex", "averagegain", _rsi.AverageGain);
            }
        }
    }
    class RelativeStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rsi = self.RSI("SPY", 14)
    
        def OnData(self, slice: Slice) -> None:
            if self.rsi.IsReady:
                # The current value of self.rsi is represented by self.rsi.Current.Value
                self.Plot("RelativeStrengthIndex", "rsi", self.rsi.Current.Value)
                # Plot all attributes of self.rsi
                self.Plot("RelativeStrengthIndex", "averageloss", self.rsi.AverageLoss.Current.Value)
                self.Plot("RelativeStrengthIndex", "averagegain", self.rsi.AverageGain.Current.Value)
    

    The following reference table describes the RSI method:

    RSI() 1/1

                RelativeStrengthIndex QuantConnect.Algorithm.QCAlgorithm.RSI (
        Symbol                           symbol,
        Int32                            period,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RelativeStrengthIndex indicator. This will produce an oscillator that ranges from 0 to 100 based on the ratio of average gains to average losses over the specified period.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a RelativeStrengthIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class RelativeStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeStrengthIndex _rsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rsi = new RelativeStrengthIndex(14);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rsi.Update(bar.EndTime, bar.Close);
            }
    
            if (_rsi.IsReady)
            {
                // The current value of _rsi is represented by itself (_rsi)
                // or _rsi.Current.Value
                Plot("RelativeStrengthIndex", "rsi", _rsi);
                // Plot all properties of rsi
                Plot("RelativeStrengthIndex", "averageloss", _rsi.AverageLoss);
                Plot("RelativeStrengthIndex", "averagegain", _rsi.AverageGain);
            }
        }
    }
    class RelativeStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rsi = RelativeStrengthIndex(14)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rsi.Update(bar.EndTime, bar.Close)
    
            if self.rsi.IsReady:
                # The current value of self.rsi is represented by self.rsi.Current.Value
                self.Plot("RelativeStrengthIndex", "rsi", self.rsi.Current.Value)
                # Plot all attributes of self.rsi
                self.Plot("RelativeStrengthIndex", "averageloss", self.rsi.AverageLoss.Current.Value)
                self.Plot("RelativeStrengthIndex", "averagegain", self.rsi.AverageGain.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RelativeStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeStrengthIndex _rsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rsi = new RelativeStrengthIndex(14);
            RegisterIndicator(_symbol, _rsi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rsi.IsReady)
            {
                // The current value of _rsi is represented by itself (_rsi)
                // or _rsi.Current.Value
                Plot("RelativeStrengthIndex", "rsi", _rsi);
                // Plot all properties of rsi
                Plot("RelativeStrengthIndex", "averageloss", _rsi.AverageLoss);
                Plot("RelativeStrengthIndex", "averagegain", _rsi.AverageGain);
            }
        }
    }
    class RelativeStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rsi = RelativeStrengthIndex(14)
            self.RegisterIndicator(self.symbol, self.rsi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rsi.IsReady:
                # The current value of self.rsi is represented by self.rsi.Current.Value
                self.Plot("RelativeStrengthIndex", "rsi", self.rsi.Current.Value)
                # Plot all attributes of self.rsi
                self.Plot("RelativeStrengthIndex", "averageloss", self.rsi.AverageLoss.Current.Value)
                self.Plot("RelativeStrengthIndex", "averagegain", self.rsi.AverageGain.Current.Value)
    

    The following reference table describes the RelativeStrengthIndex constructor:

    RelativeStrengthIndex() 1/2

                RelativeStrengthIndex QuantConnect.Indicators.RelativeStrengthIndex (
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the RelativeStrengthIndex class with the specified name and period.

    RelativeStrengthIndex() 2/2

                RelativeStrengthIndex QuantConnect.Indicators.RelativeStrengthIndex (
        string              name,
        int                 period,
        *MovingAverageType  movingAverageType
       )
            

    Initializes a new instance of the RelativeStrengthIndex class with the specified name and period.

    Visualization

    The following image shows plot values of selected properties of RelativeStrengthIndex using the plotly library.

    RelativeStrengthIndex line plot.

     

    13.1.72 Relative Vigor Index

    Introduction

    The Relative Vigor Index (RVI) compares the ratio of the closing price of a security to its trading range. For illustration, let: a = Close−Open b = Close−Open of One Bar Prior to a c = Close−Open of One Bar Prior to b d = Close−Open of One Bar Prior to c e = High−Low of Bar a f = High−Low of Bar b g = High−Low of Bar c h = High−Low of Bar d Then let (a+2*(b+c)+d)/6 be NUM and (e+2*(f+g)+h)/6 be DENOM. RVI = SMA(NUM)/SMA(DENOM) for a specified period. https://www.investopedia.com/terms/r/relative_vigor_index.asp

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using RVI Indicator

    To create an automatic indicators for RelativeVigorIndex , call the RVI helper method from the QCAlgorithm class. The RVI method creates a RelativeVigorIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class RelativeVigorIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeVigorIndex _rvi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rvi = RVI("SPY", 20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (_rvi.IsReady)
            {
                // The current value of _rvi is represented by itself (_rvi)
                // or _rvi.Current.Value
                Plot("RelativeVigorIndex", "rvi", _rvi);
                // Plot all properties of rvi
                Plot("RelativeVigorIndex", "signal", _rvi.Signal);
            }
        }
    }
    class RelativeVigorIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rvi = self.RVI("SPY", 20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            if self.rvi.IsReady:
                # The current value of self.rvi is represented by self.rvi.Current.Value
                self.Plot("RelativeVigorIndex", "rvi", self.rvi.Current.Value)
                # Plot all attributes of self.rvi
                self.Plot("RelativeVigorIndex", "signal", self.rvi.Signal.Current.Value)
    

    The following reference table describes the RVI method:

    RVI() 1/1

                RelativeVigorIndex QuantConnect.Algorithm.QCAlgorithm.RVI (
        Symbol                            symbol,
        Int32                             period,
        *MovingAverageType                movingAverageType,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new RelativeVigorIndex indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a RelativeVigorIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class RelativeVigorIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeVigorIndex _rvi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rvi = new RelativeVigorIndex(20, MovingAverageType.Simple);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _rvi.Update(bar);
            }
    
            if (_rvi.IsReady)
            {
                // The current value of _rvi is represented by itself (_rvi)
                // or _rvi.Current.Value
                Plot("RelativeVigorIndex", "rvi", _rvi);
                // Plot all properties of rvi
                Plot("RelativeVigorIndex", "signal", _rvi.Signal);
            }
        }
    }
    class RelativeVigorIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rvi = RelativeVigorIndex(20, MovingAverageType.Simple)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.rvi.Update(bar)
    
            if self.rvi.IsReady:
                # The current value of self.rvi is represented by self.rvi.Current.Value
                self.Plot("RelativeVigorIndex", "rvi", self.rvi.Current.Value)
                # Plot all attributes of self.rvi
                self.Plot("RelativeVigorIndex", "signal", self.rvi.Signal.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class RelativeVigorIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private RelativeVigorIndex _rvi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _rvi = new RelativeVigorIndex(20, MovingAverageType.Simple);
            RegisterIndicator(_symbol, _rvi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_rvi.IsReady)
            {
                // The current value of _rvi is represented by itself (_rvi)
                // or _rvi.Current.Value
                Plot("RelativeVigorIndex", "rvi", _rvi);
                // Plot all properties of rvi
                Plot("RelativeVigorIndex", "signal", _rvi.Signal);
            }
        }
    }
    class RelativeVigorIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.rvi = RelativeVigorIndex(20, MovingAverageType.Simple)
            self.RegisterIndicator(self.symbol, self.rvi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.rvi.IsReady:
                # The current value of self.rvi is represented by self.rvi.Current.Value
                self.Plot("RelativeVigorIndex", "rvi", self.rvi.Current.Value)
                # Plot all attributes of self.rvi
                self.Plot("RelativeVigorIndex", "signal", self.rvi.Signal.Current.Value)
    

    The following reference table describes the RelativeVigorIndex constructor:

    RelativeVigorIndex() 1/2

                RelativeVigorIndex QuantConnect.Indicators.RelativeVigorIndex (
        int                period,
        MovingAverageType  type
       )
            

    Initializes a new instance of the RelativeVigorInde (RVI) class.

    RelativeVigorIndex() 2/2

                RelativeVigorIndex QuantConnect.Indicators.RelativeVigorIndex (
        string              name,
        int                 period,
        *MovingAverageType  type
       )
            

    Initializes a new instance of the RelativeVigorInde (RVI) class.

    Visualization

    The following image shows plot values of selected properties of RelativeVigorIndex using the plotly library.

    RelativeVigorIndex line plot.

     

    13.1.73 Schaff Trend Cycle

    Introduction

    This indicator creates the Schaff Trend Cycle

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using STC Indicator

    To create an automatic indicators for SchaffTrendCycle , call the STC helper method from the QCAlgorithm class. The STC method creates a SchaffTrendCycle object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SchaffTrendCycleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SchaffTrendCycle _stc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stc = STC("SPY", 5, 10, 20, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (_stc.IsReady)
            {
                // The current value of _stc is represented by itself (_stc)
                // or _stc.Current.Value
                Plot("SchaffTrendCycle", "stc", _stc);
                
            }
        }
    }
    class SchaffTrendCycleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stc = self.STC("SPY", 5, 10, 20, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            if self.stc.IsReady:
                # The current value of self.stc is represented by self.stc.Current.Value
                self.Plot("SchaffTrendCycle", "stc", self.stc.Current.Value)
                
    

    The following reference table describes the STC method:

    STC() 1/1

                SchaffTrendCycle QuantConnect.Algorithm.QCAlgorithm.STC (
        Symbol                           symbol,
        Int32                            cyclePeriod,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Schaff Trend Cycle indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a SchaffTrendCycle indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SchaffTrendCycleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SchaffTrendCycle _stc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stc = new SchaffTrendCycle(5, 10, 20, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _stc.Update(bar.EndTime, bar.Close);
            }
    
            if (_stc.IsReady)
            {
                // The current value of _stc is represented by itself (_stc)
                // or _stc.Current.Value
                Plot("SchaffTrendCycle", "stc", _stc);
                
            }
        }
    }
    class SchaffTrendCycleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stc = SchaffTrendCycle(5, 10, 20, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.stc.Update(bar.EndTime, bar.Close)
    
            if self.stc.IsReady:
                # The current value of self.stc is represented by self.stc.Current.Value
                self.Plot("SchaffTrendCycle", "stc", self.stc.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SchaffTrendCycleAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SchaffTrendCycle _stc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _stc = new SchaffTrendCycle(5, 10, 20, MovingAverageType.Exponential);
            RegisterIndicator(_symbol, _stc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_stc.IsReady)
            {
                // The current value of _stc is represented by itself (_stc)
                // or _stc.Current.Value
                Plot("SchaffTrendCycle", "stc", _stc);
                
            }
        }
    }
    class SchaffTrendCycleAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.stc = SchaffTrendCycle(5, 10, 20, MovingAverageType.Exponential)
            self.RegisterIndicator(self.symbol, self.stc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.stc.IsReady:
                # The current value of self.stc is represented by self.stc.Current.Value
                self.Plot("SchaffTrendCycle", "stc", self.stc.Current.Value)
                
    

    The following reference table describes the SchaffTrendCycle constructor:

    SchaffTrendCycle() 1/2

                SchaffTrendCycle QuantConnect.Indicators.SchaffTrendCycle (
        *int                fastPeriod,
        *int                slowPeriod,
        *int                cyclePeriod,
        *MovingAverageType  type
       )
            

    https://www.tradingpedia.com/forex-trading-indicators/schaff-trend-cycle.

    SchaffTrendCycle() 2/2

                SchaffTrendCycle QuantConnect.Indicators.SchaffTrendCycle (
        string             name,
        int                fastPeriod,
        int                slowPeriod,
        int                cyclePeriod,
        MovingAverageType  type
       )
            

    Creates a new schaff trend cycle with the specified parameters.

    Visualization

    The following image shows plot values of selected properties of SchaffTrendCycle using the plotly library.

    SchaffTrendCycle line plot.

     

    13.1.74 Sharpe Ratio

    Introduction

    Calculation of the Sharpe Ratio (SR) developed by William F. Sharpe. Reference: https://www.investopedia.com/articles/07/sharpe_ratio.asp Formula: S(x) = (Rx - Rf) / stdDev(Rx) Where: S(x) - sharpe ratio of x Rx - average rate of return for x Rf - risk-free rate

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SR Indicator

    To create an automatic indicators for SharpeRatio , call the SR helper method from the QCAlgorithm class. The SR method creates a SharpeRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SharpeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SharpeRatio _sr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sr = SR("SPY", 22, 0.03);
        }
    
        public override void OnData(Slice data)
        {
            if (_sr.IsReady)
            {
                // The current value of _sr is represented by itself (_sr)
                // or _sr.Current.Value
                Plot("SharpeRatio", "sr", _sr);
                
            }
        }
    }
    class SharpeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sr = self.SR("SPY", 22, 0.03)
    
        def OnData(self, slice: Slice) -> None:
            if self.sr.IsReady:
                # The current value of self.sr is represented by self.sr.Current.Value
                self.Plot("SharpeRatio", "sr", self.sr.Current.Value)
                
    

    The following reference table describes the SR method:

    SR() 1/1

                SharpeRatio QuantConnect.Algorithm.QCAlgorithm.SR (
        Symbol                           symbol,
        Int32                            sharpePeriod,
        *Decimal                         riskFreeRate,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RollingSharpeRatio indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SharpeRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SharpeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SharpeRatio _sr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sr = new SharpeRatio(22, 0.03);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sr.Update(bar.EndTime, bar.Close);
            }
    
            if (_sr.IsReady)
            {
                // The current value of _sr is represented by itself (_sr)
                // or _sr.Current.Value
                Plot("SharpeRatio", "sr", _sr);
                
            }
        }
    }
    class SharpeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sr = SharpeRatio(22, 0.03)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sr.Update(bar.EndTime, bar.Close)
    
            if self.sr.IsReady:
                # The current value of self.sr is represented by self.sr.Current.Value
                self.Plot("SharpeRatio", "sr", self.sr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SharpeRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SharpeRatio _sr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sr = new SharpeRatio(22, 0.03);
            RegisterIndicator(_symbol, _sr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sr.IsReady)
            {
                // The current value of _sr is represented by itself (_sr)
                // or _sr.Current.Value
                Plot("SharpeRatio", "sr", _sr);
                
            }
        }
    }
    class SharpeRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sr = SharpeRatio(22, 0.03)
            self.RegisterIndicator(self.symbol, self.sr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sr.IsReady:
                # The current value of self.sr is represented by self.sr.Current.Value
                self.Plot("SharpeRatio", "sr", self.sr.Current.Value)
                
    

    The following reference table describes the SharpeRatio constructor:

    SharpeRatio() 1/2

                SharpeRatio QuantConnect.Indicators.SharpeRatio (
        string    name,
        int       period,
        *decimal  riskFreeRate
       )
            

    Creates a new Sharpe Ratio indicator using the specified periods.

    SharpeRatio() 2/2

                SharpeRatio QuantConnect.Indicators.SharpeRatio (
        int       period,
        *decimal  riskFreeRate
       )
            

    Creates a new SharpeRatio indicator using the specified periods.

    Visualization

    The following image shows plot values of selected properties of SharpeRatio using the plotly library.

    SharpeRatio line plot.

     

    13.1.75 Simple Moving Average

    Introduction

    This indicator represents the traditional simple moving average indicator (SMA)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SMA Indicator

    To create an automatic indicators for SimpleMovingAverage , call the SMA helper method from the QCAlgorithm class. The SMA method creates a SimpleMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SimpleMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SimpleMovingAverage _sma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sma = SMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_sma.IsReady)
            {
                // The current value of _sma is represented by itself (_sma)
                // or _sma.Current.Value
                Plot("SimpleMovingAverage", "sma", _sma);
                // Plot all properties of sma
                Plot("SimpleMovingAverage", "rollingsum", _sma.RollingSum);
            }
        }
    }
    class SimpleMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sma = self.SMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.sma.IsReady:
                # The current value of self.sma is represented by self.sma.Current.Value
                self.Plot("SimpleMovingAverage", "sma", self.sma.Current.Value)
                # Plot all attributes of self.sma
                self.Plot("SimpleMovingAverage", "rollingsum", self.sma.RollingSum.Current.Value)
    

    The following reference table describes the SMA method:

    SMA() 1/1

                SimpleMovingAverage QuantConnect.Algorithm.QCAlgorithm.SMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an SimpleMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SimpleMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SimpleMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SimpleMovingAverage _sma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sma = new SimpleMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sma.Update(bar.EndTime, bar.Close);
            }
    
            if (_sma.IsReady)
            {
                // The current value of _sma is represented by itself (_sma)
                // or _sma.Current.Value
                Plot("SimpleMovingAverage", "sma", _sma);
                // Plot all properties of sma
                Plot("SimpleMovingAverage", "rollingsum", _sma.RollingSum);
            }
        }
    }
    class SimpleMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sma = SimpleMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sma.Update(bar.EndTime, bar.Close)
    
            if self.sma.IsReady:
                # The current value of self.sma is represented by self.sma.Current.Value
                self.Plot("SimpleMovingAverage", "sma", self.sma.Current.Value)
                # Plot all attributes of self.sma
                self.Plot("SimpleMovingAverage", "rollingsum", self.sma.RollingSum.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SimpleMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SimpleMovingAverage _sma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sma = new SimpleMovingAverage(20);
            RegisterIndicator(_symbol, _sma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sma.IsReady)
            {
                // The current value of _sma is represented by itself (_sma)
                // or _sma.Current.Value
                Plot("SimpleMovingAverage", "sma", _sma);
                // Plot all properties of sma
                Plot("SimpleMovingAverage", "rollingsum", _sma.RollingSum);
            }
        }
    }
    class SimpleMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sma = SimpleMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.sma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sma.IsReady:
                # The current value of self.sma is represented by self.sma.Current.Value
                self.Plot("SimpleMovingAverage", "sma", self.sma.Current.Value)
                # Plot all attributes of self.sma
                self.Plot("SimpleMovingAverage", "rollingsum", self.sma.RollingSum.Current.Value)
    

    The following reference table describes the SimpleMovingAverage constructor:

    SimpleMovingAverage() 1/2

                SimpleMovingAverage QuantConnect.Indicators.SimpleMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the SimpleMovingAverage class with the specified name and period.

    SimpleMovingAverage() 2/2

                SimpleMovingAverage QuantConnect.Indicators.SimpleMovingAverage (
        int  period
       )
            

    Initializes a new instance of the SimpleMovingAverage class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of SimpleMovingAverage using the plotly library.

    SimpleMovingAverage line plot.

     

    13.1.76 Sortino Ratio

    Introduction

    Calculation of the Sortino Ratio, a modification of the . Reference: https://www.cmegroup.com/education/files/rr-sortino-a-sharper-ratio.pdf Formula: S(x) = (R - T) / TDD Where: S(x) - Sortino ratio of x R - the average period return T - the target or required rate of return for the investment strategy under consideration. In Sortino’s early work, T was originally known as the minimum acceptable return, or MAR. In his more recent work, MAR is now referred to as the Desired Target Return. TDD - the target downside deviation.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SORTINO Indicator

    To create an automatic indicators for SortinoRatio , call the SORTINO helper method from the QCAlgorithm class. The SORTINO method creates a SortinoRatio object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SortinoRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SortinoRatio _sortino;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sortino = SORTINO("SPY", 22);
        }
    
        public override void OnData(Slice data)
        {
            if (_sortino.IsReady)
            {
                // The current value of _sortino is represented by itself (_sortino)
                // or _sortino.Current.Value
                Plot("SortinoRatio", "sortino", _sortino);
                
            }
        }
    }
    class SortinoRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sortino = self.SORTINO("SPY", 22)
    
        def OnData(self, slice: Slice) -> None:
            if self.sortino.IsReady:
                # The current value of self.sortino is represented by self.sortino.Current.Value
                self.Plot("SortinoRatio", "sortino", self.sortino.Current.Value)
                
    

    The following reference table describes the SORTINO method:

    SORTINO() 1/1

                SortinoRatio QuantConnect.Algorithm.QCAlgorithm.SORTINO (
        Symbol                           symbol,
        Int32                            sortinoPeriod,
        *Double                          minimumAcceptableReturn,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Sortino indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SortinoRatio indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SortinoRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SortinoRatio _sortino;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sortino = new SortinoRatio(22);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sortino.Update(bar.EndTime, bar.Close);
            }
    
            if (_sortino.IsReady)
            {
                // The current value of _sortino is represented by itself (_sortino)
                // or _sortino.Current.Value
                Plot("SortinoRatio", "sortino", _sortino);
                
            }
        }
    }
    class SortinoRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sortino = SortinoRatio(22)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sortino.Update(bar.EndTime, bar.Close)
    
            if self.sortino.IsReady:
                # The current value of self.sortino is represented by self.sortino.Current.Value
                self.Plot("SortinoRatio", "sortino", self.sortino.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SortinoRatioAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SortinoRatio _sortino;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sortino = new SortinoRatio(22);
            RegisterIndicator(_symbol, _sortino, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sortino.IsReady)
            {
                // The current value of _sortino is represented by itself (_sortino)
                // or _sortino.Current.Value
                Plot("SortinoRatio", "sortino", _sortino);
                
            }
        }
    }
    class SortinoRatioAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sortino = SortinoRatio(22)
            self.RegisterIndicator(self.symbol, self.sortino, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sortino.IsReady:
                # The current value of self.sortino is represented by self.sortino.Current.Value
                self.Plot("SortinoRatio", "sortino", self.sortino.Current.Value)
                
    

    The following reference table describes the SortinoRatio constructor:

    SortinoRatio() 1/2

                SortinoRatio QuantConnect.Indicators.SortinoRatio (
        string   name,
        int      period,
        *double  minimumAcceptableReturn
       )
            

    Creates a new Sortino Ratio indicator using the specified periods.

    SortinoRatio() 2/2

                SortinoRatio QuantConnect.Indicators.SortinoRatio (
        int      period,
        *double  minimumAcceptableReturn
       )
            

    Creates a new SortinoRatio indicator using the specified periods.

    Visualization

    The following image shows plot values of selected properties of SortinoRatio using the plotly library.

    SortinoRatio line plot.

     

    13.1.77 Standard Deviation

    Introduction

    This indicator computes the n-period population standard deviation.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using STD Indicator

    To create an automatic indicators for StandardDeviation , call the STD helper method from the QCAlgorithm class. The STD method creates a StandardDeviation object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class StandardDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StandardDeviation _std;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _std = STD("SPY", 22);
        }
    
        public override void OnData(Slice data)
        {
            if (_std.IsReady)
            {
                // The current value of _std is represented by itself (_std)
                // or _std.Current.Value
                Plot("StandardDeviation", "std", _std);
                
            }
        }
    }
    class StandardDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.std = self.STD("SPY", 22)
    
        def OnData(self, slice: Slice) -> None:
            if self.std.IsReady:
                # The current value of self.std is represented by self.std.Current.Value
                self.Plot("StandardDeviation", "std", self.std.Current.Value)
                
    

    The following reference table describes the STD method:

    STD() 1/1

                StandardDeviation QuantConnect.Algorithm.QCAlgorithm.STD (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new StandardDeviation indicator. This will return the population standard deviation of samples over the specified period.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a StandardDeviation indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class StandardDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StandardDeviation _std;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _std = new StandardDeviation(22);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _std.Update(bar.EndTime, bar.Close);
            }
    
            if (_std.IsReady)
            {
                // The current value of _std is represented by itself (_std)
                // or _std.Current.Value
                Plot("StandardDeviation", "std", _std);
                
            }
        }
    }
    class StandardDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.std = StandardDeviation(22)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.std.Update(bar.EndTime, bar.Close)
    
            if self.std.IsReady:
                # The current value of self.std is represented by self.std.Current.Value
                self.Plot("StandardDeviation", "std", self.std.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class StandardDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private StandardDeviation _std;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _std = new StandardDeviation(22);
            RegisterIndicator(_symbol, _std, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_std.IsReady)
            {
                // The current value of _std is represented by itself (_std)
                // or _std.Current.Value
                Plot("StandardDeviation", "std", _std);
                
            }
        }
    }
    class StandardDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.std = StandardDeviation(22)
            self.RegisterIndicator(self.symbol, self.std, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.std.IsReady:
                # The current value of self.std is represented by self.std.Current.Value
                self.Plot("StandardDeviation", "std", self.std.Current.Value)
                
    

    The following reference table describes the StandardDeviation constructor:

    StandardDeviation() 1/2

                StandardDeviation QuantConnect.Indicators.StandardDeviation (
        int  period
       )
            

    On a data set of size N will use an N normalizer and would thus be biased if applied to a subset.

    StandardDeviation() 2/2

                StandardDeviation QuantConnect.Indicators.StandardDeviation (
        string  name,
        int     period
       )
            

    On a data set of size N will use an N normalizer and would thus be biased if applied to a subset.

    Visualization

    The following image shows plot values of selected properties of StandardDeviation using the plotly library.

    StandardDeviation line plot.

     

    13.1.78 Stochastic

    Introduction

    This indicator computes the Slow Stochastics %K and %D. The Fast Stochastics %K is is computed by (Current Close Price - Lowest Price of given Period) / (Highest Price of given Period - Lowest Price of given Period) multiplied by 100. Once the Fast Stochastics %K is calculated the Slow Stochastic %K is calculated by the average/smoothed price of of the Fast %K with the given period. The Slow Stochastics %D is then derived from the Slow Stochastics %K with the given period.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using STO Indicator

    To create an automatic indicators for Stochastic , call the STO helper method from the QCAlgorithm class. The STO method creates a Stochastic object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class StochasticAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Stochastic _sto;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sto = STO("SPY", 20, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_sto.IsReady)
            {
                // The current value of _sto is represented by itself (_sto)
                // or _sto.Current.Value
                Plot("Stochastic", "sto", _sto);
                // Plot all properties of sto
                Plot("Stochastic", "faststoch", _sto.FastStoch);
                Plot("Stochastic", "stochk", _sto.StochK);
                Plot("Stochastic", "stochd", _sto.StochD);
            }
        }
    }
    class StochasticAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sto = self.STO("SPY", 20, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.sto.IsReady:
                # The current value of self.sto is represented by self.sto.Current.Value
                self.Plot("Stochastic", "sto", self.sto.Current.Value)
                # Plot all attributes of self.sto
                self.Plot("Stochastic", "faststoch", self.sto.FastStoch.Current.Value)
                self.Plot("Stochastic", "stochk", self.sto.StochK.Current.Value)
                self.Plot("Stochastic", "stochd", self.sto.StochD.Current.Value)
    

    The following reference table describes the STO method:

    STO() 1/2

                Stochastic QuantConnect.Algorithm.QCAlgorithm.STO (
        Symbol                            symbol,
        Int32                             period,
        Int32                             kPeriod,
        Int32                             dPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Stochastic indicator.

    STO() 2/2

                Stochastic QuantConnect.Algorithm.QCAlgorithm.STO (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Overload short hand to create a new Stochastic indicator; defaulting to the 3 period for dStoch.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Stochastic indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class StochasticAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Stochastic _sto;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sto = new Stochastic(20, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sto.Update(bar);
            }
    
            if (_sto.IsReady)
            {
                // The current value of _sto is represented by itself (_sto)
                // or _sto.Current.Value
                Plot("Stochastic", "sto", _sto);
                // Plot all properties of sto
                Plot("Stochastic", "faststoch", _sto.FastStoch);
                Plot("Stochastic", "stochk", _sto.StochK);
                Plot("Stochastic", "stochd", _sto.StochD);
            }
        }
    }
    class StochasticAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sto = Stochastic(20, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sto.Update(bar)
    
            if self.sto.IsReady:
                # The current value of self.sto is represented by self.sto.Current.Value
                self.Plot("Stochastic", "sto", self.sto.Current.Value)
                # Plot all attributes of self.sto
                self.Plot("Stochastic", "faststoch", self.sto.FastStoch.Current.Value)
                self.Plot("Stochastic", "stochk", self.sto.StochK.Current.Value)
                self.Plot("Stochastic", "stochd", self.sto.StochD.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class StochasticAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Stochastic _sto;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sto = new Stochastic(20, 10, 20);
            RegisterIndicator(_symbol, _sto, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sto.IsReady)
            {
                // The current value of _sto is represented by itself (_sto)
                // or _sto.Current.Value
                Plot("Stochastic", "sto", _sto);
                // Plot all properties of sto
                Plot("Stochastic", "faststoch", _sto.FastStoch);
                Plot("Stochastic", "stochk", _sto.StochK);
                Plot("Stochastic", "stochd", _sto.StochD);
            }
        }
    }
    class StochasticAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sto = Stochastic(20, 10, 20)
            self.RegisterIndicator(self.symbol, self.sto, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sto.IsReady:
                # The current value of self.sto is represented by self.sto.Current.Value
                self.Plot("Stochastic", "sto", self.sto.Current.Value)
                # Plot all attributes of self.sto
                self.Plot("Stochastic", "faststoch", self.sto.FastStoch.Current.Value)
                self.Plot("Stochastic", "stochk", self.sto.StochK.Current.Value)
                self.Plot("Stochastic", "stochd", self.sto.StochD.Current.Value)
    

    The following reference table describes the Stochastic constructor:

    Stochastic() 1/2

                Stochastic QuantConnect.Indicators.Stochastic (
        string  name,
        int     period,
        int     kPeriod,
        int     dPeriod
       )
            

    Creates a new Stochastics Indicator from the specified periods.

    Stochastic() 2/2

                Stochastic QuantConnect.Indicators.Stochastic (
        int  period,
        int  kPeriod,
        int  dPeriod
       )
            

    Creates a new Stochasti indicator from the specified inputs.

    Visualization

    The following image shows plot values of selected properties of Stochastic using the plotly library.

    Stochastic line plot.

     

    13.1.79 Sum

    Introduction

    This indicator represents an indicator capable of tracking the sum for the given period

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SUM Indicator

    To create an automatic indicators for Sum , call the SUM helper method from the QCAlgorithm class. The SUM method creates a Sum object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Sum _sum;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sum = SUM("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_sum.IsReady)
            {
                // The current value of _sum is represented by itself (_sum)
                // or _sum.Current.Value
                Plot("Sum", "sum", _sum);
                
            }
        }
    }
    class SumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sum = self.SUM("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.sum.IsReady:
                # The current value of self.sum is represented by self.sum.Current.Value
                self.Plot("Sum", "sum", self.sum.Current.Value)
                
    

    The following reference table describes the SUM method:

    SUM() 1/1

                Sum QuantConnect.Algorithm.QCAlgorithm.SUM (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Sum indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Sum indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Sum _sum;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sum = new Sum(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _sum.Update(bar.EndTime, bar.Close);
            }
    
            if (_sum.IsReady)
            {
                // The current value of _sum is represented by itself (_sum)
                // or _sum.Current.Value
                Plot("Sum", "sum", _sum);
                
            }
        }
    }
    class SumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sum = Sum(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.sum.Update(bar.EndTime, bar.Close)
    
            if self.sum.IsReady:
                # The current value of self.sum is represented by self.sum.Current.Value
                self.Plot("Sum", "sum", self.sum.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SumAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Sum _sum;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _sum = new Sum(20);
            RegisterIndicator(_symbol, _sum, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_sum.IsReady)
            {
                // The current value of _sum is represented by itself (_sum)
                // or _sum.Current.Value
                Plot("Sum", "sum", _sum);
                
            }
        }
    }
    class SumAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.sum = Sum(20)
            self.RegisterIndicator(self.symbol, self.sum, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.sum.IsReady:
                # The current value of self.sum is represented by self.sum.Current.Value
                self.Plot("Sum", "sum", self.sum.Current.Value)
                
    

    The following reference table describes the Sum constructor:

    Sum() 1/2

                Sum QuantConnect.Indicators.Sum (
        string  name,
        int     period
       )
            

    Initializes a new instance of the Sum class with the specified name and period.

    Sum() 2/2

                Sum QuantConnect.Indicators.Sum (
        int  period
       )
            

    Initializes a new instance of the Sum class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of Sum using the plotly library.

    Sum line plot.

     

    13.1.80 Super Trend

    Introduction

    Super trend indicator. Formula can be found here via the excel file: https://tradingtuitions.com/supertrend-indicator-excel-sheet-with-realtime-buy-sell-signals/

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using STR Indicator

    To create an automatic indicators for SuperTrend , call the STR helper method from the QCAlgorithm class. The STR method creates a SuperTrend object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SuperTrendAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SuperTrend _str;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _str = STR("SPY", 20, 2, MovingAverageType.Wilders);
        }
    
        public override void OnData(Slice data)
        {
            if (_str.IsReady)
            {
                // The current value of _str is represented by itself (_str)
                // or _str.Current.Value
                Plot("SuperTrend", "str", _str);
                // Plot all properties of str
                Plot("SuperTrend", "basicupperband", _str.BasicUpperBand);
                Plot("SuperTrend", "basiclowerband", _str.BasicLowerBand);
                Plot("SuperTrend", "currenttrailingupperband", _str.CurrentTrailingUpperBand);
                Plot("SuperTrend", "currenttrailinglowerband", _str.CurrentTrailingLowerBand);
            }
        }
    }
    class SuperTrendAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.str = self.STR("SPY", 20, 2, MovingAverageType.Wilders)
    
        def OnData(self, slice: Slice) -> None:
            if self.str.IsReady:
                # The current value of self.str is represented by self.str.Current.Value
                self.Plot("SuperTrend", "str", self.str.Current.Value)
                # Plot all attributes of self.str
                self.Plot("SuperTrend", "basicupperband", self.str.BasicUpperBand.Current.Value)
                self.Plot("SuperTrend", "basiclowerband", self.str.BasicLowerBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailingupperband", self.str.CurrentTrailingUpperBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailinglowerband", self.str.CurrentTrailingLowerBand.Current.Value)
    

    The following reference table describes the STR method:

    STR() 1/1

                SuperTrend QuantConnect.Algorithm.QCAlgorithm.STR (
        Symbol                                symbol,
        Int32                                 period,
        Decimal                               multiplier,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new SuperTrend indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a SuperTrend indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class SuperTrendAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SuperTrend _str;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _str = new SuperTrend(20, 2, MovingAverageType.Wilders);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _str.Update(bar);
            }
    
            if (_str.IsReady)
            {
                // The current value of _str is represented by itself (_str)
                // or _str.Current.Value
                Plot("SuperTrend", "str", _str);
                // Plot all properties of str
                Plot("SuperTrend", "basicupperband", _str.BasicUpperBand);
                Plot("SuperTrend", "basiclowerband", _str.BasicLowerBand);
                Plot("SuperTrend", "currenttrailingupperband", _str.CurrentTrailingUpperBand);
                Plot("SuperTrend", "currenttrailinglowerband", _str.CurrentTrailingLowerBand);
            }
        }
    }
    class SuperTrendAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.str = SuperTrend(20, 2, MovingAverageType.Wilders)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.str.Update(bar)
    
            if self.str.IsReady:
                # The current value of self.str is represented by self.str.Current.Value
                self.Plot("SuperTrend", "str", self.str.Current.Value)
                # Plot all attributes of self.str
                self.Plot("SuperTrend", "basicupperband", self.str.BasicUpperBand.Current.Value)
                self.Plot("SuperTrend", "basiclowerband", self.str.BasicLowerBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailingupperband", self.str.CurrentTrailingUpperBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailinglowerband", self.str.CurrentTrailingLowerBand.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SuperTrendAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SuperTrend _str;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _str = new SuperTrend(20, 2, MovingAverageType.Wilders);
            RegisterIndicator(_symbol, _str, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_str.IsReady)
            {
                // The current value of _str is represented by itself (_str)
                // or _str.Current.Value
                Plot("SuperTrend", "str", _str);
                // Plot all properties of str
                Plot("SuperTrend", "basicupperband", _str.BasicUpperBand);
                Plot("SuperTrend", "basiclowerband", _str.BasicLowerBand);
                Plot("SuperTrend", "currenttrailingupperband", _str.CurrentTrailingUpperBand);
                Plot("SuperTrend", "currenttrailinglowerband", _str.CurrentTrailingLowerBand);
            }
        }
    }
    class SuperTrendAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.str = SuperTrend(20, 2, MovingAverageType.Wilders)
            self.RegisterIndicator(self.symbol, self.str, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.str.IsReady:
                # The current value of self.str is represented by self.str.Current.Value
                self.Plot("SuperTrend", "str", self.str.Current.Value)
                # Plot all attributes of self.str
                self.Plot("SuperTrend", "basicupperband", self.str.BasicUpperBand.Current.Value)
                self.Plot("SuperTrend", "basiclowerband", self.str.BasicLowerBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailingupperband", self.str.CurrentTrailingUpperBand.Current.Value)
                self.Plot("SuperTrend", "currenttrailinglowerband", self.str.CurrentTrailingLowerBand.Current.Value)
    

    The following reference table describes the SuperTrend constructor:

    SuperTrend() 1/2

                SuperTrend QuantConnect.Indicators.SuperTrend (
        string              name,
        int                 period,
        decimal             multiplier,
        *MovingAverageType  movingAverageType
       )
            

    Creates a new SuperTrend indicator using the specified name, period, multiplier and moving average type.

    SuperTrend() 2/2

                SuperTrend QuantConnect.Indicators.SuperTrend (
        int                 period,
        decimal             multiplier,
        *MovingAverageType  movingAverageType
       )
            

    Creates a new SuperTrend indicator using the specified period, multiplier and moving average type.

    Visualization

    The following image shows plot values of selected properties of SuperTrend using the plotly library.

    SuperTrend line plot.

     

    13.1.81 Swiss Army Knife

    Introduction

    Swiss Army Knife indicator by John Ehlers

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SWISS Indicator

    To create an automatic indicators for SwissArmyKnife , call the SWISS helper method from the QCAlgorithm class. The SWISS method creates a SwissArmyKnife object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class SwissArmyKnifeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SwissArmyKnife _swiss;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _swiss = SWISS("SPY", 20, 0.2, SwissArmyKnifeTool.Gauss);
        }
    
        public override void OnData(Slice data)
        {
            if (_swiss.IsReady)
            {
                // The current value of _swiss is represented by itself (_swiss)
                // or _swiss.Current.Value
                Plot("SwissArmyKnife", "swiss", _swiss);
                
            }
        }
    }
    class SwissArmyKnifeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.swiss = self.SWISS("SPY", 20, 0.2, SwissArmyKnifeTool.Gauss)
    
        def OnData(self, slice: Slice) -> None:
            if self.swiss.IsReady:
                # The current value of self.swiss is represented by self.swiss.Current.Value
                self.Plot("SwissArmyKnife", "swiss", self.swiss.Current.Value)
                
    

    The following reference table describes the SWISS method:

    SWISS() 1/1

                SwissArmyKnife QuantConnect.Algorithm.QCAlgorithm.SWISS (
        Symbol                           symbol,
        Int32                            period,
        Double                           delta,
        SwissArmyKnifeTool               tool,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates Swiss Army Knife transformation for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a SwissArmyKnife indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class SwissArmyKnifeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SwissArmyKnife _swiss;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _swiss = new SwissArmyKnife(20, 0.2, SwissArmyKnifeTool.Gauss);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _swiss.Update(bar.EndTime, bar.Close);
            }
    
            if (_swiss.IsReady)
            {
                // The current value of _swiss is represented by itself (_swiss)
                // or _swiss.Current.Value
                Plot("SwissArmyKnife", "swiss", _swiss);
                
            }
        }
    }
    class SwissArmyKnifeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.swiss = SwissArmyKnife(20, 0.2, SwissArmyKnifeTool.Gauss)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.swiss.Update(bar.EndTime, bar.Close)
    
            if self.swiss.IsReady:
                # The current value of self.swiss is represented by self.swiss.Current.Value
                self.Plot("SwissArmyKnife", "swiss", self.swiss.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class SwissArmyKnifeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private SwissArmyKnife _swiss;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _swiss = new SwissArmyKnife(20, 0.2, SwissArmyKnifeTool.Gauss);
            RegisterIndicator(_symbol, _swiss, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_swiss.IsReady)
            {
                // The current value of _swiss is represented by itself (_swiss)
                // or _swiss.Current.Value
                Plot("SwissArmyKnife", "swiss", _swiss);
                
            }
        }
    }
    class SwissArmyKnifeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.swiss = SwissArmyKnife(20, 0.2, SwissArmyKnifeTool.Gauss)
            self.RegisterIndicator(self.symbol, self.swiss, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.swiss.IsReady:
                # The current value of self.swiss is represented by self.swiss.Current.Value
                self.Plot("SwissArmyKnife", "swiss", self.swiss.Current.Value)
                
    

    The following reference table describes the SwissArmyKnife constructor:

    SwissArmyKnife() 1/2

                SwissArmyKnife QuantConnect.Indicators.SwissArmyKnife (
        int                 period,
        double              delta,
        SwissArmyKnifeTool  tool
       )
            

    Swiss Army Knife indicator by John Ehlers.

    SwissArmyKnife() 2/2

                SwissArmyKnife QuantConnect.Indicators.SwissArmyKnife (
        string              name,
        int                 period,
        double              delta,
        SwissArmyKnifeTool  tool
       )
            

    Swiss Army Knife indicator by John Ehlers.

    Visualization

    The following image shows plot values of selected properties of SwissArmyKnife using the plotly library.

    SwissArmyKnife line plot.

     

    13.1.82 T3 Moving Average

    Introduction

    This indicator computes the T3 Moving Average (T3). The T3 Moving Average is calculated with the following formula: EMA1(x, Period) = EMA(x, Period) EMA2(x, Period) = EMA(EMA1(x, Period),Period) GD(x, Period, volumeFactor) = (EMA1(x, Period)*(1+volumeFactor)) - (EMA2(x, Period)* volumeFactor) T3 = GD(GD(GD(t, Period, volumeFactor), Period, volumeFactor), Period, volumeFactor);

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using T3 Indicator

    To create an automatic indicators for T3MovingAverage , call the T3 helper method from the QCAlgorithm class. The T3 method creates a T3MovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class T3MovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private T3MovingAverage _t3;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _t3 = T3("SPY", 30, 0.7);
        }
    
        public override void OnData(Slice data)
        {
            if (_t3.IsReady)
            {
                // The current value of _t3 is represented by itself (_t3)
                // or _t3.Current.Value
                Plot("T3MovingAverage", "t3", _t3);
                
            }
        }
    }
    class T3MovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.t3 = self.T3("SPY", 30, 0.7)
    
        def OnData(self, slice: Slice) -> None:
            if self.t3.IsReady:
                # The current value of self.t3 is represented by self.t3.Current.Value
                self.Plot("T3MovingAverage", "t3", self.t3.Current.Value)
                
    

    The following reference table describes the T3 method:

    T3() 1/1

                T3MovingAverage QuantConnect.Algorithm.QCAlgorithm.T3 (
        Symbol                           symbol,
        Int32                            period,
        *Decimal                         volumeFactor,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new T3MovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a T3MovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class T3MovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private T3MovingAverage _t3;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _t3 = new T3MovingAverage(30, 0.7);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _t3.Update(bar.EndTime, bar.Close);
            }
    
            if (_t3.IsReady)
            {
                // The current value of _t3 is represented by itself (_t3)
                // or _t3.Current.Value
                Plot("T3MovingAverage", "t3", _t3);
                
            }
        }
    }
    class T3MovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.t3 = T3MovingAverage(30, 0.7)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.t3.Update(bar.EndTime, bar.Close)
    
            if self.t3.IsReady:
                # The current value of self.t3 is represented by self.t3.Current.Value
                self.Plot("T3MovingAverage", "t3", self.t3.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class T3MovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private T3MovingAverage _t3;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _t3 = new T3MovingAverage(30, 0.7);
            RegisterIndicator(_symbol, _t3, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_t3.IsReady)
            {
                // The current value of _t3 is represented by itself (_t3)
                // or _t3.Current.Value
                Plot("T3MovingAverage", "t3", _t3);
                
            }
        }
    }
    class T3MovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.t3 = T3MovingAverage(30, 0.7)
            self.RegisterIndicator(self.symbol, self.t3, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.t3.IsReady:
                # The current value of self.t3 is represented by self.t3.Current.Value
                self.Plot("T3MovingAverage", "t3", self.t3.Current.Value)
                
    

    The following reference table describes the T3MovingAverage constructor:

    T3MovingAverage() 1/2

                T3MovingAverage QuantConnect.Indicators.T3MovingAverage (
        string    name,
        int       period,
        *decimal  volumeFactor
       )
            

    Initializes a new instance of the T3MovingAverag class using the specified name and period.

    T3MovingAverage() 2/2

                T3MovingAverage QuantConnect.Indicators.T3MovingAverage (
        int       period,
        *decimal  volumeFactor
       )
            

    Initializes a new instance of the T3MovingAverag class using the specified period.

    Visualization

    The following image shows plot values of selected properties of T3MovingAverage using the plotly library.

    T3MovingAverage line plot.

     

    13.1.83 Target Downside Deviation

    Introduction

    This indicator computes the n-period target downside deviation. The target downside deviation is defined as the root-mean-square, or RMS, of the deviations of the realized return’s underperformance from the target return where all returns above the target return are treated as underperformance of 0. Reference: https://www.cmegroup.com/education/files/rr-sortino-a-sharper-ratio.pdf

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TDD Indicator

    To create an automatic indicators for TargetDownsideDeviation , call the TDD helper method from the QCAlgorithm class. The TDD method creates a TargetDownsideDeviation object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TargetDownsideDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TargetDownsideDeviation _tdd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tdd = TDD("SPY", 50);
        }
    
        public override void OnData(Slice data)
        {
            if (_tdd.IsReady)
            {
                // The current value of _tdd is represented by itself (_tdd)
                // or _tdd.Current.Value
                Plot("TargetDownsideDeviation", "tdd", _tdd);
                
            }
        }
    }
    class TargetDownsideDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tdd = self.TDD("SPY", 50)
    
        def OnData(self, slice: Slice) -> None:
            if self.tdd.IsReady:
                # The current value of self.tdd is represented by self.tdd.Current.Value
                self.Plot("TargetDownsideDeviation", "tdd", self.tdd.Current.Value)
                
    

    The following reference table describes the TDD method:

    TDD() 1/1

                TargetDownsideDeviation QuantConnect.Algorithm.QCAlgorithm.TDD (
        Symbol                           symbol,
        Int32                            period,
        *Double                          minimumAcceptableReturn,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TargetDownsideDeviation indicator. The target downside deviation is defined as the root-mean-square, or RMS, of the deviations of the realized return’s underperformance from the target return where all returns above the target return are treated as underperformance of 0.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TargetDownsideDeviation indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class TargetDownsideDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TargetDownsideDeviation _tdd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tdd = new TargetDownsideDeviation(50);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tdd.Update(bar.EndTime, bar.Close);
            }
    
            if (_tdd.IsReady)
            {
                // The current value of _tdd is represented by itself (_tdd)
                // or _tdd.Current.Value
                Plot("TargetDownsideDeviation", "tdd", _tdd);
                
            }
        }
    }
    class TargetDownsideDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tdd = TargetDownsideDeviation(50)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tdd.Update(bar.EndTime, bar.Close)
    
            if self.tdd.IsReady:
                # The current value of self.tdd is represented by self.tdd.Current.Value
                self.Plot("TargetDownsideDeviation", "tdd", self.tdd.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TargetDownsideDeviationAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TargetDownsideDeviation _tdd;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tdd = new TargetDownsideDeviation(50);
            RegisterIndicator(_symbol, _tdd, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tdd.IsReady)
            {
                // The current value of _tdd is represented by itself (_tdd)
                // or _tdd.Current.Value
                Plot("TargetDownsideDeviation", "tdd", _tdd);
                
            }
        }
    }
    class TargetDownsideDeviationAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tdd = TargetDownsideDeviation(50)
            self.RegisterIndicator(self.symbol, self.tdd, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tdd.IsReady:
                # The current value of self.tdd is represented by self.tdd.Current.Value
                self.Plot("TargetDownsideDeviation", "tdd", self.tdd.Current.Value)
                
    

    The following reference table describes the TargetDownsideDeviation constructor:

    TargetDownsideDeviation() 1/2

                TargetDownsideDeviation QuantConnect.Indicators.TargetDownsideDeviation (
        int      period,
        *double  minimumAcceptableReturn
       )
            

    return are treated as underperformance of 0.

    TargetDownsideDeviation() 2/2

                TargetDownsideDeviation QuantConnect.Indicators.TargetDownsideDeviation (
        string   name,
        int      period,
        *double  minimumAcceptableReturn
       )
            

    return are treated as underperformance of 0.

    Visualization

    The following image shows plot values of selected properties of TargetDownsideDeviation using the plotly library.

    TargetDownsideDeviation line plot.

     

    13.1.84 Time Profile

    Introduction

    This indicator represents an Indicator of the Market Profile with Time Price Opportunity (TPO) mode and its attributes

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TP Indicator

    To create an automatic indicators for TimeProfile , call the TP helper method from the QCAlgorithm class. The TP method creates a TimeProfile object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TimeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TimeProfile _tp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tp = TP("SPY", 3, 0.70, 0.05);
        }
    
        public override void OnData(Slice data)
        {
            if (_tp.IsReady)
            {
                // The current value of _tp is represented by itself (_tp)
                // or _tp.Current.Value
                Plot("TimeProfile", "tp", _tp);
                // Plot all properties of tp
                Plot("TimeProfile", "volumeperprice", _tp.VolumePerPrice);
                Plot("TimeProfile", "profilehigh", _tp.ProfileHigh);
                Plot("TimeProfile", "profilelow", _tp.ProfileLow);
                Plot("TimeProfile", "pocprice", _tp.POCPrice);
                Plot("TimeProfile", "pocvolume", _tp.POCVolume);
                Plot("TimeProfile", "valueareavolume", _tp.ValueAreaVolume);
                Plot("TimeProfile", "valueareahigh", _tp.ValueAreaHigh);
                Plot("TimeProfile", "valuearealow", _tp.ValueAreaLow);
            }
        }
    }
    class TimeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tp = self.TP("SPY", 3, 0.70, 0.05)
    
        def OnData(self, slice: Slice) -> None:
            if self.tp.IsReady:
                # The current value of self.tp is represented by self.tp.Current.Value
                self.Plot("TimeProfile", "tp", self.tp.Current.Value)
                # Plot all attributes of self.tp
                self.Plot("TimeProfile", "volumeperprice", self.tp.VolumePerPrice.Current.Value)
                self.Plot("TimeProfile", "profilehigh", self.tp.ProfileHigh.Current.Value)
                self.Plot("TimeProfile", "profilelow", self.tp.ProfileLow.Current.Value)
                self.Plot("TimeProfile", "pocprice", self.tp.POCPrice.Current.Value)
                self.Plot("TimeProfile", "pocvolume", self.tp.POCVolume.Current.Value)
                self.Plot("TimeProfile", "valueareavolume", self.tp.ValueAreaVolume.Current.Value)
                self.Plot("TimeProfile", "valueareahigh", self.tp.ValueAreaHigh.Current.Value)
                self.Plot("TimeProfile", "valuearealow", self.tp.ValueAreaLow.Current.Value)
    

    The following reference table describes the TP method:

    TP() 1/1

                TimeProfile QuantConnect.Algorithm.QCAlgorithm.TP (
        Symbol                            symbol,
        *Int32                            period,
        *Decimal                          valueAreaVolumePercentage,
        *Decimal                          priceRangeRoundOff,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an Market Profile indicator for the symbol with Time Price Opportunity (TPO) mode. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TimeProfile indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class TimeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TimeProfile _tp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tp = new TimeProfile(3, 0.70, 0.05);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tp.Update(bar);
            }
    
            if (_tp.IsReady)
            {
                // The current value of _tp is represented by itself (_tp)
                // or _tp.Current.Value
                Plot("TimeProfile", "tp", _tp);
                // Plot all properties of tp
                Plot("TimeProfile", "volumeperprice", _tp.VolumePerPrice);
                Plot("TimeProfile", "profilehigh", _tp.ProfileHigh);
                Plot("TimeProfile", "profilelow", _tp.ProfileLow);
                Plot("TimeProfile", "pocprice", _tp.POCPrice);
                Plot("TimeProfile", "pocvolume", _tp.POCVolume);
                Plot("TimeProfile", "valueareavolume", _tp.ValueAreaVolume);
                Plot("TimeProfile", "valueareahigh", _tp.ValueAreaHigh);
                Plot("TimeProfile", "valuearealow", _tp.ValueAreaLow);
            }
        }
    }
    class TimeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tp = TimeProfile(3, 0.70, 0.05)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tp.Update(bar)
    
            if self.tp.IsReady:
                # The current value of self.tp is represented by self.tp.Current.Value
                self.Plot("TimeProfile", "tp", self.tp.Current.Value)
                # Plot all attributes of self.tp
                self.Plot("TimeProfile", "volumeperprice", self.tp.VolumePerPrice.Current.Value)
                self.Plot("TimeProfile", "profilehigh", self.tp.ProfileHigh.Current.Value)
                self.Plot("TimeProfile", "profilelow", self.tp.ProfileLow.Current.Value)
                self.Plot("TimeProfile", "pocprice", self.tp.POCPrice.Current.Value)
                self.Plot("TimeProfile", "pocvolume", self.tp.POCVolume.Current.Value)
                self.Plot("TimeProfile", "valueareavolume", self.tp.ValueAreaVolume.Current.Value)
                self.Plot("TimeProfile", "valueareahigh", self.tp.ValueAreaHigh.Current.Value)
                self.Plot("TimeProfile", "valuearealow", self.tp.ValueAreaLow.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TimeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TimeProfile _tp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tp = new TimeProfile(3, 0.70, 0.05);
            RegisterIndicator(_symbol, _tp, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tp.IsReady)
            {
                // The current value of _tp is represented by itself (_tp)
                // or _tp.Current.Value
                Plot("TimeProfile", "tp", _tp);
                // Plot all properties of tp
                Plot("TimeProfile", "volumeperprice", _tp.VolumePerPrice);
                Plot("TimeProfile", "profilehigh", _tp.ProfileHigh);
                Plot("TimeProfile", "profilelow", _tp.ProfileLow);
                Plot("TimeProfile", "pocprice", _tp.POCPrice);
                Plot("TimeProfile", "pocvolume", _tp.POCVolume);
                Plot("TimeProfile", "valueareavolume", _tp.ValueAreaVolume);
                Plot("TimeProfile", "valueareahigh", _tp.ValueAreaHigh);
                Plot("TimeProfile", "valuearealow", _tp.ValueAreaLow);
            }
        }
    }
    class TimeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tp = TimeProfile(3, 0.70, 0.05)
            self.RegisterIndicator(self.symbol, self.tp, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tp.IsReady:
                # The current value of self.tp is represented by self.tp.Current.Value
                self.Plot("TimeProfile", "tp", self.tp.Current.Value)
                # Plot all attributes of self.tp
                self.Plot("TimeProfile", "volumeperprice", self.tp.VolumePerPrice.Current.Value)
                self.Plot("TimeProfile", "profilehigh", self.tp.ProfileHigh.Current.Value)
                self.Plot("TimeProfile", "profilelow", self.tp.ProfileLow.Current.Value)
                self.Plot("TimeProfile", "pocprice", self.tp.POCPrice.Current.Value)
                self.Plot("TimeProfile", "pocvolume", self.tp.POCVolume.Current.Value)
                self.Plot("TimeProfile", "valueareavolume", self.tp.ValueAreaVolume.Current.Value)
                self.Plot("TimeProfile", "valueareahigh", self.tp.ValueAreaHigh.Current.Value)
                self.Plot("TimeProfile", "valuearealow", self.tp.ValueAreaLow.Current.Value)
    

    The following reference table describes the TimeProfile constructor:

    TimeProfile() 1/2

                TimeProfile QuantConnect.Indicators.TimeProfile (
        *int  period
       )
            

    Creates a new TimeProfile indicator with the specified period.

    TimeProfile() 2/2

                TimeProfile QuantConnect.Indicators.TimeProfile (
        string    name,
        int       period,
        *decimal  valueAreaVolumePercentage
       )
            

    Creates a new TimeProfile indicator with the specified name, period and priceRangeRoundOff.

    Visualization

    The following image shows plot values of selected properties of TimeProfile using the plotly library.

    TimeProfile line plot.

     

    13.1.85 Triangular Moving Average

    Introduction

    This indicator computes the Triangular Moving Average (TRIMA). The Triangular Moving Average is calculated with the following formula: (1) When the period is even, TRIMA(x,period)=SMA(SMA(x,period/2),(period/2)+1) (2) When the period is odd, TRIMA(x,period)=SMA(SMA(x,(period+1)/2),(period+1)/2)

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TRIMA Indicator

    To create an automatic indicators for TriangularMovingAverage , call the TRIMA helper method from the QCAlgorithm class. The TRIMA method creates a TriangularMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TriangularMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TriangularMovingAverage _trima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trima = TRIMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_trima.IsReady)
            {
                // The current value of _trima is represented by itself (_trima)
                // or _trima.Current.Value
                Plot("TriangularMovingAverage", "trima", _trima);
                
            }
        }
    }
    class TriangularMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trima = self.TRIMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.trima.IsReady:
                # The current value of self.trima is represented by self.trima.Current.Value
                self.Plot("TriangularMovingAverage", "trima", self.trima.Current.Value)
                
    

    The following reference table describes the TRIMA method:

    TRIMA() 1/1

                TriangularMovingAverage QuantConnect.Algorithm.QCAlgorithm.TRIMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TriangularMovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TriangularMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class TriangularMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TriangularMovingAverage _trima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trima = new TriangularMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _trima.Update(bar.EndTime, bar.Close);
            }
    
            if (_trima.IsReady)
            {
                // The current value of _trima is represented by itself (_trima)
                // or _trima.Current.Value
                Plot("TriangularMovingAverage", "trima", _trima);
                
            }
        }
    }
    class TriangularMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trima = TriangularMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.trima.Update(bar.EndTime, bar.Close)
    
            if self.trima.IsReady:
                # The current value of self.trima is represented by self.trima.Current.Value
                self.Plot("TriangularMovingAverage", "trima", self.trima.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TriangularMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TriangularMovingAverage _trima;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trima = new TriangularMovingAverage(20);
            RegisterIndicator(_symbol, _trima, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_trima.IsReady)
            {
                // The current value of _trima is represented by itself (_trima)
                // or _trima.Current.Value
                Plot("TriangularMovingAverage", "trima", _trima);
                
            }
        }
    }
    class TriangularMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trima = TriangularMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.trima, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.trima.IsReady:
                # The current value of self.trima is represented by self.trima.Current.Value
                self.Plot("TriangularMovingAverage", "trima", self.trima.Current.Value)
                
    

    The following reference table describes the TriangularMovingAverage constructor:

    TriangularMovingAverage() 1/2

                TriangularMovingAverage QuantConnect.Indicators.TriangularMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the TriangularMovingAverag class using the specified name and period.

    TriangularMovingAverage() 2/2

                TriangularMovingAverage QuantConnect.Indicators.TriangularMovingAverage (
        int  period
       )
            

    Initializes a new instance of the TriangularMovingAverag class using the specified period.

    Visualization

    The following image shows plot values of selected properties of TriangularMovingAverage using the plotly library.

    TriangularMovingAverage line plot.

     

    13.1.86 Triple Exponential Moving Average

    Introduction

    This indicator computes the Triple Exponential Moving Average (TEMA). The Triple Exponential Moving Average is calculated with the following formula: EMA1 = EMA(t,period) EMA2 = EMA(EMA(t,period),period) EMA3 = EMA(EMA(EMA(t,period),period),period) TEMA = 3 * EMA1 - 3 * EMA2 + EMA3

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TEMA Indicator

    To create an automatic indicators for TripleExponentialMovingAverage , call the TEMA helper method from the QCAlgorithm class. The TEMA method creates a TripleExponentialMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TripleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TripleExponentialMovingAverage _tema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tema = TEMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_tema.IsReady)
            {
                // The current value of _tema is represented by itself (_tema)
                // or _tema.Current.Value
                Plot("TripleExponentialMovingAverage", "tema", _tema);
                
            }
        }
    }
    class TripleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tema = self.TEMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.tema.IsReady:
                # The current value of self.tema is represented by self.tema.Current.Value
                self.Plot("TripleExponentialMovingAverage", "tema", self.tema.Current.Value)
                
    

    The following reference table describes the TEMA method:

    TEMA() 1/1

                TripleExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.TEMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TripleExponentialMovingAverage indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TripleExponentialMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class TripleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TripleExponentialMovingAverage _tema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tema = new TripleExponentialMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tema.Update(bar.EndTime, bar.Close);
            }
    
            if (_tema.IsReady)
            {
                // The current value of _tema is represented by itself (_tema)
                // or _tema.Current.Value
                Plot("TripleExponentialMovingAverage", "tema", _tema);
                
            }
        }
    }
    class TripleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tema = TripleExponentialMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tema.Update(bar.EndTime, bar.Close)
    
            if self.tema.IsReady:
                # The current value of self.tema is represented by self.tema.Current.Value
                self.Plot("TripleExponentialMovingAverage", "tema", self.tema.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TripleExponentialMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TripleExponentialMovingAverage _tema;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tema = new TripleExponentialMovingAverage(20);
            RegisterIndicator(_symbol, _tema, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tema.IsReady)
            {
                // The current value of _tema is represented by itself (_tema)
                // or _tema.Current.Value
                Plot("TripleExponentialMovingAverage", "tema", _tema);
                
            }
        }
    }
    class TripleExponentialMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tema = TripleExponentialMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.tema, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tema.IsReady:
                # The current value of self.tema is represented by self.tema.Current.Value
                self.Plot("TripleExponentialMovingAverage", "tema", self.tema.Current.Value)
                
    

    The following reference table describes the TripleExponentialMovingAverage constructor:

    TripleExponentialMovingAverage() 1/2

                TripleExponentialMovingAverage QuantConnect.Indicators.TripleExponentialMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the TripleExponentialMovingAverag class using the specified name and period.

    TripleExponentialMovingAverage() 2/2

                TripleExponentialMovingAverage QuantConnect.Indicators.TripleExponentialMovingAverage (
        int  period
       )
            

    Initializes a new instance of the TripleExponentialMovingAverag class using the specified period.

    Visualization

    The following image shows plot values of selected properties of TripleExponentialMovingAverage using the plotly library.

    TripleExponentialMovingAverage line plot.

     

    13.1.87 Trix

    Introduction

    This indicator computes the TRIX (1-period ROC of a Triple EMA) The TRIX is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:trix

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TRIX Indicator

    To create an automatic indicators for Trix , call the TRIX helper method from the QCAlgorithm class. The TRIX method creates a Trix object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TrixAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Trix _trix;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trix = TRIX("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_trix.IsReady)
            {
                // The current value of _trix is represented by itself (_trix)
                // or _trix.Current.Value
                Plot("Trix", "trix", _trix);
                
            }
        }
    }
    class TrixAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trix = self.TRIX("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.trix.IsReady:
                # The current value of self.trix is represented by self.trix.Current.Value
                self.Plot("Trix", "trix", self.trix.Current.Value)
                
    

    The following reference table describes the TRIX method:

    TRIX() 1/1

                Trix QuantConnect.Algorithm.QCAlgorithm.TRIX (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Trix indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Trix indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class TrixAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Trix _trix;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trix = new Trix(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _trix.Update(bar.EndTime, bar.Close);
            }
    
            if (_trix.IsReady)
            {
                // The current value of _trix is represented by itself (_trix)
                // or _trix.Current.Value
                Plot("Trix", "trix", _trix);
                
            }
        }
    }
    class TrixAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trix = Trix(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.trix.Update(bar.EndTime, bar.Close)
    
            if self.trix.IsReady:
                # The current value of self.trix is represented by self.trix.Current.Value
                self.Plot("Trix", "trix", self.trix.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TrixAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Trix _trix;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _trix = new Trix(20);
            RegisterIndicator(_symbol, _trix, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_trix.IsReady)
            {
                // The current value of _trix is represented by itself (_trix)
                // or _trix.Current.Value
                Plot("Trix", "trix", _trix);
                
            }
        }
    }
    class TrixAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.trix = Trix(20)
            self.RegisterIndicator(self.symbol, self.trix, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.trix.IsReady:
                # The current value of self.trix is represented by self.trix.Current.Value
                self.Plot("Trix", "trix", self.trix.Current.Value)
                
    

    The following reference table describes the Trix constructor:

    Trix() 1/2

                Trix QuantConnect.Indicators.Trix (
        string  name,
        int     period
       )
            

    Initializes a new instance of the Tri class using the specified name and period.

    Trix() 2/2

                Trix QuantConnect.Indicators.Trix (
        int  period
       )
            

    Initializes a new instance of the Tri class using the specified period.

    Visualization

    The following image shows plot values of selected properties of Trix using the plotly library.

    Trix line plot.

     

    13.1.88 True Range

    Introduction

    This indicator computes the True Range (TR). The True Range is the greatest of the following values: value1 = distance from today's high to today's low. value2 = distance from yesterday's close to today's high. value3 = distance from yesterday's close to today's low.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TR Indicator

    To create an automatic indicators for TrueRange , call the TR helper method from the QCAlgorithm class. The TR method creates a TrueRange object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueRange _tr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tr = TR("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (_tr.IsReady)
            {
                // The current value of _tr is represented by itself (_tr)
                // or _tr.Current.Value
                Plot("TrueRange", "tr", _tr);
                
            }
        }
    }
    class TrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tr = self.TR("SPY")
    
        def OnData(self, slice: Slice) -> None:
            if self.tr.IsReady:
                # The current value of self.tr is represented by self.tr.Current.Value
                self.Plot("TrueRange", "tr", self.tr.Current.Value)
                
    

    The following reference table describes the TR method:

    TR() 1/1

                TrueRange QuantConnect.Algorithm.QCAlgorithm.TR (
        Symbol                                symbol,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new TrueRange indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a TrueRange indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class TrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueRange _tr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tr = new TrueRange("SPY");
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tr.Update(bar);
            }
    
            if (_tr.IsReady)
            {
                // The current value of _tr is represented by itself (_tr)
                // or _tr.Current.Value
                Plot("TrueRange", "tr", _tr);
                
            }
        }
    }
    class TrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tr = TrueRange("SPY")
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tr.Update(bar)
    
            if self.tr.IsReady:
                # The current value of self.tr is represented by self.tr.Current.Value
                self.Plot("TrueRange", "tr", self.tr.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TrueRangeAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueRange _tr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tr = new TrueRange("SPY");
            RegisterIndicator(_symbol, _tr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tr.IsReady)
            {
                // The current value of _tr is represented by itself (_tr)
                // or _tr.Current.Value
                Plot("TrueRange", "tr", _tr);
                
            }
        }
    }
    class TrueRangeAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tr = TrueRange("SPY")
            self.RegisterIndicator(self.symbol, self.tr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tr.IsReady:
                # The current value of self.tr is represented by self.tr.Current.Value
                self.Plot("TrueRange", "tr", self.tr.Current.Value)
                
    

    The following reference table describes the TrueRange constructor:

    TrueRange() 1/2

                TrueRange QuantConnect.Indicators.TrueRange (
        
       )
            

    Initializes a new instance of the TrueRang class using the specified name.

    TrueRange() 2/2

                TrueRange QuantConnect.Indicators.TrueRange (
        string  name
       )
            

    Initializes a new instance of the TrueRang class using the specified name.

    Visualization

    The following image shows plot values of selected properties of TrueRange using the plotly library.

    TrueRange line plot.

     

    13.1.89 True Strength Index

    Introduction

    This indicator computes the True Strength Index (TSI). The True Strength Index is calculated as explained here: https://school.stockcharts.com/doku.php?id=technical_indicators:True_strength_index Briefly, the calculation has three steps: 1. Smooth the momentum and the absolute momentum by getting an EMA of them (typically of period 25) 2. Double smooth the momentum and the absolute momentum by getting an EMA of their EMA (typically of period 13) 3. The TSI formula itself: divide the double-smoothed momentum over the double-smoothed absolute momentum and multiply by 100 The signal is typically a 7-to-12-EMA of the TSI.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using TSI Indicator

    To create an automatic indicators for TrueStrengthIndex , call the TSI helper method from the QCAlgorithm class. The TSI method creates a TrueStrengthIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class TrueStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueStrengthIndex _tsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tsi = TSI("SPY", 25, 13, 7, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (_tsi.IsReady)
            {
                // The current value of _tsi is represented by itself (_tsi)
                // or _tsi.Current.Value
                Plot("TrueStrengthIndex", "tsi", _tsi);
                // Plot all properties of tsi
                Plot("TrueStrengthIndex", "signal", _tsi.Signal);
            }
        }
    }
    class TrueStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tsi = self.TSI("SPY", 25, 13, 7, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            if self.tsi.IsReady:
                # The current value of self.tsi is represented by self.tsi.Current.Value
                self.Plot("TrueStrengthIndex", "tsi", self.tsi.Current.Value)
                # Plot all attributes of self.tsi
                self.Plot("TrueStrengthIndex", "signal", self.tsi.Signal.Current.Value)
    

    The following reference table describes the TSI method:

    TSI() 1/1

                TrueStrengthIndex QuantConnect.Algorithm.QCAlgorithm.TSI (
        Symbol                           symbol,
        *Int32                           longTermPeriod,
        *Int32                           shortTermPeriod,
        *Int32                           signalPeriod,
        *MovingAverageType               signalType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a TrueStrengthIndex indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    The following table describes the MovingAverageType enumeration members:

    You can manually create a TrueStrengthIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class TrueStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueStrengthIndex _tsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tsi = new TrueStrengthIndex(25, 13, 7, MovingAverageType.Exponential);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _tsi.Update(bar.EndTime, bar.Close);
            }
    
            if (_tsi.IsReady)
            {
                // The current value of _tsi is represented by itself (_tsi)
                // or _tsi.Current.Value
                Plot("TrueStrengthIndex", "tsi", _tsi);
                // Plot all properties of tsi
                Plot("TrueStrengthIndex", "signal", _tsi.Signal);
            }
        }
    }
    class TrueStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tsi = TrueStrengthIndex(25, 13, 7, MovingAverageType.Exponential)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.tsi.Update(bar.EndTime, bar.Close)
    
            if self.tsi.IsReady:
                # The current value of self.tsi is represented by self.tsi.Current.Value
                self.Plot("TrueStrengthIndex", "tsi", self.tsi.Current.Value)
                # Plot all attributes of self.tsi
                self.Plot("TrueStrengthIndex", "signal", self.tsi.Signal.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class TrueStrengthIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private TrueStrengthIndex _tsi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _tsi = new TrueStrengthIndex(25, 13, 7, MovingAverageType.Exponential);
            RegisterIndicator(_symbol, _tsi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_tsi.IsReady)
            {
                // The current value of _tsi is represented by itself (_tsi)
                // or _tsi.Current.Value
                Plot("TrueStrengthIndex", "tsi", _tsi);
                // Plot all properties of tsi
                Plot("TrueStrengthIndex", "signal", _tsi.Signal);
            }
        }
    }
    class TrueStrengthIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.tsi = TrueStrengthIndex(25, 13, 7, MovingAverageType.Exponential)
            self.RegisterIndicator(self.symbol, self.tsi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.tsi.IsReady:
                # The current value of self.tsi is represented by self.tsi.Current.Value
                self.Plot("TrueStrengthIndex", "tsi", self.tsi.Current.Value)
                # Plot all attributes of self.tsi
                self.Plot("TrueStrengthIndex", "signal", self.tsi.Signal.Current.Value)
    

    The following reference table describes the TrueStrengthIndex constructor:

    TrueStrengthIndex() 1/2

                TrueStrengthIndex QuantConnect.Indicators.TrueStrengthIndex (
        *int                shortTermPeriod,
        *int                longTermPeriod,
        *int                signalPeriod,
        *MovingAverageType  signalType
       )
            

    Initializes a new instance of the TrueStrengthInde class using the specified short and long term smoothing periods, and the signal period and type.

    TrueStrengthIndex() 2/2

                TrueStrengthIndex QuantConnect.Indicators.TrueStrengthIndex (
        string              name,
        *int                shortTermPeriod,
        *int                longTermPeriod,
        *int                signalPeriod,
        *MovingAverageType  signalType
       )
            

    Initializes a new instance of the TrueStrengthInde class using the specified name, the short and long term smoothing periods, and the signal period and type.

    Visualization

    The following image shows plot values of selected properties of TrueStrengthIndex using the plotly library.

    TrueStrengthIndex line plot.

     

    13.1.90 Ultimate Oscillator

    Introduction

    This indicator computes the Ultimate Oscillator (ULTOSC) The Ultimate Oscillator is calculated as explained here: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ultimate_oscillator

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ULTOSC Indicator

    To create an automatic indicators for UltimateOscillator , call the ULTOSC helper method from the QCAlgorithm class. The ULTOSC method creates a UltimateOscillator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class UltimateOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UltimateOscillator _ultosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ultosc = ULTOSC("SPY", 5, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_ultosc.IsReady)
            {
                // The current value of _ultosc is represented by itself (_ultosc)
                // or _ultosc.Current.Value
                Plot("UltimateOscillator", "ultosc", _ultosc);
                
            }
        }
    }
    class UltimateOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ultosc = self.ULTOSC("SPY", 5, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.ultosc.IsReady:
                # The current value of self.ultosc is represented by self.ultosc.Current.Value
                self.Plot("UltimateOscillator", "ultosc", self.ultosc.Current.Value)
                
    

    The following reference table describes the ULTOSC method:

    ULTOSC() 1/1

                UltimateOscillator QuantConnect.Algorithm.QCAlgorithm.ULTOSC (
        Symbol                                symbol,
        Int32                                 period1,
        Int32                                 period2,
        Int32                                 period3,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new UltimateOscillator indicator.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a UltimateOscillator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class UltimateOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UltimateOscillator _ultosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ultosc = new UltimateOscillator(5, 10, 20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _ultosc.Update(bar);
            }
    
            if (_ultosc.IsReady)
            {
                // The current value of _ultosc is represented by itself (_ultosc)
                // or _ultosc.Current.Value
                Plot("UltimateOscillator", "ultosc", _ultosc);
                
            }
        }
    }
    class UltimateOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ultosc = UltimateOscillator(5, 10, 20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.ultosc.Update(bar)
    
            if self.ultosc.IsReady:
                # The current value of self.ultosc is represented by self.ultosc.Current.Value
                self.Plot("UltimateOscillator", "ultosc", self.ultosc.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class UltimateOscillatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private UltimateOscillator _ultosc;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _ultosc = new UltimateOscillator(5, 10, 20);
            RegisterIndicator(_symbol, _ultosc, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_ultosc.IsReady)
            {
                // The current value of _ultosc is represented by itself (_ultosc)
                // or _ultosc.Current.Value
                Plot("UltimateOscillator", "ultosc", _ultosc);
                
            }
        }
    }
    class UltimateOscillatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.ultosc = UltimateOscillator(5, 10, 20)
            self.RegisterIndicator(self.symbol, self.ultosc, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.ultosc.IsReady:
                # The current value of self.ultosc is represented by self.ultosc.Current.Value
                self.Plot("UltimateOscillator", "ultosc", self.ultosc.Current.Value)
                
    

    The following reference table describes the UltimateOscillator constructor:

    UltimateOscillator() 1/2

                UltimateOscillator QuantConnect.Indicators.UltimateOscillator (
        int  period1,
        int  period2,
        int  period3
       )
            

    Initializes a new instance of the UltimateOscillato class using the specified parameters.

    UltimateOscillator() 2/2

                UltimateOscillator QuantConnect.Indicators.UltimateOscillator (
        string  name,
        int     period1,
        int     period2,
        int     period3
       )
            

    Initializes a new instance of the UltimateOscillato class using the specified parameters.

    Visualization

    The following image shows plot values of selected properties of UltimateOscillator using the plotly library.

    UltimateOscillator line plot.

     

    13.1.91 Variance

    Introduction

    This indicator computes the n-period population variance.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using VAR Indicator

    To create an automatic indicators for Variance , call the VAR helper method from the QCAlgorithm class. The VAR method creates a Variance object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class VarianceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Variance _var;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _var = VAR("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_var.IsReady)
            {
                // The current value of _var is represented by itself (_var)
                // or _var.Current.Value
                Plot("Variance", "var", _var);
                
            }
        }
    }
    class VarianceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.var = self.VAR("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.var.IsReady:
                # The current value of self.var is represented by self.var.Current.Value
                self.Plot("Variance", "var", self.var.Current.Value)
                
    

    The following reference table describes the VAR method:

    VAR() 1/1

                Variance QuantConnect.Algorithm.QCAlgorithm.VAR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Variance indicator. This will return the population variance of samples over the specified period.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a Variance indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class VarianceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Variance _var;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _var = new Variance(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _var.Update(bar.EndTime, bar.Close);
            }
    
            if (_var.IsReady)
            {
                // The current value of _var is represented by itself (_var)
                // or _var.Current.Value
                Plot("Variance", "var", _var);
                
            }
        }
    }
    class VarianceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.var = Variance(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.var.Update(bar.EndTime, bar.Close)
    
            if self.var.IsReady:
                # The current value of self.var is represented by self.var.Current.Value
                self.Plot("Variance", "var", self.var.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class VarianceAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private Variance _var;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _var = new Variance(20);
            RegisterIndicator(_symbol, _var, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_var.IsReady)
            {
                // The current value of _var is represented by itself (_var)
                // or _var.Current.Value
                Plot("Variance", "var", _var);
                
            }
        }
    }
    class VarianceAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.var = Variance(20)
            self.RegisterIndicator(self.symbol, self.var, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.var.IsReady:
                # The current value of self.var is represented by self.var.Current.Value
                self.Plot("Variance", "var", self.var.Current.Value)
                
    

    The following reference table describes the Variance constructor:

    Variance() 1/2

                Variance QuantConnect.Indicators.Variance (
        int  period
       )
            

    Initializes a new instance of the Varianc class using the specified period.

    Variance() 2/2

                Variance QuantConnect.Indicators.Variance (
        string  name,
        int     period
       )
            

    Initializes a new instance of the Varianc class using the specified name and period.

    Visualization

    The following image shows plot values of selected properties of Variance using the plotly library.

    Variance line plot.

     

    13.1.92 Volume Profile

    Introduction

    This indicator represents an Indicator of the Market Profile with Volume Profile mode and its attributes

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using VP Indicator

    To create an automatic indicators for VolumeProfile , call the VP helper method from the QCAlgorithm class. The VP method creates a VolumeProfile object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class VolumeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeProfile _vp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vp = VP("SPY", 3, 0.70, 0.05);
        }
    
        public override void OnData(Slice data)
        {
            if (_vp.IsReady)
            {
                // The current value of _vp is represented by itself (_vp)
                // or _vp.Current.Value
                Plot("VolumeProfile", "vp", _vp);
                // Plot all properties of vp
                Plot("VolumeProfile", "volumeperprice", _vp.VolumePerPrice);
                Plot("VolumeProfile", "profilehigh", _vp.ProfileHigh);
                Plot("VolumeProfile", "profilelow", _vp.ProfileLow);
                Plot("VolumeProfile", "pocprice", _vp.POCPrice);
                Plot("VolumeProfile", "pocvolume", _vp.POCVolume);
                Plot("VolumeProfile", "valueareavolume", _vp.ValueAreaVolume);
                Plot("VolumeProfile", "valueareahigh", _vp.ValueAreaHigh);
                Plot("VolumeProfile", "valuearealow", _vp.ValueAreaLow);
            }
        }
    }
    class VolumeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vp = self.VP("SPY", 3, 0.70, 0.05)
    
        def OnData(self, slice: Slice) -> None:
            if self.vp.IsReady:
                # The current value of self.vp is represented by self.vp.Current.Value
                self.Plot("VolumeProfile", "vp", self.vp.Current.Value)
                # Plot all attributes of self.vp
                self.Plot("VolumeProfile", "volumeperprice", self.vp.VolumePerPrice.Current.Value)
                self.Plot("VolumeProfile", "profilehigh", self.vp.ProfileHigh.Current.Value)
                self.Plot("VolumeProfile", "profilelow", self.vp.ProfileLow.Current.Value)
                self.Plot("VolumeProfile", "pocprice", self.vp.POCPrice.Current.Value)
                self.Plot("VolumeProfile", "pocvolume", self.vp.POCVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareavolume", self.vp.ValueAreaVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareahigh", self.vp.ValueAreaHigh.Current.Value)
                self.Plot("VolumeProfile", "valuearealow", self.vp.ValueAreaLow.Current.Value)
    

    The following reference table describes the VP method:

    VP() 1/1

                VolumeProfile QuantConnect.Algorithm.QCAlgorithm.VP (
        Symbol                            symbol,
        *Int32                            period,
        *Decimal                          valueAreaVolumePercentage,
        *Decimal                          priceRangeRoundOff,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an Market Profile indicator for the symbol with Volume Profile (VOL) mode. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a VolumeProfile indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class VolumeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeProfile _vp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vp = new VolumeProfile(3, 0.70, 0.05);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _vp.Update(bar);
            }
    
            if (_vp.IsReady)
            {
                // The current value of _vp is represented by itself (_vp)
                // or _vp.Current.Value
                Plot("VolumeProfile", "vp", _vp);
                // Plot all properties of vp
                Plot("VolumeProfile", "volumeperprice", _vp.VolumePerPrice);
                Plot("VolumeProfile", "profilehigh", _vp.ProfileHigh);
                Plot("VolumeProfile", "profilelow", _vp.ProfileLow);
                Plot("VolumeProfile", "pocprice", _vp.POCPrice);
                Plot("VolumeProfile", "pocvolume", _vp.POCVolume);
                Plot("VolumeProfile", "valueareavolume", _vp.ValueAreaVolume);
                Plot("VolumeProfile", "valueareahigh", _vp.ValueAreaHigh);
                Plot("VolumeProfile", "valuearealow", _vp.ValueAreaLow);
            }
        }
    }
    class VolumeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vp = VolumeProfile(3, 0.70, 0.05)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.vp.Update(bar)
    
            if self.vp.IsReady:
                # The current value of self.vp is represented by self.vp.Current.Value
                self.Plot("VolumeProfile", "vp", self.vp.Current.Value)
                # Plot all attributes of self.vp
                self.Plot("VolumeProfile", "volumeperprice", self.vp.VolumePerPrice.Current.Value)
                self.Plot("VolumeProfile", "profilehigh", self.vp.ProfileHigh.Current.Value)
                self.Plot("VolumeProfile", "profilelow", self.vp.ProfileLow.Current.Value)
                self.Plot("VolumeProfile", "pocprice", self.vp.POCPrice.Current.Value)
                self.Plot("VolumeProfile", "pocvolume", self.vp.POCVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareavolume", self.vp.ValueAreaVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareahigh", self.vp.ValueAreaHigh.Current.Value)
                self.Plot("VolumeProfile", "valuearealow", self.vp.ValueAreaLow.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class VolumeProfileAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeProfile _vp;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vp = new VolumeProfile(3, 0.70, 0.05);
            RegisterIndicator(_symbol, _vp, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_vp.IsReady)
            {
                // The current value of _vp is represented by itself (_vp)
                // or _vp.Current.Value
                Plot("VolumeProfile", "vp", _vp);
                // Plot all properties of vp
                Plot("VolumeProfile", "volumeperprice", _vp.VolumePerPrice);
                Plot("VolumeProfile", "profilehigh", _vp.ProfileHigh);
                Plot("VolumeProfile", "profilelow", _vp.ProfileLow);
                Plot("VolumeProfile", "pocprice", _vp.POCPrice);
                Plot("VolumeProfile", "pocvolume", _vp.POCVolume);
                Plot("VolumeProfile", "valueareavolume", _vp.ValueAreaVolume);
                Plot("VolumeProfile", "valueareahigh", _vp.ValueAreaHigh);
                Plot("VolumeProfile", "valuearealow", _vp.ValueAreaLow);
            }
        }
    }
    class VolumeProfileAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vp = VolumeProfile(3, 0.70, 0.05)
            self.RegisterIndicator(self.symbol, self.vp, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.vp.IsReady:
                # The current value of self.vp is represented by self.vp.Current.Value
                self.Plot("VolumeProfile", "vp", self.vp.Current.Value)
                # Plot all attributes of self.vp
                self.Plot("VolumeProfile", "volumeperprice", self.vp.VolumePerPrice.Current.Value)
                self.Plot("VolumeProfile", "profilehigh", self.vp.ProfileHigh.Current.Value)
                self.Plot("VolumeProfile", "profilelow", self.vp.ProfileLow.Current.Value)
                self.Plot("VolumeProfile", "pocprice", self.vp.POCPrice.Current.Value)
                self.Plot("VolumeProfile", "pocvolume", self.vp.POCVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareavolume", self.vp.ValueAreaVolume.Current.Value)
                self.Plot("VolumeProfile", "valueareahigh", self.vp.ValueAreaHigh.Current.Value)
                self.Plot("VolumeProfile", "valuearealow", self.vp.ValueAreaLow.Current.Value)
    

    The following reference table describes the VolumeProfile constructor:

    VolumeProfile() 1/2

                VolumeProfile QuantConnect.Indicators.VolumeProfile (
        *int  period
       )
            

    Creates a new VolumeProfile indicator with the specified period.

    VolumeProfile() 2/2

                VolumeProfile QuantConnect.Indicators.VolumeProfile (
        string    name,
        int       period,
        *decimal  valueAreaVolumePercentage
       )
            

    Creates a new VolumeProfile indicator with the specified name, period and priceRangeRoundOff.

    Visualization

    The following image shows plot values of selected properties of VolumeProfile using the plotly library.

    VolumeProfile line plot.

     

    13.1.93 Volume Weighted Average Price Indicator

    Introduction

    Volume Weighted Average Price (VWAP) Indicator: It is calculated by adding up the dollars traded for every transaction (price multiplied by number of shares traded) and then dividing by the total shares traded for the day.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using VWAP Indicator

    To create an automatic indicators for VolumeWeightedAveragePriceIndicator , call the VWAP helper method from the QCAlgorithm class. The VWAP method creates a VolumeWeightedAveragePriceIndicator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class VolumeWeightedAveragePriceIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeWeightedAveragePriceIndicator _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = VWAP("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("VolumeWeightedAveragePriceIndicator", "vwap", _vwap);
                
            }
        }
    }
    class VolumeWeightedAveragePriceIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = self.VWAP("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("VolumeWeightedAveragePriceIndicator", "vwap", self.vwap.Current.Value)
                
    

    The following reference table describes the VWAP method:

    VWAP() 1/2

                VolumeWeightedAveragePriceIndicator QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an VolumeWeightedAveragePrice (VWAP) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    VWAP() 2/2

                IntradayVwap QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol  symbol
       )
            

    Creates the canonical VWAP indicator that resets each day. The indicator will be automatically updated on the security's configured resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a VolumeWeightedAveragePriceIndicator indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class VolumeWeightedAveragePriceIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeWeightedAveragePriceIndicator _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = new VolumeWeightedAveragePriceIndicator(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _vwap.Update(bar);
            }
    
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("VolumeWeightedAveragePriceIndicator", "vwap", _vwap);
                
            }
        }
    }
    class VolumeWeightedAveragePriceIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = VolumeWeightedAveragePriceIndicator(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.vwap.Update(bar)
    
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("VolumeWeightedAveragePriceIndicator", "vwap", self.vwap.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class VolumeWeightedAveragePriceIndicatorAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private VolumeWeightedAveragePriceIndicator _vwap;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _vwap = new VolumeWeightedAveragePriceIndicator(20);
            RegisterIndicator(_symbol, _vwap, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_vwap.IsReady)
            {
                // The current value of _vwap is represented by itself (_vwap)
                // or _vwap.Current.Value
                Plot("VolumeWeightedAveragePriceIndicator", "vwap", _vwap);
                
            }
        }
    }
    class VolumeWeightedAveragePriceIndicatorAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.vwap = VolumeWeightedAveragePriceIndicator(20)
            self.RegisterIndicator(self.symbol, self.vwap, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.vwap.IsReady:
                # The current value of self.vwap is represented by self.vwap.Current.Value
                self.Plot("VolumeWeightedAveragePriceIndicator", "vwap", self.vwap.Current.Value)
                
    

    The following reference table describes the VolumeWeightedAveragePriceIndicator constructor:

    VolumeWeightedAveragePriceIndicator() 1/2

                VolumeWeightedAveragePriceIndicator QuantConnect.Indicators.VolumeWeightedAveragePriceIndicator (
        int  period
       )
            

    Initializes a new instance of the VWAP class with the default name and period.

    VolumeWeightedAveragePriceIndicator() 2/2

                VolumeWeightedAveragePriceIndicator QuantConnect.Indicators.VolumeWeightedAveragePriceIndicator (
        string  name,
        int     period
       )
            

    Initializes a new instance of the VWAP class with a given name and period.

    Visualization

    The following image shows plot values of selected properties of VolumeWeightedAveragePriceIndicator using the plotly library.

    VolumeWeightedAveragePriceIndicator line plot.

     

    13.1.94 Wilder Accumulative Swing Index

    Introduction

    This indicator calculates the Accumulative Swing Index (ASI) as defined by Welles Wilder in his book 'New Concepts in Technical Trading Systems'. ASIₜ = ASIₜ₋₁ + SIₜ Where: ASIₜ₋₁ The for the previous period. SIₜ The calculated for the current period.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using ASI Indicator

    To create an automatic indicators for WilderAccumulativeSwingIndex , call the ASI helper method from the QCAlgorithm class. The ASI method creates a WilderAccumulativeSwingIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class WilderAccumulativeSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderAccumulativeSwingIndex _asi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _asi = ASI("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_asi.IsReady)
            {
                // The current value of _asi is represented by itself (_asi)
                // or _asi.Current.Value
                Plot("WilderAccumulativeSwingIndex", "asi", _asi);
                
            }
        }
    }
    class WilderAccumulativeSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.asi = self.ASI("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.asi.IsReady:
                # The current value of self.asi is represented by self.asi.Current.Value
                self.Plot("WilderAccumulativeSwingIndex", "asi", self.asi.Current.Value)
                
    

    The following reference table describes the ASI method:

    ASI() 1/1

                WilderAccumulativeSwingIndex QuantConnect.Algorithm.QCAlgorithm.ASI (
        Symbol                            symbol,
        Decimal                           limitMove,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Wilder Accumulative Swing Index (ASI) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a WilderAccumulativeSwingIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class WilderAccumulativeSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderAccumulativeSwingIndex _asi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _asi = new WilderAccumulativeSwingIndex(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _asi.Update(bar);
            }
    
            if (_asi.IsReady)
            {
                // The current value of _asi is represented by itself (_asi)
                // or _asi.Current.Value
                Plot("WilderAccumulativeSwingIndex", "asi", _asi);
                
            }
        }
    }
    class WilderAccumulativeSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.asi = WilderAccumulativeSwingIndex(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.asi.Update(bar)
    
            if self.asi.IsReady:
                # The current value of self.asi is represented by self.asi.Current.Value
                self.Plot("WilderAccumulativeSwingIndex", "asi", self.asi.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class WilderAccumulativeSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderAccumulativeSwingIndex _asi;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _asi = new WilderAccumulativeSwingIndex(20);
            RegisterIndicator(_symbol, _asi, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_asi.IsReady)
            {
                // The current value of _asi is represented by itself (_asi)
                // or _asi.Current.Value
                Plot("WilderAccumulativeSwingIndex", "asi", _asi);
                
            }
        }
    }
    class WilderAccumulativeSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.asi = WilderAccumulativeSwingIndex(20)
            self.RegisterIndicator(self.symbol, self.asi, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.asi.IsReady:
                # The current value of self.asi is represented by self.asi.Current.Value
                self.Plot("WilderAccumulativeSwingIndex", "asi", self.asi.Current.Value)
                
    

    The following reference table describes the WilderAccumulativeSwingIndex constructor:

    WilderAccumulativeSwingIndex() 1/2

                WilderAccumulativeSwingIndex QuantConnect.Indicators.WilderAccumulativeSwingIndex (
        decimal  limitMove
       )
            

    Initializes a new instance of the WilderAccumulativeSwingInde class using the specified name.

    WilderAccumulativeSwingIndex() 2/2

                WilderAccumulativeSwingIndex QuantConnect.Indicators.WilderAccumulativeSwingIndex (
        string   name,
        decimal  limitMove
       )
            

    Initializes a new instance of the WilderAccumulativeSwingInde class using the specified name.

    Visualization

    The following image shows plot values of selected properties of WilderAccumulativeSwingIndex using the plotly library.

    WilderAccumulativeSwingIndex line plot.

     

    13.1.95 Wilder Moving Average

    Introduction

    This indicator represents the moving average indicator defined by Welles Wilder in his book: New Concepts in Technical Trading Systems.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using WWMA Indicator

    To create an automatic indicators for WilderMovingAverage , call the WWMA helper method from the QCAlgorithm class. The WWMA method creates a WilderMovingAverage object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class WilderMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderMovingAverage _wwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wwma = WWMA("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_wwma.IsReady)
            {
                // The current value of _wwma is represented by itself (_wwma)
                // or _wwma.Current.Value
                Plot("WilderMovingAverage", "wwma", _wwma);
                
            }
        }
    }
    class WilderMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wwma = self.WWMA("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.wwma.IsReady:
                # The current value of self.wwma is represented by self.wwma.Current.Value
                self.Plot("WilderMovingAverage", "wwma", self.wwma.Current.Value)
                
    

    The following reference table describes the WWMA method:

    WWMA() 1/1

                WilderMovingAverage QuantConnect.Algorithm.QCAlgorithm.WWMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a WilderMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a WilderMovingAverage indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with time/number pair, or an IndicatorDataPoint . The indicator will only be ready after you prime it with enough data.

    public class WilderMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderMovingAverage _wwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wwma = new WilderMovingAverage(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _wwma.Update(bar.EndTime, bar.Close);
            }
    
            if (_wwma.IsReady)
            {
                // The current value of _wwma is represented by itself (_wwma)
                // or _wwma.Current.Value
                Plot("WilderMovingAverage", "wwma", _wwma);
                
            }
        }
    }
    class WilderMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wwma = WilderMovingAverage(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.wwma.Update(bar.EndTime, bar.Close)
    
            if self.wwma.IsReady:
                # The current value of self.wwma is represented by self.wwma.Current.Value
                self.Plot("WilderMovingAverage", "wwma", self.wwma.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class WilderMovingAverageAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderMovingAverage _wwma;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wwma = new WilderMovingAverage(20);
            RegisterIndicator(_symbol, _wwma, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_wwma.IsReady)
            {
                // The current value of _wwma is represented by itself (_wwma)
                // or _wwma.Current.Value
                Plot("WilderMovingAverage", "wwma", _wwma);
                
            }
        }
    }
    class WilderMovingAverageAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wwma = WilderMovingAverage(20)
            self.RegisterIndicator(self.symbol, self.wwma, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.wwma.IsReady:
                # The current value of self.wwma is represented by self.wwma.Current.Value
                self.Plot("WilderMovingAverage", "wwma", self.wwma.Current.Value)
                
    

    The following reference table describes the WilderMovingAverage constructor:

    WilderMovingAverage() 1/2

                WilderMovingAverage QuantConnect.Indicators.WilderMovingAverage (
        string  name,
        int     period
       )
            

    Initializes a new instance of the WilderMovingAverage class with the specified name and period.

    WilderMovingAverage() 2/2

                WilderMovingAverage QuantConnect.Indicators.WilderMovingAverage (
        int  period
       )
            

    Initializes a new instance of the WilderMovingAverage class with the default name and period.

    Visualization

    The following image shows plot values of selected properties of WilderMovingAverage using the plotly library.

    WilderMovingAverage line plot.

     

    13.1.96 Wilder Swing Index

    Introduction

    This indicator calculates the Swing Index (SI) as defined by Welles Wilder in his book 'New Concepts in Technical Trading Systems'. SIₜ = 50 * ( N / R ) * ( K / T ) Where: N Equals: Cₜ - Cₜ₋₁ + 0.5 * (Cₜ - Oₜ) + 0.25 * (Cₜ₋₁ - Oₜ₋₁) See R Found by selecting the expression with the largest value and then using the corresponding formula. Expression => Formula |Hₜ - Cₜ₋₁| => |Hₜ - Cₜ| - 0.5 * |Lₜ - Cₜ₋₁| + 0.25 * |Cₜ₋₁ - Oₜ₋₁| |Lₜ - Cₜ₋₁| => |Lₜ - Cₜ| - 0.5 * |Hₜ - Cₜ₋₁| + 0.25 * |Cₜ₋₁ - Oₜ₋₁| |Hₜ - Lₜ| => |Hₜ - Lₜ₋₁| + 0.25 * |Cₜ₋₁ - Oₜ₋₁| See K Found by selecting the larger of the two expressions: |Hₜ - Cₜ₋₁|, |Lₜ - Cₜ₋₁| See T The limit move, or the maximum change in price during the time period for the bar. Passed as limitMove via the constructor. See

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using SI Indicator

    To create an automatic indicators for WilderSwingIndex , call the SI helper method from the QCAlgorithm class. The SI method creates a WilderSwingIndex object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class WilderSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderSwingIndex _si;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _si = SI("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_si.IsReady)
            {
                // The current value of _si is represented by itself (_si)
                // or _si.Current.Value
                Plot("WilderSwingIndex", "si", _si);
                
            }
        }
    }
    class WilderSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.si = self.SI("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.si.IsReady:
                # The current value of self.si is represented by self.si.Current.Value
                self.Plot("WilderSwingIndex", "si", self.si.Current.Value)
                
    

    The following reference table describes the SI method:

    SI() 1/1

                WilderSwingIndex QuantConnect.Algorithm.QCAlgorithm.SI (
        Symbol                            symbol,
        Decimal                           limitMove,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Wilder Swing Index (SI) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a WilderSwingIndex indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar . The indicator will only be ready after you prime it with enough data.

    public class WilderSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderSwingIndex _si;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _si = new WilderSwingIndex(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _si.Update(bar);
            }
    
            if (_si.IsReady)
            {
                // The current value of _si is represented by itself (_si)
                // or _si.Current.Value
                Plot("WilderSwingIndex", "si", _si);
                
            }
        }
    }
    class WilderSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.si = WilderSwingIndex(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.si.Update(bar)
    
            if self.si.IsReady:
                # The current value of self.si is represented by self.si.Current.Value
                self.Plot("WilderSwingIndex", "si", self.si.Current.Value)
                
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class WilderSwingIndexAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilderSwingIndex _si;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _si = new WilderSwingIndex(20);
            RegisterIndicator(_symbol, _si, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_si.IsReady)
            {
                // The current value of _si is represented by itself (_si)
                // or _si.Current.Value
                Plot("WilderSwingIndex", "si", _si);
                
            }
        }
    }
    class WilderSwingIndexAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.si = WilderSwingIndex(20)
            self.RegisterIndicator(self.symbol, self.si, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.si.IsReady:
                # The current value of self.si is represented by self.si.Current.Value
                self.Plot("WilderSwingIndex", "si", self.si.Current.Value)
                
    

    The following reference table describes the WilderSwingIndex constructor:

    WilderSwingIndex() 1/2

                WilderSwingIndex QuantConnect.Indicators.WilderSwingIndex (
        string   name,
        decimal  limitMove
       )
            

    Initializes a new instance of the WilderSwingInde class using the specified name.

    WilderSwingIndex() 2/2

                WilderSwingIndex QuantConnect.Indicators.WilderSwingIndex (
        decimal  limitMove
       )
            

    Initializes a new instance of the WilderSwingInde class using the default name.

    Visualization

    The following image shows plot values of selected properties of WilderSwingIndex using the plotly library.

    WilderSwingIndex line plot.

     

    13.1.97 Williams Percent R

    Introduction

    Williams %R, or just %R, is the current closing price in relation to the high and low of the past N days (for a given N). The value of this indicator fluctuates between -100 and 0. The symbol is said to be oversold when the oscillator is below -80%, and overbought when the oscillator is above -20%.

    To view the implementation of this indicator, see the LEAN GitHub repository .

    Using WILR Indicator

    To create an automatic indicators for WilliamsPercentR , call the WILR helper method from the QCAlgorithm class. The WILR method creates a WilliamsPercentR object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initialize method.

    public class WilliamsPercentRAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilliamsPercentR _wilr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wilr = WILR("SPY", 20);
        }
    
        public override void OnData(Slice data)
        {
            if (_wilr.IsReady)
            {
                // The current value of _wilr is represented by itself (_wilr)
                // or _wilr.Current.Value
                Plot("WilliamsPercentR", "wilr", _wilr);
                // Plot all properties of wilr
                Plot("WilliamsPercentR", "maximum", _wilr.Maximum);
                Plot("WilliamsPercentR", "minimum", _wilr.Minimum);
            }
        }
    }
    class WilliamsPercentRAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wilr = self.WILR("SPY", 20)
    
        def OnData(self, slice: Slice) -> None:
            if self.wilr.IsReady:
                # The current value of self.wilr is represented by self.wilr.Current.Value
                self.Plot("WilliamsPercentR", "wilr", self.wilr.Current.Value)
                # Plot all attributes of self.wilr
                self.Plot("WilliamsPercentR", "maximum", self.wilr.Maximum.Current.Value)
                self.Plot("WilliamsPercentR", "minimum", self.wilr.Minimum.Current.Value)
    

    The following reference table describes the WILR method:

    WILR() 1/1

                WilliamsPercentR QuantConnect.Algorithm.QCAlgorithm.WILR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Williams %R indicator. This will compute the percentage change of the current closing price in relation to the high and low of the past N periods. The indicator will be automatically updated on the given resolution.

    If you don't provide a resolution, it defaults to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

    For more information about the selector argument, see Alternative Price Fields .

    For more information about plotting indicators, see Plotting Indicators .

    You can manually create a WilliamsPercentR indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

    Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar , or QuoteBar . The indicator will only be ready after you prime it with enough data.

    public class WilliamsPercentRAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilliamsPercentR _wilr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wilr = new WilliamsPercentR(20);
        }
    
        public override void OnData(Slice data)
        {
            if (data.Bars.TryGeValue(_symbol, out var bar))
            {      
                _wilr.Update(bar);
            }
    
            if (_wilr.IsReady)
            {
                // The current value of _wilr is represented by itself (_wilr)
                // or _wilr.Current.Value
                Plot("WilliamsPercentR", "wilr", _wilr);
                // Plot all properties of wilr
                Plot("WilliamsPercentR", "maximum", _wilr.Maximum);
                Plot("WilliamsPercentR", "minimum", _wilr.Minimum);
            }
        }
    }
    class WilliamsPercentRAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wilr = WilliamsPercentR(20)
    
        def OnData(self, slice: Slice) -> None:
            bar = slice.Bars.get(self.symbol)
            if bar:
                self.wilr.Update(bar)
    
            if self.wilr.IsReady:
                # The current value of self.wilr is represented by self.wilr.Current.Value
                self.Plot("WilliamsPercentR", "wilr", self.wilr.Current.Value)
                # Plot all attributes of self.wilr
                self.Plot("WilliamsPercentR", "maximum", self.wilr.Maximum.Current.Value)
                self.Plot("WilliamsPercentR", "minimum", self.wilr.Minimum.Current.Value)
    

    To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.

    public class WilliamsPercentRAlgorithm : QCAlgorithm
    {
        private Symbol _symbol;
        private WilliamsPercentR _wilr;
    
        public override void Initialize()
        {
            _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
            _wilr = new WilliamsPercentR(20);
            RegisterIndicator(_symbol, _wilr, Resolution.Daily);
        }
    
        public override void OnData(Slice data)
        {
            if (_wilr.IsReady)
            {
                // The current value of _wilr is represented by itself (_wilr)
                // or _wilr.Current.Value
                Plot("WilliamsPercentR", "wilr", _wilr);
                // Plot all properties of wilr
                Plot("WilliamsPercentR", "maximum", _wilr.Maximum);
                Plot("WilliamsPercentR", "minimum", _wilr.Minimum);
            }
        }
    }
    class WilliamsPercentRAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
            self.wilr = WilliamsPercentR(20)
            self.RegisterIndicator(self.symbol, self.wilr, Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            if self.wilr.IsReady:
                # The current value of self.wilr is represented by self.wilr.Current.Value
                self.Plot("WilliamsPercentR", "wilr", self.wilr.Current.Value)
                # Plot all attributes of self.wilr
                self.Plot("WilliamsPercentR", "maximum", self.wilr.Maximum.Current.Value)
                self.Plot("WilliamsPercentR", "minimum", self.wilr.Minimum.Current.Value)
    

    The following reference table describes the WilliamsPercentR constructor:

    WilliamsPercentR() 1/2

                WilliamsPercentR QuantConnect.Indicators.WilliamsPercentR (
        int  period
       )
            

    Creates a new Williams %R.

    WilliamsPercentR() 2/2

                WilliamsPercentR QuantConnect.Indicators.WilliamsPercentR (
        string  name,
        int     period
       )
            

    Creates a new Williams %R.

    Visualization

    The following image shows plot values of selected properties of WilliamsPercentR using the plotly library.

    WilliamsPercentR line plot.

     

    13.2 Key Concepts

    Introduction

    Indicators translate a stream of data points into a numerical value you can use to detect trading opportunities. LEAN provides more than 100 pre-built technical indicators and candlestick patterns you can use in your algorithms. To view a list of all the indicators, see the Supported Indicators . One simple indicator to learn is the Identity indicator, which just returns the value of the asset.

    var pep = Identity("PEP"); // Pepsi ticker
    pep = self.Identity("PEP") # Pepsi ticker

    Design Philosophy

    Technical indicators take in a stream of data points, Bar objects, or TradeBar objects and produce a continuous value. Candlestick patterns take in a stream of Bar or TradeBar objects and produce a value that's either 0, 1, or -1 to signify the presence of the pattern.

    You can configure technical indicators and candlestick patterns to receive manual or automatic updates. With manual indicators, you update the indicator with whatever data you want and whenever you want. With automatic indicators, the algorithm automatically uses the security data to update the indicator value.

    LEAN's indicators are implemented "on-line". This means as data pipes through, it updates the internal state of the indicator. Other platforms perform indicator math on an array of values in bulk which can be very inefficient when working on large volumes of data. You need to warm up your indicators and prime them with data to get them ready.

    Indicator Types

    You can classify an indicator as either a data point, bar, or TradeBar indicator. Their classification depends on the type of data they receive.

    Data Point Indicators

    Data point indicators use IndicatorDataPoint objects to compute their value. Some examples of data point indicators include the following:

    Bar Indicators

    Bar indicators use QuoteBar or TradeBar objects to compute their value. Since Forex and CFD securities don't have TradeBar data, they use bar indicators. Candlestick patterns are examples of bar indicators. Some other examples of bar indicators include the following:

    TradeBar Indicators

    TradeBar indicators use TradeBar objects to compute their value. Some TradeBar indicators use the volume property of the TradeBar to compute their value. Some examples of TradeBar indicators include the following:

    Naming Convention

    The class name to create a manual indicator is the indicator name spelled in pascal case. For example, to create a manual simple moving average indicator , use the SimpleMovingAverage class.

    The method to create an automatic indicator is usually named after the acronym of the indicator name. For example, to create an automatic simple moving average indicator , use the SMA method.

    To view the class name and shortcut method of each indicator, see the Supported Indicators .

    Create Indicators

    There are two ways to create indicators. You can create indicators with the indicator constructor or use a helper method in the QCAlgorithm class. If you use the helper method, the indicator automatically updates as your algorithm receives new data.

    // Create a manual indicator with the indicator constructor
    var manualSMA = SimpleMovingAverage(20, Resolution.Daily);
    
    // Create an automatic indicator with the helper method
    var symbol = AddCrypto("BTCUSD").Symbol;
    var autoSMA = SMA(symbol, 20, Resolution.Daily);
    # Create a manual indicator with the indicator constructor
    self.manual_sma = SimpleMovingAverage(20, Resolution.Daily)
    
    # Create an automatic indicator with the helper method
    symbol = self.AddCrypto("BTCUSD").Symbol;
    auto_sma = self.SMA(symbol, 20, Resolution.Daily)

    Check Readiness

    Indicators aren't always ready when you first create them. The length of time it takes to trust the indicator values depends on the indicator period. To know if an indicator is ready to use, use the IsReady property.

    if not self.indicator.IsReady:
        return
    
    if (!indicator.IsReady) return;
    

    To get the number of samples the indicator has processed, use the Samples property.

    samples = self.indicator.Samples
    var samples = indicator.Samples;

    Track Update Events

    When an indicator receives a new data point and updates its state, it triggers an update event. To be notified of update events, attach an event handler to the indicator object. The event handler receives 2 arguments: the indicator object and the latest IndicatorDataPoint it produced.

    # After you create the indicator, attach an event handler
    self.indicator.Updated += self.update_event_handler
    
    # Define the event handler within the same class
    def update_event_handler(self, indicator: object, indicator_data_point: IndicatorDataPoint) -> None:
        if indicator.IsReady:
            self.Plot("Indicator", "Value", indicator_data_point.Value)
    
    // After you create the indicator, attach an event handler
    _indicator.Updated += updateEventHandler;
    
    // Define the event handler within the same class
    private void updateEventHandler(object indicator, IndicatorDataPoint indicatorDataPoint)
    {
        if (indicator.IsReady)
        {
            Plot("Indicator", "Value", indicatorDataPoint.Value);
        }
    }
    

    Get Indicator Values

    You can access current and historical indicator values.

    Current Indicator Values

    To access the indicator value, use the .Current.Value property. Some indicators have one output and some indicators have multiple outputs. The SimpleMovingAverage indicator only has one output, the average price over the last n periods, so the .Current.Value property returns this value. The BollingerBand indicator has multiple outputs because it has a simple moving average, an upper band, and a lower band. For indicators that have multiple outputs, refer to the Supported Indicators to see how to access the output values.

    sma = self.sma.Current.Value
    
    current_price = self.bb.Current.Value
    bb_upper_band = self.bb.UpperBand.Current.Value
    bb_lower_band = self.bb.LowerBand.Current.Value
    var sma = _sma.Current.Value
    
    var currentPrice = _bb.Current.Value
    var bbUpperBand = _bb.UpperBand.Current.Value
    var bbLowerBand = _bb.LowerBand.Current.Value

    You can implicitly cast indicators to the decimal version of their .Current.Value property.

    if self.sma > self.bb.UpperBand:
        self.SetHoldings(self.symbol, -0.1)
    if (_sma > _bb.UpperBand)
    {
        SetHoldings(_symbol, -0.1);
    }

    Historical Indicator Values

    To track historical indicator values, use a RollingWindow . Indicators emit an Updated event when they update. To create a RollingWindow of indicator points, attach an event handler function to the Updated member that adds the last value of the indicator to the RollingWindow . The value is an IndicatorDataPoint object that represents a piece of data at a specific time.

    public override void Initialize()
    {
       // Create an indicator and adds to a RollingWindow when it is updated
       smaWindow = new RollingWindow<IndicatorDataPoint>(5);
       SMA("SPY", 5).Updated += (sender, updated) => smaWindow.Add(updated);
    }
    
    def Initialize(self) -> None:
        # Creates an indicator and adds to a RollingWindow when it is updated
        self.sma_window = RollingWindow[IndicatorDataPoint](5)
        self.SMA("SPY", 5).Updated += (lambda sender, updated: self.sma_window.Add(updated))

    The current (most recent) indicator value is at index 0, the previous value is at index 1, and so on until the length of the window.

    var currentSma = smaWin[0];
    var previousSma = smaWin[1];
    var oldestSma = smaWin[smaWin.Count - 1];
    current_sma = self.sma_window[0]
    previous_sma = self.sma_window[1]
    oldest_sma = self.sma_window[sma_window.Count - 1]

    Reset Indicators

    To reset indicators, call the Reset method.

    self.indicator.Reset() 
    
    _indicator.Reset();

    If you are live trading Equities or backtesting Equities without the adjusted data normalization mode , reset your indicators when splits and dividends occur. If a split or dividend occurs, the data in your indicators becomes invalid because it doesn't account for the price adjustments that the split or dividend causes. To replace your indicator history with the newly-adjusted prices, call the Reset method and then warm up the indicator.

    # In OnData
    if data.Splits.ContainsKey(self.symbol) or data.Dividends.ContainsKey(self.symbol):
        # Reset the indicator
        self.sma.Reset() 
    
        # Warm up the indicator
    // In OnData
    if (data.Splits.ContainsKey(_symbol) || data.Dividends.ContainsKey(_symbol))
    {
        // Reset the indicator
        _sma.Reset();
    
        // Warm up the indicator
    }

    The process to warm up your indicator depends on if it's a manual or automatic indicator .

    Common Design Patterns


    The location in your algorithm where you create and manage indicators depends on the type of universe in your algorithm.

    One Asset In a Static Universe

    If you only have one security in your algorithm, you can create an automatic indicator in the Initialize method.

    def Initialize(self):
    self.symbol = self.AddEquity("SPY").Symbol self.EnableAutomaticIndicatorWarmUp = True self.sma = self.SMA(self.symbol, 20, Resolution.Daily)
    private Symbol _symbol;
    private SimpleMovingAverage _sma;
    
    public override void Initialize()
    {
        _symbol = AddEquity("SPY").Symbol;
        EnableAutomaticIndicatorWarmUp = true;
        _sma = SMA(_symbol, 20, Resolution.Daily);
    }

    Multiple Assets or a Dynamic Universe

    If your algorithm has multiple assets or a dynamic universe of assets, abstract your indicator management logic into a separate class.

    class SymbolData:
        def __init__(self, algorithm, symbol):
            self.algorithm = algorithm
            self.symbol = symbol
    
            # Create an indicator
            self.sma = SimpleMovingAverage(20)
    
            # Create a consolidator to update the indicator
            self.consolidator = TradeBarConsolidator(1) 
            self.consolidator.DataConsolidated += self.OnDataConsolidated
    
            # Register the consolidator to update the indicator
            algorithm.SubscriptionManager.AddConsolidator(symbol, self.consolidator)       
    
            # Warm up the indicator
            algorithm.WarmUpIndicator(symbol, self.sma)
    
        def OnDataConsolidated(self, sender: object, consolidated_bar: TradeBar) -> None:
            self.sma.Update(consolidated_bar.EndTime, consolidated_bar.Close)
    
        # If you have a dynamic universe, remove consolidators for the securities removed from the universe
        def dispose(self) -> None:
            self.algorithm.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)
    
    public class SymbolData
    {
        private QCAlgorithm _algorithm;
        private Symbol _symbol;
        private SimpleMovingAverage _sma;
        private TradeBarConsolidator _consolidator;
    
        public SymbolData(QCAlgorithm algorithm, Symbol symbol)
        {
            _algorithm = algorithm;
            _symbol = symbol;
    
            // Create an indicator
            _sma = new SimpleMovingAverage(20);
    
            // Create a consolidator to update the indicator
            _consolidator = new TradeBarConsolidator(1);
            _consolidator.DataConsolidated += OnDataConsolidated;
    
            // Register the consolidator to update the indicator
            algorithm.SubscriptionManager.AddConsolidator(symbol, _consolidator);
    
            // Warm up the indicator
            algorithm.WarmUpIndicator(symbol, _sma);
        }
    
        private void OnDataConsolidated(object sender, TradeBar consolidatedBar)
        {
            _sma.Update(consolidatedBar.EndTime, consolidatedBar.Close);
        }
    
        // If you have a dynamic universe, remove consolidators for the securities removed from the universe
        public void Dispose()
        {
            _algorithm.SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
        }
    }
    	

    Every time the universe adds or removes a security, create or dispose of the respective SymbolData object in the OnSecuritiesChanged event handler.

    class MyAlgorithm(QCAlgorithm):
        symbol_data_by_symbol = {}
    
        def OnSecuritiesChanged(self, changes: SecurityChanges) -> None:
            for security in changes.AddedSecurities:
                self.symbol_data_by_symbol[security.Symbol] = SymbolData(self, security.Symbol)
    
            # If you have a dynamic universe, track removed securities
            for security in changes.RemovedSecurities:
                symbol_data = self.symbol_data_by_symbol.pop(security.Symbol, None)
                if symbol_data:
                    symbol_data.dispose()
    
    public class MyAlgorithm : QCAlgorithm
    {
        private Dictionary<Symbol, SymbolData> _symbolDataBySymbol = new();
    
        public override void OnSecuritiesChanged(SecurityChanges changes)
        {
            foreach (var security in changes.AddedSecurities)
            {
                _symbolDataBySymbol[security.Symbol] = new SymbolData(this, security.Symbol);
            }
    
            // If you have a dynamic universe, track removed securities
            foreach (var security in changes.RemovedSecurities)
            {
                if (_symbolDataBySymbol.TryGetValue(security.Symbol, out var symbolData))
                {
                    symbolData.Dispose();
                }
            }
        }
    }

    Differences From Third-Party Indicators

    The values of our indicators can sometimes produce different results than the indicators on other platforms. These discrepancies can be a result of differences in the input data, timestamps, or implementation.

    Price Differences

    If you find differences in indicator values, compare the prices that are fed into the indicator on each platform. If the input data is slightly different, the indicator values will be different. To test if it's a difference in price data, feed in the data from the third-party platform into our indicators. We validate the indicators against third-party sources and when the values are the same, the indicator values are similar too.

    Timestamp Differences

    We timestamp our data to the time when the period ends. Many other platforms timestamp to the beginning of the candle.

    Implementation Differences

    Some indicators can have slightly different default arguments for their implementation. A common difference across platforms is to use a different MovingAverageType for the indicators. To view the default arguments for all our indicators, see Supported Indicators . To view the full implementation of our indicators, see the LEAN GitHub repository .

    Warm Up Period Differences

    Some platforms use all of the historical data to warm up their indicators while LEAN indicators have a fixed number of bars they need to warm up. As a result, indicators with long memory like the Exponential Moving Average can have slightly different values across platforms.

    Examples

    Demonstration Algorithms
    IndicatorSuiteAlgorithm.py Python EmaCrossUniverseSelectionAlgorithm.py Python MACDTrendAlgorithm.py Python RegressionChannelAlgorithm.py Python TalibIndicatorsAlgorithm.py Python IndicatorSuiteAlgorithm.cs C# EmaCrossUniverseSelectionAlgorithm.cs C# MACDTrendAlgorithm.cs C# RegressionChannelAlgorithm.cs C#

     

    13.3 Manual Indicators

    Introduction

    Manual indicators are indicators that don't automatically update from the underlying security data. Manual updates let you customize how you update the indicator and let you use the indicator in dynamic universes without causing your algorithm to slow down over time. It's not always necessary to create manual indicators though. If your algorithm only uses a static universe and you want to update the indicator with data from the security subscription, create an automatic indicator . Automatic indicators are easier to create and update.

    Naming Convention

    The class name to create a manual indicator is the indicator name spelled in pascal case. For example, to create a manual simple moving average indicator , use the SimpleMovingAverage class.

    Create Manual Indicators

    To create manual indicators, instantiate an indicator with its constructor. To view all of the available indicators and their constructors, see Supported Indicators .

    // Create an indicator
    private Delay _delay;
    _delay = new Delay(20);
    
    // Create a candlestick pattern
    private TwoCrows _twoCrows;
    _twoCrows = new TwoCrows();
    # Create an indicator
    self.delay = Delay(20)
    
    # Create a candlestick pattern
    self.two_crows = TwoCrows()

    You can track indicators by their name. To name a manual indicator, pass a string as the first argument to the constructor.

    // Name an indicator
    _delay = new Delay("AAPL Past Price", 20);
    Log(_delay.Name);
    
    // Name a candlestick pattern
    _twoCrows = new TwoCrows("Two Crows Pattern");
    Log(_twoCrows.Name);
    # Name an indicator
    self.delay = Delay("AAPL Past Price", 20)
    self.Log(self.delay.Name)
    
    # Name a candlestick pattern
    self.two_crows = TwoCrows("Two Crows Pattern")
    self.Log(self.two_crows.Name)

    If you don't name an indicator, it's given a default name. For example, the default name for a Delay indicator is "Delay( period )".

    Manual Updates

    With manual updates, you control what data you use to update the indicator. For instance, you can use the 3:30 PM price in your daily moving average instead of the daily closing price or you can use the maximum temperature of the past 10 cloudy days.

    To update an indicator, call the Update method. The Update method expects one of the following arguments:

    To view what data type you should use to update an indicator, see Supported Indicators .

    You can update indicators at any point in your algorithm, but the most common places are during the OnData event handler or during a consolidation event handler.

    def Initialize(self) -> None:
        self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
    
        self.rsi = RelativeStrengthIndex(10, MovingAverageType.Simple)
        self.ad = AccumulationDistribution()
    
        self.consolidator = TradeBarConsolidator(timedelta(days=3))
        # Update the AD indicator with the consolidated bar
        self.consolidator.DataConsolidated += (lambda _, bar : self.ad.Update(bar))
        self.SubscriptionManager.AddConsolidator(self.symbol, self.consolidator)
    
    def OnData(self, slice: Slice) -> None:
        # Update the RSI indicator value with the new input close price every day
        if slice.Bars.ContainsKey(self.symbol):
            bar = slice.Bars[self.symbol]
            self.rsi.Update(bar.EndTime, bar.Close)
    
    private Symbol _symbol;
    private RelativeStrengthIndex _rsi;
    private AccumulationDistribution _ad;
    
    public override void Initialize()
    {
        _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
        
        _rsi = new RelativeStrengthIndex(10, MovingAverageType.Simple);
        _ad = new AccumulationDistribution();
    
        var consolidator = new TradeBarConsolidator(TimeSpan.FromDays(3));
        //Update the AD indicator with the consolidated bar
        consolidator.DataConsolidated += (_, bar) => _ad.Update(bar);
        SubscriptionManager.AddConsolidator(_symbol, consolidator);
    }
    
    public override void OnData(Slice slice)
    {
        // Update the RSI indicator value with the new input close price every day
        if (slice.Bars.ContainsKey(_symbol))
        {
            var bar = slice.Bars[_symbol];
            _rsi.Update(bar.EndTime, bar.Close);
        }
    }
    

    Automatic Updates

    With automatic updates, your indicators automatically update with the security data on a schedule you set. To configure automatic updates, create a consolidator and then call the RegisterIndicator method. If your algorithm has a dynamic universe, save a reference to the consolidator so you can remove it when the universe removes the security. If you register an indicator for automatic updates, don't call the indicator's Update method or else the indicator will receive double updates.

    # Create a security subscription 
    self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol
    
    # Create a manual indicator
    self.indicator = RelativeStrengthIndex(10, MovingAverageType.Simple)
    
    # Create a consolidator
    self.consolidator = TradeBarConsolidator(1)
    
    # Register the indicator to update with the consolidated data
    self.RegisterIndicator(self.symbol, self.indicator, self.consolidator)
    // Create a security subscription 
    _symbol = AddEquity("SPY", Resolution.Hour);
    
    // Create a manual indicator
    _indicator = new RelativeStrengthIndex(10, MovingAverageType.Simple);
    
    // Create a consolidator
    _consolidator = new TradeBarConsolidator(1);
    
    // Register the indicator to update with the consolidated data
    RegisterIndicator(_symbol, _indicator, _consolidator);

    Data point indicators use only a single price data in their calculations. By default, those indicators use the closing price. For assets with TradeBar data, that price is the TradeBar close price. For assets with QuoteBar data, that price is the mid-price of the bid closing price and the ask closing price. To create an indicator with the other fields like the Open , High , Low , or Close , provide a selector argument to the RegisterIndicator method.

    self.RegisterIndicator(self.symbol, self.indicator, self.consolidator, Field.High)
    
    RegisterIndicator(_symbol, _rsi, _consolidator, Field.High);
    

    The Field class has the following selector properties:

    To create a custom selector , define a function that calculates the value.

    RegisterIndicator(_symbol, _indicator, _consolidator, x =>
    {
        var bar = x as IBaseDataBar;
        return (bar.Low + bar.High) / 2;
    });

    Warm Up Indicators

    Indicators use historical data to compute their value. Before you start trading with an indicator, warm it up. There are several ways to warm-up manual indicators.

    Manual Indicator Warm-up

    If you have access to the QCAlgorithm object, you can manually warmup indicators with a history request .

    private SimpleMovingAverage _sma;
    
    _sma = SimpleMovingAverage(20);
    var history = algorithm.History(_symbol, 20, Resolution.Daily);
    foreach (var bar in history)
    {
        sma.Update(bar.Time, bar.Close);
    }
    
    self.sma = SimpleMovingAverage(20)
    history = algorithm.History(self.symbol, 20, Resolution.Daily)
    if not history.empty:
        for time, row in history.loc[self.symbol].iterrows():
            self.sma.Update(time, row.close)

    Warm-up Helper Method

    If an indicator inherits the IIndicatorWarmUpPeriodProvider class, you can warm it up with the WarmUpIndicator method.

    _sma = SimpleMovingAverage(20);
    algorithm.WarmUpIndicator(_symbol, _sma);
    self.sma = SimpleMovingAverage(20)
    algorithm.WarmUpIndicator(self.symbol, self.sma)

    To warm up the indicator with a resolution that's different from the security resolution, pass a resolution or TimeSpan timedelta argument to the WarmUpIndicator method. The resolution you provide should be greater than or equal to the security resolution. For example, if the security has minute resolution data, you should warm up the indicator with data that spans at least one minute.

    // Warm-up with daily bars
    algorithm.WarmUpIndicator(_symbol, _sma, Resolution.Daily);
    
    // Warm-up with 3-day bars
    algorithm.WarmUpIndicator(_symbol, _sma, TimeSpan.FromDays(3));
    # Warm-up with daily bars
    algorithm.WarmUpIndicator(self.symbol, self.sma, Resolution.Daily)
    
    # Warm-up with 3-day bars
    algorithm.WarmUpIndicator(self.symbol, self.sma, timedelta(days=3))

    The WarmUpIndicator method uses the default Value of the historical data to warm up the indicator. In most cases, this is the closing price. To warm up the indicator with a different data field, pass a Field argument to the method.

    algorithm.WarmUpIndicator(_symbol, _sma, Resolution.Daily, Field.High);
    algorithm.WarmUpIndicator(self.symbol, self.sma, Resolution.Daily, Field.High)

    Algorithm Warm-up

    If you create indicators at the beginning of your algorithm, you can set an algorithm warm-up period to warm up the indicators. When you set an algorithm warm-up period, the engine pumps data in and automatically updates all the indicators from before the start date of the algorithm. To ensure that all the indicators are ready after the algorithm warm-up period, choose a lookback period that contains sufficient data.

    private SimpleMovingAverage _sma;
    
    // In Initialize
    var symbol = AddEquity("SPY", Resolution.Daily).Symbol;
    _sma = SimpleMovingAverage(20);
    SetWarmUp(20);
    
    // In OnData
    _sma.Update(data["SPY"]); // Delete this line if you registered the indicator for automatic updates
    if (IsWarmingUp)
    { return; }
    # In Initialize
    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
    self.sma = SimpleMovingAverage(20)
    self.SetWarmUp(20)
    
    # In OnData
    self.sma.Update(data[self.symbol]) # Delete this line if you registered the indicator for automatic updates
    if self.IsWarmingUp:
        return

    Timing Considerations

    In some cases, you might create and warm up the indicator during its sampling period. For example, say the security resolution is minute, the indicator resolution is daily, and you create and warm-up the indicator at noon without using the SetWarmUp method. In this example, the history request that gathers data to warm up the indicator won't contain any data from the current day. Furthermore, if you set up a consolidator to update the indicator, the consolidator also won't aggregate any data from before noon. It doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    13.4 Automatic Indicators

    Introduction

    Automatic indicators are indicators that automatically update from the underlying security data. Automatic indicators do everything that manual indicators do, but with automatic updates registered for you. If you have a dynamic universe, you shouldn't use automatic indicators because you can't remove the consolidator that updates the indicator. Since you can't remove the consolidator, the consolidators build up over time and slow down your algorithm. If your algorithm has a dynamic universe, use manual indicators instead.

    Naming Convention

    The method to create an automatic indicator is usually named after the acronym of the indicator name. For example, to create an automatic simple moving average indicator , use the SMA method.

    Create Automatic Indicators

    To create automatic indicators, call the indicator helper method from the QCAlgorithm class. The indicator helper methods create an indicator object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. To view the helper method for each indicator, see Supported Indicators . In most cases, you should call the helper method in the Initialize method.

    The indicator resolution must be greater than or equal to the resolution of the security subscription. For instance, if your security subscription is for minute resolution data, the indicator resolution should be minute, hour, or daily resolution.

    private SimpleMovingAverage _sma;
    private TwoCrows _twoCrows;
    
    // In Initialize()
    var symbol = AddEquity("SPY").Symbol;
    
    //  - Create an indicator
    _sma = SMA(symbol, 20, Resolution.Daily);
    
    // - Create a candlestick pattern
    var patterns = new CandlestickPatterns(this);
    _twoCrows = patterns.TwoCrows(_symbol);
    # In Initialize()
    symbol = self.AddEquity("SPY").Symbol
    
    #  - Create an indicator
    self.sma = self.SMA(symbol, 20, Resolution.Daily)
    
    #  - Create a candlestick pattern
    patterns = CandlestickPatterns(self)
    self.two_crows = patterns.TwoCrows(self.symbol)
    

    When you create an indicator with a helper method, the indicator is given a default name. You can track indicators by their name. The default name for the SimpleMovingAverage indicator is "SMA( period , ticker _ resolution )". For example, in the preceding code snippet, the SimpleMovingAverage indicator is named "SMA(20,SPY_day)". To get the name of an indicator, inspect its Name property.

    Log(_sma.Name);
    Log(_twoCrows.Name);
    self.Log(self.sma.Name)
    self.Log(self.two_crows.Name)

    Alternative Price Fields

    Data point indicators use only a single price data in their calculations. By default, those indicators use the closing price. For assets with TradeBar data, that price is the TradeBar close price. For assets with QuoteBar data, that price is the mid-price of the bid closing price and the ask closing price. To create an indicator with the other fields like the Open , High , Low , or Close , provide a selector argument to the indicator helper method.

    # Define a 10-period daily RSI indicator with shortcut helper method
    # Select the Open price to update the indicator
    self.rsi = self.RSI("SPY", 10,  MovingAverageType.Simple, Resolution.Daily, Field.Open)
    // Define a 10-period daily RSI indicator with shortcut helper method
    // Select the Open price to update the indicator
    _rsi = RSI("SPY", 10,  MovingAverageType.Simple, Resolution.Daily, Field.Open);

    The Field class has the following selector properties:

    To create a custom selector , define a function that calculates the value.

    _rsi = RSI("SPY", 10,  MovingAverageType.Simple, Resolution.Daily, x =>
    {
        var bar = x as IBaseDataBar;
        return (bar.Low + bar.High) / 2;
    });

    Warm Up Indicators

    Indicators compute their value based on historical data. Before you start trading with an indicator, warm it up. There are several ways to warm-up automatic indicators.

    Algorithm Warm-up

    You can set an algorithm warm-up period to warm up the indicators. When you set an algorithm warm-up period, the engine pumps data in and automatically updates all the indicators from before the start date. To ensure that all the indicators are ready after the algorithm warm-up period, choose a look-back period that contains sufficient data.

    private SimpleMovingAverage _sma;
    
    // In Initialize
    var symbol = AddEquity("SPY").Symbol;
    _sma = SMA(symbol, 20, Resolution.Daily);
    SetWarmUp(20, Resolution.Daily);
    
    // In OnData
    if (IsWarmingUp)
    { return; }
    # In Initialize
    symbol = self.AddEquity("SPY").Symbol
    self.sma = self.SMA(symbol, 20, Resolution.Daily)
    self.SetWarmUp(20, Resolution.Daily)
    
    # In OnData
    if self.IsWarmingUp:
        return

    Manual Indicator Warm-up

    You can manually warm up indicators with a history request .

    private SimpleMovingAverage _sma;
    
    // In Initialize
    var symbol = AddEquity("SPY").Symbol;
    _sma = SMA(symbol, 20, Resolution.Daily);
    
    var history = History(symbol, 20, Resolution.Daily);
    foreach (var bar in history)
    {
        sma.Update(bar.Time, bar.Close);
    }
    
    # In Initialize
    symbol = self.AddEquity("SPY").Symbol
    self.sma = self.SMA(symbol, 20, Resolution.Daily)
    
    history = self.History(symbol, 20, Resolution.Daily)
    if not history.empty:
        for time, row in history.loc[symbol].iterrows():
            self.sma.Update(time, row.close)
    

    Automatic Indicator Warm-up

    You can set the EnableAutomaticIndicatorWarmUp property to true before you create indicators to automatically warm them up.

    private SimpleMovingAverage _sma;
    
    // In Initialize
    var symbol = AddEquity("SPY").Symbol;
    EnableAutomaticIndicatorWarmUp = true;
    _sma = SMA(symbol, 20, Resolution.Daily);
    
    # In Initialize
    symbol = self.AddEquity("SPY").Symbol
    self.EnableAutomaticIndicatorWarmUp = True
    self.sma = self.SMA(symbol, 20, Resolution.Daily)

    Warm-up Helper Method

    If an indicator inherits the IIndicatorWarmUpPeriodProvider class, you can warm it up with the WarmUpIndicator method.

    _sma = SMA(_symbol, 20);
    WarmUpIndicator(_symbol, _sma);
    self.sma = self.SMA(self.symbol, 20)
    self.WarmUpIndicator(self.symbol, self.sma)

    To warm up the indicator with a resolution that's different from the security resolution, pass a resolution or TimeSpan timedelta argument to the WarmUpIndicator method. The resolution you provide should be greater than or equal to the security resolution. For example, if the security has minute resolution data, you should warm up the indicator with data that spans at least one minute. If the indicator resolution is different from the security resolution, provide the indicator resolution as the argument to properly warm up the indicator.

    // Warm up with daily bars
    WarmUpIndicator(_symbol, _sma, Resolution.Daily);
    
    // Warm up with 3-day bars
    WarmUpIndicator(_symbol, _sma, TimeSpan.FromDays(3));
    # Warm up with daily bars
    self.WarmUpIndicator(self.symbol, self.sma, Resolution.Daily)
    
    # Warm up with 3-day bars
    self.WarmUpIndicator(self.symbol, self.sma, timedelta(days=3))

    The WarmUpIndicator method uses the default Value of the historical data to warm up the indicator. In most cases, this is the closing price. To warm up the indicator with a different data field, pass a Field argument to the method.

    WarmUpIndicator(_symbol, _sma, Resolution.Daily, Field.High);
    self.WarmUpIndicator(self.symbol, self.sma, Resolution.Daily, Field.High)

    Timing Considerations

    In some cases, you might create and warm up the indicator during its sampling period. For example, say the security resolution is minute, the indicator resolution is daily, and you create and warm-up the indicator at noon without using the SetWarmUp method. In this example, the history request that gathers data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. It doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

    Common Mistakes

    Avoid the following common mistakes when you use automatic indicators.

    Creating Automatic Indicators in a Dynamic Universe

    You can't currently remove the consolidator that LEAN creates to update automatic indicators. If you add consolidators to a dynamic universe, the consolidators build up over time and slow down your algorithm. To avoid issues, if you algorithm has a dynamic universe, use manual indicators .

    Using Indicator Values Before the Indicator Is Warmed Up

    Indicators can provide inaccurate output values before they are warmed up. To avoid issues, always check the IsReady flag before you use indicator output values.

    if (_indicator.IsReady)
    {
        var value = _indicator.Current.Value;
    }
    if self.indicator.IsReady:
        value = self.indicator.Current.Value

    Manually Registering an Automatic Indicator for Updates

    If you create an automatic indicator and then register it for automatics updates or call the Update method, the indicator receives multiple input values during each update cycle. To avoid issues, create automatic indicators but don't register them for automatic updates or call the Update method.

    // Create automatic indicators
    _indicator = SMA(_symbol, 5);
    
    // Don't do this:
    RegisterIndicator(_symbol, _indicator, Resolution.Daily)
    # Create automatic indicators
    self.indicator = self.SMA(self.symbol, 5)
    
    # Don't do this:
    self.RegisterIndicator(self.symbol, self.indicator, Resolution.Daily)

     

    13.5 Plotting Indicators

    Introduction

    LEAN provides helper methods to make it simple to create indicator plots.

    Plot Update Events

    To plot all of the values of some indicators, in the Initialize method, call the PlotIndicator method. The method plots each indicator value as the indicator updates. The method accepts up to four indicators.

    var symbol = AddEquity("SPY");
    var smaShort = SMA(symbol, 10);
    var smaLong = SMA(symbol, 20);
    PlotIndicator("<chartName>", smaShort, smaLong)
    symbol = self.AddEquity("SPY")
    sma_short = self.SMA(symbol, 10)
    sma_long = self.SMA(symbol, 20)
    self.PlotIndicator("<chartName>", sma_short, sma_long)

    Plot Current Values

    To plot the current value of indicators, call the Plot method. The method accepts up to four indicators.

    // In Initialize
    var symbol = AddEquity("SPY");
    var smaShort = SMA(symbol, 10);
    var smaLong = SMA(symbol, 20);
    
    // In OnData
    Plot("<chartName>", smaShort, smaLong)
    # In Initialize
    symbol = self.AddEquity("SPY")
    sma_short = self.SMA(symbol, 10)
    sma_long = self.SMA(symbol, 20)
    
    # In OnData
    self.Plot("<chartName>", sma_short, sma_long)

    View Charts

    The following table describes where you can access your charts, depending on how to deploy your algorithms:

    Location Algorithm Lab Algorithms CLI Cloud Algorithms CLI Local Algorithms
    Backtest results page green check green check
    Live results page green check green check
    /backtests/read endpoint green check green check
    /live/read endpoint green check green check
    ReadBacktest method green check green check
    ReadLiveAlgorithm method green check green check
    Local JSON file in your <projectName> / backtests / <timestamp> or <projectName> / live / <timestamp> directory green check green check

    Chart Limits

    Not all indicators share the same base type(T), so you may not be able to plot them together since some indicators require points while others require TradeBars .

    // Plot indicators that extend the "Indicator" type
    PlotIndicators("All Indicator Values", sma, rsi);
    Plot("Current Indicator Values", sma, rsi); 
    
    // Plot indicators that extend the "TradeBarIndicator" type
    PlotIndicators("All Indicator Values", atr, aroon);
    Plot("Current Indicator Values", atr, aroon);
    # Plot indicators that extend the "Indicator" type
    self.PlotIndicators("All Indicator Values", sma, rsi)
    self.Plot("Current Indicator Values", sma, rsi); 
    
    # Plot indicators that extend the "TradeBarIndicator" type
    self.PlotIndicators("All Indicator Values", atr, aroon)
    self.Plot("Current Indicator Values", atr, aroon); 
    

    If your indicator plots are complex, call the Plot method with one indicator and plot its .Current.Value . For more information about plotting, see Charting .

     

    13.6 Combining Indicators

    Introduction

    Indicator extensions let you chain indications together like Lego blocks to create unique combinations. When you chain indicators together, the .Current.Value output of one indicator is the input of the following indicator. To chain indicators together with values other than the .Current.Value , create a custom indicator .

    Addition

    The Plus extension sums the .Current.Value of two indicators or sums the .Current.Value of an indicator and a fixed value.

    // Sum the output of two indicators
    var rsiShort = RSI("SPY", 14);
    var rsiLong = RSI("SPY", 21);
    var rsiPlusRsi = rsiShort.Plus(rsiLong);
    
    // Sum the output of an indicator and a fixed value
    var rsiPlusValue = rsiShort.Plus(10);
    # Sum the output of two indicators
    rsi_short = self.RSI("SPY", 14)
    rsi_long = self.RSI("SPY", 21)
    rsi_plus_rsi = IndicatorExtensions.Plus(rsi_short, rsi_long)
    
    # Sum the output of an indicator and a fixed value
    rsi_plus_value = IndicatorExtensions.Plus(rsi_short, 10)

    If you pass an indicator to the Plus extension, you can name the composite indicator.

    var namedIndicator = rsiShort.Plus(rsiLong, "RSI Sum");
    named_indicator = IndicatorExtensions.Plus(rsi_short, rsi_long, "RSI Sum")

    Subtraction

    The Minus extension subtracts the .Current.Value of two indicators or subtracts a fixed value from the .Current.Value of an indicator.

    // Subtract the output of two indicators
    var smaShort = SMA("SPY", 14);
    var smaLong = SMA("SPY", 21);
    var smaDifference = smaShort.Minus(smaLong);
    
    // Subtract a fixed value from the output of an indicator
    var smaMinusValue = smaShort.Minus(10);
    # Subtract the output of two indicators
    sma_short = self.SMA("SPY", 14)
    sma_long = self.SMA("SPY", 21)
    sma_difference = IndicatorExtensions.Minus(sma_short, sma_long)
    
    # Subtract a fixed value from the output of an indicator
    sma_minus_value = IndicatorExtensions.Minus(sma_short, 10)

    If you pass an indicator to the Minus extension, you can name the composite indicator.

    var namedIndicator = smaShort.Minus(smaLong, "SMA Difference");
    named_indicator = IndicatorExtensions.Minus(sma_short, sma_long, "SMA Difference")

    Multiplication

    The Times extension multiplies the .Current.Value of two indicators or multiplies a fixed value and the .Current.Value of an indicator.

    // Multiply the output of two indicators
    var emaShort = EMA("SPY", 14);
    var emaLong = EMA("SPY", 21);
    var emaProduct = emaShort.Times(emaLong);
    
    // Multiply the output of an indicator and a fixed value
    var emaTimesValue = emaShort.Times(10);
    # Multiply the output of two indicators
    ema_short = self.EMA("SPY", 14)
    ema_long = self.EMA("SPY", 21)
    ema_product = IndicatorExtensions.Times(ema_short, ema_long)
    
    # Multiply the output of an indicator and a fixed value
    ema_times_value = IndicatorExtensions.Times(ema_short, 1.5)

    If you pass an indicator to the Times extension, you can name the composite indicator.

    var namedIndicator = emaShort.Times(emaLong, "EMA Product");
    named_indicator = IndicatorExtensions.Times(ema_short, ema_long, "EMA Product")

    Division

    The Over extension divides the .Current.Value of an indicator by the .Current.Value of another indicator or a fixed value.

    // Divide the output of two indicators
    var rsiShort = RSI("SPY", 14);
    var rsiLong = RSI("SPY", 21);
    var rsiDivision = rsiShort.Over(rsiLong);
    
    // Divide the output of an indicator by a fixed value
    var rsiAverage = rsiShort.Plus(rsiLong).Over(2);
    # Divide the output of two indicators
    rsi_short = self.RSI("SPY", 14)
    rsi_long = self.RSI("SPY", 21)
    rsi_division = rsi_short.Over(rsi_long)
    
    # Divide the output of an indicator by a fixed value
    rsi_half = IndicatorExtensions.Over(rsi_short, 2)

    If you pass an indicator to the Over extension, you can name the composite indicator.

    var namedIndicator = rsiShort.Over(rsiLong, "RSI Division");
    named_indicator = IndicatorExtensions.Over(rsi_short, rsi_long, "RSI Division")

    Weighted Average

    The WeightedBy extension calculates the average .Current.Value of an indicator over a lookback period, weighted by another indicator over the same lookback period. The value of the calculation is

    $$ \frac{\textbf{x} \cdot \textbf{y}}{ \sum\limits_{i=1}^{n} y_{i} } $$

    where $\textbf{x}$ is a vector that contains the historical values of the first indicator, $\textbf{y}$ is a vector that contains the historical values of the second indicator, and $n$ is the lookback period.

    var smaShort = SMA("SPY", 14); 
    var smaLong = SMA("SPY", 21); 
    var weightedSMA = smaShort.WeightedBy(smaLong, 3);
    
    sma_short = self.SMA("SPY", 14)
    sma_long = self.SMA("SPY", 21)
    weighted_sma = IndicatorExtensions.WeightedBy(sma_short, sma_long, 3)
    

    Custom Chains

    The Of extension feeds an indicator's .Current.Value into the input of another indicator. The first argument of the IndicatorExtensions.Of method must be a manual indicator with no automatic updates. If you pass an indicator that has automatic updates as the argument, that first indicator is updated twice. The first update is from the security data and the second update is from the IndicatorExtensions class.

    var rsi = RSI("SPY", 14);
    var rsiSMA = (new SimpleMovingAverage(10)).Of(rsi); // 10-period SMA of the 14-period RSI
    rsi = self.RSI("SPY", 14)
    rsi_sma = IndicatorExtensions.Of(SimpleMovingAverage(10), rsi) # 10-period SMA of the 14-period RSI

    If you pass a manual indicator as the second argument, to update the indicator chain, update the second indicator. If you call the Update method of the entire indicator chain, it won't update the chain properly.

    Simple Moving Average

    The SMA extension calculates the simple moving average of an indicator's .Current.Value .

    var rsi = RSI("SPY", 14); // Create a RSI indicator
    var rsiSMA = rsi.SMA(3); // Create an indicator to calculate the 3-period SMA of the RSI indicator
    
    rsi = self.RSI("SPY", 14) # Create a RSI indicator
    rsi_sma = IndicatorExtensions.SMA(rsi, 3) # Create an indicator to calculate the 3-period SMA of the RSI indicator
    

    Exponential Moving Average

    The EMA extension calculates the exponential moving average of an indicator's .Current.Value .

    var rsi = RSI("SPY", 14); // Create a RSI indicator
    var rsiEMA = _rsi.EMA(3); // Create an indicator to calculate the 3-period EMA of the RSI indicator
    
    rsi = self.RSI("SPY", 14) # Create a RSI indicator
    rsi_ema = IndicatorExtensions.EMA(rsi, 3) # Create an indicator to calculate the 3-period EMA of the RSI indicator
    

    The EMA extension can also accept a smoothing parameter that sets the percentage of data from the previous value that's carried into the next value.

    var rsiEMA = rsi.EMA(3, 0.1m); // 10% smoothing factor
    rsi_ema = IndicatorExtensions.EMA(rsi, 3, 0.1) # 10% smoothing factor

    Maximum

    The MAX extension calculates an indicator's maximum .Current.Value over a lookback window.

    var ema = EMA("SPY", 14); // Create an EMA indicator
    var emaMax = ema.MAX(10); // Create an indicator to calculate the maximum EMA over the last 10 periods
    
    ema = self.EMA("SPY", 14) # Create an EMA indicator
    ema_max = IndicatorExtensions.MAX(ema, 10) # Create an indicator to calculate the maximum EMA over the last 10 periods
    

    Minimum

    The MIN extension calculates an indicator's minimum .Current.Value over a lookback window.

    var ema = EMA("SPY", 14); // Create an EMA indicator
    var emaMin = ema.MIN(10); // Create an indicator to calculate the minimum EMA over the last 10 periods
    
    ema = self.EMA("SPY", 14) # Create an EMA indicator
    ema_min = IndicatorExtensions.MIN(ema, 10) # Create an indicator to calculate the minimum EMA over the last 10 periods
    

    Examples

    Demonstration Algorithm
    DisplacedMovingAverageRibbon.py Python

     

    13.7 Custom Indicators

    Introduction

    LEAN supports over 100 pre-built indicators, but a custom indicator is an indicator you define. It receives input, performs some calculation, and sets its output value. Custom indicators are helpful when you want to achieve any of the following results:

    Define Indicators

    Custom indicators must implement the PythonIndicator class. The indicator must have an Update method and Name , Time , and Value attributes. The Update method must accept an IndicatorDataPoint , QuoteBar , or TradeBar and return a boolean that represents if the indicator is ready. The Time attribute represents the last time you updated the indicator and the Value attribute represents the current indicator value. The following definition provides an example of a custom simple moving average indicator.

    Custom indicators subsclass the IndicatorBase<IndicatorDataPoint> , BarIndicator , or TradeBarIndicator class, depending on the indicator type . The following definition provides an example of a custom simple moving average indicator that inherits the IndicatorBase<IndicatorDataPoint> class. To view examples of indicators that inherit the BarIndicator or TradeBarIndicator class, see the AverageTrueRange or VolumeWeightedAveragePriceIndicator implementation in the LEAN GitHub repository.

    public class CustomSimpleMovingAverage : IndicatorBase<IndicatorDataPoint>, IIndicatorWarmUpPeriodProvider
    {
        private RollingWindow<decimal> _window;
        public override bool IsReady => _window.IsReady;
        public int WarmUpPeriod => _window.Size;
    
        public CustomSimpleMovingAverage(string name, int period) : base(name)
        {
            _window = new RollingWindow<decimal>(period);
        }
    
        protected override decimal ComputeNextValue(IndicatorDataPoint input)
        {
            _window.Add(input.Value);
            return _window.Sum() / _window.Size;
        }
    
        public override void Reset()
        {
            _window.Reset();
            base.Reset();
        }
    }
    class CustomSimpleMovingAverage(PythonIndicator):
        def __init__(self, name, period):
            self.Name = name
            self.WarmUpPeriod = period
            self.Time = datetime.min
            self.Value = 0
            self.queue = deque(maxlen=period)
    
        def Update(self, input: BaseData) -> bool:
            self.queue.appendleft(input.Value)
            count = len(self.queue)
            self.Time = input.Time
            self.Value = sum(self.queue) / count
            return count == self.queue.maxlen

    Create Indicators

    You must define a custom indicator before you can create an instance of it.

    To create a custom indicator, call the indicator constructor.

    private CustomSimpleMovingAverage _sma;
    
    _sma = new CustomSimpleMovingAverage("My SMA", 10);
    self.custom_sma = CustomSimpleMovingAverage("My SMA", 10)

    Updates

    The process to update custom indicators is the same process you use to update manual indicators. For more information about updating manual indicators, see Manual Updates or Automatic Updates .

    Warm Up Indicators

    The process to warm up custom indicators is the same process you use to warm up manual indicators .

    Examples

    Demonstration Algorithms
    CustomIndicatorAlgorithm.py Python

     

    13.8 Indicator Universes

    Introduction

    An indicator universe uses technical indicators to determine the constituents of the universe. Imagine a universe that only contains assets above their 10-day simple moving average. You can incorporate indicators into any of the types of universes in the Universes chapter . To create an indicator universe, define a helper class that contains the indicators and then define a universe that updates the indicators and selects assets.

    Define SymbolData Objects

    To make it easy to create and update indicators for each security in the universe, move the indicator logic into a class. In the universe definition, you can create an instance of this class for each security in the universe.

    class SymbolData(object):
        def __init__(self, symbol):
            self.symbol = symbol
            self.tolerance = 1.01
            self.fast = ExponentialMovingAverage(100)
            self.slow = ExponentialMovingAverage(300)
            self.is_uptrend = False
            self.scale = 0
    
        def update(self, time, value):
            if self.fast.Update(time, value) and self.slow.Update(time, value):
                fast = self.fast.Current.Value
                slow = self.slow.Current.Value
                self.is_uptrend = fast > slow * self.tolerance
    
            if self.is_uptrend:
                self.scale = (fast - slow) / ((fast + slow) / 2.0)
    private class SelectionData
    {
        public readonly ExponentialMovingAverage Fast;
        public readonly ExponentialMovingAverage Slow;
    
        public SelectionData()
        {
            Fast = new ExponentialMovingAverage(100);
            Slow = new ExponentialMovingAverage(300);
        }
    
        public decimal ScaledDelta
        {
            get { return (Fast - Slow)/((Fast + Slow)/2m); }
        }
    
        public bool Update(DateTime time, decimal value)
        {
            return Fast.Update(time, value) && Slow.Update(time, value);
        }
    }

    Define the Universe

    You need to define SymbolData objects before you define the universe that selects securities.

    When your universe function receives an object that contains all the possible securities, create a SymbolData object for each new security and update the remaining SymbolData objects with their daily price or some other data point. For example, the following universe definition selects US Equities that have the greatest difference between two moving averages.

    class EmaCrossUniverseSelectionAlgorithm(QCAlgorithm):
    
        def Initialize(self) -> None:
            '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
    
            self.SetStartDate(2010,1,1)  #Set Start Date
            self.SetEndDate(2015,1,1)    #Set End Date
            self.SetCash(100000)           #Set Strategy Cash
    
            self.UniverseSettings.Resolution = Resolution.Daily
            self.UniverseSettings.Leverage = 2
    
            self.coarse_count = 10
            self.averages = { }
    
            # this add universe method accepts two parameters:
            # - coarse selection function: accepts an IEnumerable<CoarseFundamental> and returns an IEnumerable<Symbol>
            self.AddUniverse(self.CoarseSelectionFunction)
    
    
        # sort the data by daily dollar volume and take the top 'NumberOfSymbols'
        def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
    
            # We are going to use a dictionary to refer the object that will keep the moving averages
            for cf in coarse:
                if cf.Symbol not in self.averages:
                    self.averages[cf.Symbol] = SymbolData(cf.Symbol)
    
                # Updates the SymbolData object with current EOD price
                avg = self.averages[cf.Symbol]
                avg.update(cf.EndTime, cf.AdjustedPrice)
    
            # Filter the values of the dict: we only want up-trending securities
            values = list(filter(lambda x: x.is_uptrend, self.averages.values()))
    
            # Sorts the values of the dict: we want those with greater difference between the moving averages
            values.sort(key=lambda x: x.scale, reverse=True)
    
            for x in values[:self.coarse_count]:
                self.Log('symbol: ' + str(x.symbol.Value) + '  scale: ' + str(x.scale))
    
            # we need to return only the symbol objects
            return [ x.symbol for x in values[:self.coarse_count] ]
    namespace QuantConnect.Algorithm.CSharp
    {
        public class EmaCrossUniverseSelectionAlgorithm : QCAlgorithm
        {
            // tolerance to prevent bouncing
            const decimal Tolerance = 0.01m;
            private const int Count = 10;
            // use Buffer+Count to leave a little in cash
            private const decimal TargetPercent = 0.1m;
            private SecurityChanges _changes = SecurityChanges.None;
            // holds our coarse fundamental indicators by symbol
            private readonly ConcurrentDictionary<Symbol, SelectionData> _averages = new ConcurrentDictionary<Symbol, SelectionData>();
        
            public override void Initialize()
            {
                UniverseSettings.Leverage = 2.0m;
                UniverseSettings.Resolution = Resolution.Daily;
    
                SetStartDate(2010, 01, 01);
                SetEndDate(2015, 01, 01);
                SetCash(100*1000);
    
                AddUniverse(coarse =>
                {
                    return (from cf in coarse
                            // grab th SelectionData instance for this symbol
                            let avg = _averages.GetOrAdd(cf.Symbol, sym => new SelectionData())
                            // Update returns true when the indicators are ready, so don't accept until they are
                            where avg.Update(cf.EndTime, cf.AdjustedPrice)
                            // only pick symbols who have their 50 day ema over their 100 day ema
                            where avg.Fast > avg.Slow*(1 + Tolerance)
                            // prefer symbols with a larger delta by percentage between the two averages
                            orderby avg.ScaledDelta descending
                            // we only need to return the symbol and return 'Count' symbols
                            select cf.Symbol).Take(Count);
                });
            }
        }
    }

    Examples

    Demonstration Algorithms
    EmaCrossUniverseSelectionAlgorithm.py Python EmaCrossUniverseSelectionAlgorithm.cs C#

     

    13.9 Rolling Window

    Introduction

    A RollingWindow is an array of a fixed-size that holds trailing data. It's more efficient to use RollingWindow objects to hold periods of data than to make multiple historical data requests . With a RollingWindow , you just update the latest data point while a History call fetches all of the data over the period you request. RollingWindow objects operate on a first-in, first-out process to allow for reverse list access semantics. Index 0 refers to the most recent item in the window and the largest index refers to the last item in the window.

    Supported Types

    RollingWindow objects can store any native or C# types.

    closeWindow = new RollingWindow<decimal>(4);
    tradeBarWindow = new RollingWindow<TradeBar>(2);
    quoteBarWindow = new RollingWindow<QuoteBar>(2);
    self.close_window = RollingWindow[float](4)
    self.trade_bar_window = RollingWindow[TradeBar](2)
    self.quote_bar_window = RollingWindow[QuoteBar](2)

    To be notified when RollingWindow objects support additional types, subscribe to GitHub Issue #6199 .

    Add Data

    To add data to a RollingWindow , call the Add method.

    closeWindow.Add(data["SPY"].Close);
    tradeBarWindow.Add(data["SPY"]);
    quoteBarWindow.Add(data["EURUSD"]);
    self.close_window.Add(data["SPY"].Close)
    self.trade_bar_window.Add(data["SPY"])
    self.quote_bar_window.Add(data["EURUSD"])

    Warm Up

    To warm up a RollingWindow , make a history request and then iterate through the result to add the data to the RollingWindow .

    var spy = AddEquity("SPY", Resolution.Daily).Symbol;
    var historyTradeBar = History<TradeBar>(spy, 10, Resolution.Daily);
    var historyQuoteBar = History<QuoteBar>(spy, 10, Resolution.Minute);
    
    // Warm up the close price and trade bar rolling windows with the previous 10-day trade bar data
    var closePriceWindow = new RollingWindow<decimal>(10);
    var tradeBarWindow = new RollingWindow<TradeBar>(10);
    foreach (var tradeBar in historyTradeBar)
    {
        closePriceWindow.Add(tradeBar.Close);
        tradeBarWindow.Add(tradeBar);
    }
    
    // Warm up the quote bar rolling window with the previous 10-minute quote bar data
    var quoteBarWindow = new RollingWindow<QuoteBar>(10);
    foreach (var quoteBar in historyQuoteBar)
    {
        quoteBarWindow.Add(quoteBar);
    }
    spy = self.AddEquity("SPY", Resolution.Daily).Symbol
    history_trade_bar = self.History[TradeBar](spy, 10, Resolution.Daily)
    history_quote_bar = self.History[QuoteBar](spy, 10, Resolution.Minute)
    
    # Warm up the close price and trade bar rolling windows with the previous 10-day trade bar data
    close_price_window = RollingWindow[float](10)
    trade_bar_window = RollingWindow[TradeBar](10)
    for trade_bar in history_trade_bar:
        close_price_window.Add(trade_bar.Close)
        trade_bar_window.Add(trade_bar)
    
    # Warm up the quote bar rolling window with the previous 10-minute quote bar data
    quote_bar_window = RollingWindow[QuoteBar](10)
    for quote_bar in history_quote_bar:
        quote_bar_window.Add(quote_bar)

    Check Readiness

    To check if a RollingWindow is full, use its IsReady flag.

    if (!closeWindow.IsReady) 
    {
        return;
    }
    if not self.close_window.IsReady:
        return

    Access Data

    RollingWindow objects operate on a first-in, first-out process to allow for reverse list access semantics. Index 0 refers to the most recent item in the window and the largest index refers to the last item in the window.

    var currentClose = closeWindow[0];
    var previousClose = closeWindow[1];
    var oldestClose = closeWindow[closeWindow.Count-1];
    current_close = self.close_window[0]
    previous_close = self.close_window[1]
    oldest_close = self.close_window[self.close_window.Count-1]

    To get the item that was most recently removed from the RollingWindow , use the MostRecentlyRemoved property.

    var removedClose = closeWindow.MostRecentlyRemoved;
    removed_close = self.close_window.MostRecentlyRemoved

    Combine with Indicators

    To track historical indicator values, use a RollingWindow . Indicators emit an Updated event when they update. To create a RollingWindow of indicator points, attach an event handler function to the Updated member that adds the last value of the indicator to the RollingWindow . The value is an IndicatorDataPoint object that represents a piece of data at a specific time.

    public override void Initialize()
    {
       // Create an indicator and adds to a RollingWindow when it is updated
       smaWindow = new RollingWindow<IndicatorDataPoint>(5);
       SMA("SPY", 5).Updated += (sender, updated) => smaWindow.Add(updated);
    }
    
    def Initialize(self) -> None:
        # Creates an indicator and adds to a RollingWindow when it is updated
        self.sma_window = RollingWindow[IndicatorDataPoint](5)
        self.SMA("SPY", 5).Updated += (lambda sender, updated: self.sma_window.Add(updated))

    To view how to access individual members in an indicator, see Get Indicator Values .

    var currentSma = smaWin[0];
    var previousSma = smaWin[1];
    var oldestSma = smaWin[smaWin.Count - 1];
    current_sma = self.sma_window[0]
    previous_sma = self.sma_window[1]
    oldest_sma = self.sma_window[sma_window.Count - 1]

    Combine with Consolidators

    To store a history of consolidated bars , in the consolidation handler, add the consolidated bar to the RollingWindow .

    _consolidator.DataConsolidated += (sender, consolidatedBar) => tradeBarWindow.Add(consolidatedBar);
    self.consolidator.DataConsolidated += lambda sender, consolidated_bar: self.trade_bar_window.Add(consolidated_bar)

    Cast to Other Types

    You can cast a RollingWindow to a list or a DataFrame. If you cast it to a list, reverse the list so the most recent element is at the last index of the list. This is the order the elements would be in if you added the elements to the list with the Add method. To cast a RollingWindow to a DataFrame, the RollingWindow must contain Slice , Tick , QuoteBar , or TradeBar objects. If the RollingWindow contains ticks, the ticks must have unique timestamps.

    You can cast a RollingWindow to a list. If you cast it to a list, reverse the list so the most recent element is at the last index of the list. This is the order the elements would be in if you added the elements to the list with the Add method.

    var closes = closeWindow.Reverse().ToList();
    closes = list(self.close_window)[::-1]
    
    tick_df = self.PandasConverter.GetDataFrame[Tick](list(self.tick_window)[::-1])
    trade_bar_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.trade_bar_window)[::-1])
    quote_bar_df = self.PandasConverter.GetDataFrame[QuoteBar](list(self.quote_bar_window)[::-1])

    Delete Data

    To remove all of the elements from a RollingWindow , call the Reset method.

    closeWindow.Reset();
    self.close_window.Reset()

    Examples

    Demonstration Algorithm
    RollingWindowAlgorithm.py Python CustomVolatilityModelAlgorithm.py Python MultipleSymbolConsolidationAlgorithm.py Python RollingWindowAlgorithm.cs C# MultipleSymbolConsolidationAlgorithm.cs C#

     

    14 Object Store

    Introduction

    The Object Store is a file system that you can use in your algorithms to save, read, and delete data. The Object Store is organization-specific, so you can save or read data from the same Object Store in all of your organization's projects. The Object Store works like a key-value storage system where you can store regular strings, JSON encoded strings, XML encoded strings, and bytes. You can access the data you store in the Object Store from backtests, the Research Environment, and live algorithms.

    When you deploy live algorithms, the state of the Object Store is copied, but it never refreshes. Therefore, if you save data in the Object Store in a live algorithm, you can access the data from the live algorithm, backtests, and the Research Environment. However, if you save content into the Object Store from the Research Environment or a backtest after you deploy a live algorithm, you can't access the new content from the live algorithm.

    Get All Stored Data

    To get all of the keys and values in the Object Store, iterate through the ObjectStore object.

    foreach (var kvp in ObjectStore)
    {
        var key = kvp.Key;
        var value = kvp.Value;
    }
    for kvp in self.ObjectStore:
        key = kvp.Key
        value = kvp.Value

    To iterate through just the keys in the Object Store, iterate through the Keys property.

    foreach (var key in ObjectStore.Keys)
    {
        continue;
    }
    for key in self.ObjectStore.Keys:
        continue

    Create Sample Data

    You need some data to store data in the Object Store.

    Follow these steps to create some sample data:

    1. Create a dictionary.
    2. var dictSample = new Dictionary<string, int> { {"One", 1}, {"Two", 2}, {"Three", 3} };
    3. Create a string .
    4. var stringSample = "My string";
      string_sample = "My string"
    5. Create a Bytes object.
    6. var bytesSample = Encoding.UTF8.GetBytes("My String");
      bytes_sample = str.encode("My String")
    7. Convert the dictionary to an XML -formatted object.
    8. var xmlSample = new XElement("sample",
          dictSample.Select(kvp => new XElement(kvp.Key, kvp.Value)));
      Log(xmlSample.ToString());
      Sample XML format data

    Save Data

    The Object Store saves objects under a key-value system. If you save objects in backtests, you can access them from the Research Environment. To avoid slowing down your backtests, save data once in the OnEndOfAlgorithm event handler. In live trading, you can save data more frequently like at the end of a Train method or after universe selection.

    If you run algorithms in QuantConnect Cloud, you need storage create permissions to save data in the Object Store.

    If you don't have data to store, create some sample data .

    You can save the following types of objects in the Object Store:

    You can save Bytes and string objects in the Object Store. To store data, you need to provide a key. If you provide a key that is already in the Object Store, it will overwrite the data at that location. To avoid overwriting objects from other projects in your organization, prefix the key with your project ID. You can find the project ID in the URL of your browser when you open a project. For example, the ID of the project at quantconnect.com/project/12345 is 12345.

    Bytes

    To save a Bytes object, call the SaveBytes method.

    var saveSuccessful = ObjectStore.SaveBytes($"{ProjectId}/bytesKey", bytesSample)
    save_successful = self.ObjectStore.SaveBytes(f"{self.ProjectId}/bytes_key", bytes_sample)

    Strings

    To save a string object, call the Save or SaveString method.

    var saveSuccessful = ObjectStore.Save($"{ProjectId}/stringKey", stringSample);
    save_successful = self.ObjectStore.Save(f"{self.ProjectId}/string_key", string_sample)

    JSON

    To save a JSON object, call the SaveJson<T> method. This method helps to serialize the data into JSON format.

    var saveSuccessful = ObjectStore.SaveJson<Dictionary<string, int>>($"{ProjectId}/jsonKey", dictSample);

    XML

    To save an XML-formatted object, call the SaveXml<T> method.

    var saveSuccessful = ObjectStore.SaveXml<XElement>($"{ProjectId}/xmlKey", xmlSample);

    Read Data

    Read data from the Object Store to import algorithm variables between deployments, import data from the Research Environment, or load trained machine learning models. To read data from the Object Store, you need to provide the key you used to store the object.

    You can load the following types of objects from the Object Store:

    You can load Bytes and string objects from the Object Store.

    Before you read data from the Object Store, check if the key exists.

    if (ObjectStore.ContainsKey(key))
    {
        // Read data
    }
    if self.ObjectStore.ContainsKey(key):
        # Read data

    Bytes

    To read a Bytes object, call the ReadBytes method.

    var bytesData = ObjectStore.ReadBytes($"{ProjectId}/bytesKey");
    byte_data = self.ObjectStore.ReadBytes(f"{self.ProjectId}/bytes_key")

    Strings

    To read a string object, call the Read or ReadString method.

    var stringData = ObjectStore.Read($"{ProjectId}/stringKey");
    string_data = self.ObjectStore.Read(f"{self.ProjectId}/string_key")

    JSON

    To read a JSON object, call the ReadJson<T> method.

    var jsonData = ObjectStore.ReadJson<Dictionary<string, int>>($"{ProjectId}/jsonKey");

    XML

    To read an XML-formatted object, call the ReadXml<T> method.

    var xmlData = ObjectStore.ReadXml<XElement>($"{ProjectId}/xmlKey");

    If you created the XML object from a dictionary, reconstruct the dictionary.

    var dict = xmlData.Elements().ToDictionary(x => x.Name.LocalName, x => int.Parse(x.Value));

    Delete Data

    Delete objects in the Object Store to remove objects that you no longer need. If you run algorithms in QuantConnect Cloud, you need storage delete permissions to delete data from the Object Store.

    To delete objects from the Object Store, call the Delete method. Before you delete data, check if the key exists. If you try to delete an object with a key that doesn't exist in the Object Store, the method raises an exception.

    if (ObjectStore.ContainsKey(key))
    {
        ObjectStore.Delete(key);
    }
    if self.ObjectStore.ContainsKey(key):
        self.ObjectStore.Delete(key)

    To delete all of the content in the Object Store, iterate through all the stored data.

    foreach (var kvp in ObjectStore)
    {
        ObjectStore.Delete(kvp.Key);
    }
    for kvp in self.ObjectStore:
        self.ObjectStore.Delete(kvp.Key)

    Cache Data

    When you write to or read from the Object Store, the algorithm caches the data. The cache speeds up the algorithm execution because if you try to read the Object Store data again with the same key, it returns the cached data instead of downloading the data again. The cache speeds up execution, but it can cause problems if you are trying to share data between two nodes under the same Object Store key. For example, consider the following scenario:

    1. You open project A and save data under the key 123 .
    2. You open project B and save new data under the same key 123 .
    3. In project A, you read the Object Store data under the key 123 , expecting the data from project B, but you get the original data you saved in step #1 instead.
    4. You get the data from step 1 instead of step 2 because the cache contains the data from step 1.

    To clear the cache, call the Clear method.

    ObjectStore.Clear();
    self.ObjectStore.Clear()

    Get File Path

    To get the file path for a specific key in the Object Store, call the GetFilePath method. If the key you pass to the method doesn't already exist in the Object Store, it's added to the Object Store.

    var filePath = ObjectStore.GetFilePath(key);
    file_path = self.ObjectStore.GetFilePath(key)

    Storage Quotas

    If you run algorithms locally, you can store as much data as your hardware will allow. If you run algorithms in QuantConnect Cloud, you must stay within your storage quota . If you need more storage space, edit your storage plan .

    Example for Plotting

    You can use the ObjectStore to plot data from your backtests and live algorithm in the Research Environment. In the following example, you will learn how to plot the Simple Moving Average indicator generated in a backtest.

    1. Create a algorithm, add a data subscription and a Simple Moving Average indicator.
    2. public class ObjectStoreChartingAlgorithm : QCAlgorithm
      {
          private SimpleMovingAverage _sma;
          private string _content;
      
          public override void Initialize()
          {
              AddEquity("SPY", Resolution.Minute);
              _sma = SMA("SPY", 22);
          }
      }
      class ObjectStoreChartingAlgorithm(QCAlgorithm):
          def Initialize(self):
              self.AddEquity("SPY")
          
              self.content = ''
              self.sma = self.SMA("SPY", 22)

      The algorithm will save _content self.content to the ObjectStore .

    3. Save indicator data as string in _content self.content .
    4. public override void OnData(Slice data)
      {
          _content += $"{_sma.Current.EndTime},{_sma}\n";
      }
      def OnData(self, data: Slice):
          self.Plot('SMA', 'Value', self.sma.Current.Value)
          self.content += f'{self.sma.Current.EndTime},{self.sma.Current.Value}\n'
    5. To store the collected data, call the Save method with a key.
    6. public override void OnEndOfAlgorithm()
      {
          ObjectStore.Save("sma_values_csharp", _content);
      }
      def OnEndOfAlgorithm(self):
          self.ObjectStore.Save('sma_values_python', self.content)
    7. Open the Research Environment, and create a QuantBook .
    8. // Execute the following command in first
      #load "../Initialize.csx"
      
      // Create a QuantBook object
      #load "../QuantConnect.csx"
      using QuantConnect;
      using QuantConnect.Research;
      
      var qb = new QuantBook();
      qb = QuantBook()
    9. To read data from the Object Store, call the Read method. You need to provide the key you used to store the object.
    10. var content = qb.ObjectStore.Read("sma_values_csharp");
      content = qb.ObjectStore.Read("sma_values_python")
    11. Convert the data to a pandas object, and create a chart.
    12. data = {}
      for line in content.split('\n'):
          csv = line.split(',')
          if len(csv) > 1:
              data[csv[0]] = float(csv[1])
      
      series = pd.Series(data, index=data.keys())
      series.plot()
    13. Import the Plotly.NET and Plotly.NET.LayoutObjects packages.
    14. #r "../Plotly.NET.dll"
      using Plotly.NET;
      using Plotly.NET.LayoutObjects;
    15. Create the Layout object, and set the title , xaxis , and yaxis properties.
    16. var layout = new Layout();
      layout.SetValue("title", Title.init("SMA"));
      
      var xAxis = new LinearAxis();
      xAxis.SetValue("title", "Time");
      layout.SetValue("xaxis", xAxis);
      
      var yAxis = new LinearAxis();
      yAxis.SetValue("title", "SMA");
      layout.SetValue("yaxis", yAxis);
    17. Convert the data to a list of DateTime objects for the chart x-axis and a list of decimal objects for the chart y-axis. Create a Chart2D.Chart.Line object with the data.
    18. var index = new List<DateTimee>();
      var values = new List<decimal>();
      
      foreach (var line in content.Split('\n'))
      {
          var csv = line.Split(',');
          if (csv.Length > 1)
          {
              index.Add(Parse.DateTime(csv[0]));
              values.Add(decimal.Parse(csv[1]));
          }
      }
      
      var chart = Chart2D.Chart.Linee<DateTime, decimal, stringe>(index, values);
    19. Apply the layout to the Line object, and create the HTML object.
    20. chart.WithLayout(layout);
      var result = HTML(GenericChart.toChartHTML(chart));

    Preserve Insights Between Deployments

    Follow these steps to use the Object Store to preserve the algorithm state across live deployments:

    1. Create an algorithm that defines a storage key and adds insights to the Insight Manager .
    2. public class ObjectStoreChartingAlgorithm : QCAlgorithm
      {
          private string _insightKey;
          public override void Initialize()
          {
              _insightKey = $"{ProjectId}/insights";
              SetUniverseSelection(new ManualUniverseSelectionModel(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)));
              SetAlpha(new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromDays(5), 0.025, null));    
          }
      }
      class ObjectStoreChartingAlgorithm(QCAlgorithm):
          def Initialize(self):
              self.insight_key = f"{self.ProjectId}/insights"
              self.SetUniverseSelection(ManualUniverseSelectionModel([ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]))
              self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(5), 0.025, None))
    3. At the top of the algorithm file, add the following imports:
    4. from Newtonsoft.Json import JsonConvert
      from System.Collections.Generic import List

      Insight objects are a C# objects, so you need the preceding C# libraries to serialize and deserialize them.

    5. In the OnEndOfAlgorithm event handler of the algorithm, get the Insight objects and save them in the Object Store as a JSON object.
    6. public override void OnEndOfAlgorithm()
      {
          var insights = Insights.GetInsights(x => x.IsActive(UtcTime));
          ObjectStore.SaveJson(_insightKey, insights);
      }
      def OnEndOfAlgorithm(self):
          insights = self.Insights.GetInsights(lambda x: x.IsActive(self.UtcTime))
          content = ','.join([JsonConvert.SerializeObject(x) for x in insights])
          self.ObjectStore.Save(self.insight_key, f'[{content}]')
    7. At the bottom of the Initialize method, read the Insight objects from the Object Store and add them to the Insight Manager .
    8. if (ObjectStore.ContainsKey(_insightKey))
      {
          var insights = ObjectStore.ReadJson<List<Insight>>(_insightKey);
          Insights.AddRange(insights);
      }
      if self.ObjectStore.ContainsKey(self.insight_key):
          insights = self.ObjectStore.ReadJson[List[Insight]](self.insight_key)
          self.Insights.AddRange(insights)

    The following algorithm provides a full example of preserving the Insight state between deployments:

     

    15 Parameters

    Introduction

    Parameters are project variables that your algorithm uses to define the value of internal variables like indicator arguments or the length of lookback windows. Parameters are stored outside of your algorithm code, but we inject the values of the parameters into your algorithm when you run a backtest, deploy a live algorithm, or launch an optimization job. To use parameters, set some parameters in your project and then load them into your algorithm.

    Set Parameters

    The process to set parameter values depends on the environment you use to write algorithms. See the tutorial in one of the following environments:

    Get Parameters

    To get a parameter value into your algorithm, call the GetParameter method of the algorithm class.

    var parameterValue = GetParameter("parameterName");
    parameter_value = self.GetParameter("parameterName")

    The GetParameter method returns a string by default. If you provide a default parameter value, the method returns the parameter value as the same data type as the default value. If there are no parameters in your project that match the name you pass to the method and you provide a default value to the method, it returns the default value. The following table describes the arguments the GetParameter method accepts:

    Argument Data Type Description Default Value
    name string str The name of the parameter to get
    defaultValue string/int/double/decimal str/int/double The default value to return null None

    The following example algorithm gets the values of parameters of each data type:

    namespace QuantConnect.Algorithm.CSharp
    {
        public class ParameterizedAlgorithm : QCAlgorithm
        {
            public override void Initialize()
            {
                // Get the parameter value and return an integer
                var intParameterValue = GetParameter("<intParameterName>", 100);
    
                // Get the parameter value and return a double
                var doubleParameterValue = GetParameter("<doubleParameterName>", 0.95);
    
                // Get the parameter value and return a decimal
                var decimalParameterValue = GetParameter("<decimalParameterName>", 0.05m);
    
                // Get the parameter value as a string
                var stringParameterValue = GetParameter("<parameterName>", "defaultStringValue")
    
                // Cast it to an integer
                var castedParameterValue = Convert.ToInt32(stringParameterValue);
            }
        }
    }
    class ParameterizedAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            # Get the parameter value and return an integer
            int_parameter_value = self.GetParameter("<int_parameter_name>", 100)
    
            # Get the parameter value and return a double
            float_parameter_value = self.GetParameter("<float_parameter_name>", 0.95)
    
            # Get the parameter value as a string
            string_parameter_value = self.GetParameter("<parameter_name>", "default_string_value")
    
            # Cast it to an integer
            parameter_value = int(string_parameter_value)

    Alternatively, you can use the Parameter(name) attribute on top of class fields or properties to set their values. If there are no parameters in your project that match the name you pass to the attribute and you provide a default value to the method, it returns the default value.

    namespace QuantConnect.Algorithm.CSharp
    {
        public class ParameterizedAlgorithm : QCAlgorithm
        {
            [Parameter("<intParameterName>")]
            public int IntParameterValue = 100;
    
            [Parameter("<doubleParameterName>")]
            public double DoubleParameterValue = 0.95;
    
            [Parameter("<decimalParameterName>")]
            public decimal DecimalParameterValue = 0.05m;
        }
    }

    The parameter values are sent to your algorithm when you deploy the algorithm, so it's not possible to change the parameter values while the algorithm runs.

    Overfitting

    Overfitting occurs when a function is fit too closely fit to a limited set of training data. Overfitting can occur in your trading algorithms if you have many parameters or select parameters values that worked very well in the past but are sensitive to small changes in their values. In these cases, your algorithm will likely be fine-tuned to fit the detail and noise of the historical data to the extent that it negatively impacts the live performance of your algorithm. The following image shows examples of underfit, optimally-fit, and overfit functions:

    Overfitting an optimization job

    An algorithm that is dynamic and generalizes to new data is more likely to survive across different market conditions and apply to other markets.

    Look-Ahead Bias

    Look-ahead bias occurs when an algorithm makes decisions using data that would not have yet been available. For instance, in optimization jobs, you optimize a set of parameters over a historical backtesting period. After the optimizer finds the optimal parameter values, the backtest period becomes part of the in-sample data. If you run a backtest over the same period using the optimal parameters, look-ahead bias has seeped into your research. In reality, it would not be possible to know the optimal parameters during the testing period until after the testing period is over. To avoid issues with look-ahead bias, optimize on older historical data and test the optimal parameter values on recent historical data. Alternatively, apply walk forward optimization to optimize the parameters on smaller batches of history.

    Live Trading Considerations

    To update parameters in live mode, add a Schedule Event that downloads a remote file and uses its contents to update the parameter values.

    private Dictionary _parameters = new();
    public override void Initialize()
    {
        if (LiveMode)
        {
            Schedule.On(
                DateRules.EveryDay(),
                TimeRules.Every(TimeSpan.FromMinutes(1)),
                ()=>
                {
                    var content = Download(urlToRemoteFile);
                    // Convert content to _parameters
                });
        }
    }
    def Initialize(self):
        self.parameters = { }
        if self.LiveMode:
            def download_parameters():
                content = self.Download(url_to_remote_file)
                # Convert content to self.parameters
    
            self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.Every(timedelta(minutes=1)), download_parameters)
    

    Examples

    The following example algorithm demonstrates loading parameter values with the GetParameter method :

    namespace QuantConnect.Algorithm.CSharp
    {
        public class ParameterizedAlgorithm : QCAlgorithm
        {
            private ExponentialMovingAverage _fast;
            private ExponentialMovingAverage _slow;
        
            public override void Initialize()
            {
                SetStartDate(2020, 1, 1);
                SetCash(100000);
                AddEquity("SPY");
        
                var fastPeriod = GetParameter("ema-fast", 100);
                var slowPeriod = GetParameter("ema-slow", 200);
        
                _fast = EMA("SPY", fastPeriod);
                _slow = EMA("SPY", slowPeriod);
            }
        }
    }
    class ParameterizedAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2020, 1, 1)
            self.SetCash(100000)
            self.AddEquity("SPY")
        
            fast_period = self.GetParameter("ema-fast", 100)
            slow_period = self.GetParameter("ema-slow", 200)
        
            self._fast = self.EMA("SPY", fast_period)
            self._slow = self.EMA("SPY", slow_period)

    The following example algorithm demonstrates loading parameter values with the Parameter attribute:

    namespace QuantConnect.Algorithm.CSharp
    {
        public class ParameterizedAlgorithm : QCAlgorithm
        {
            [Parameter("ema-fast")]
            public int FastPeriod = 100;
    
            [Parameter("ema-slow")]
            public int SlowPeriod = 200;
    
            private ExponentialMovingAverage _fast;
            private ExponentialMovingAverage _slow;
            
            public override void Initialize()
            {
                SetStartDate(2020, 1, 1);
                SetCash(100000);
                AddEquity("SPY");
            
                _fast = EMA("SPY", FastPeriod);
                _slow = EMA("SPY", SlowPeriod);
            }
        }
    }
    Demonstration Algorithms
    ParameterizedAlgorithm.py Python ParameterizedAlgorithm.cs C#

     

    16 Machine Learning

    16.1 Key Concepts

    Introduction

    Machine learning is a field of study that combines statistics and computer science to build intelligent systems that predict outcomes. You can use machine learning techniques in your trading strategies.

    Supported Libraries

    LEAN supports several machine learning libraries. You can import these packages and use them in your algorithms.

    Name Version Language Import Statement Example
    TensorFlow 2.11.0 Python import tensorflow
    SciKit Learn 1.2.1 Python import sklearn
    Py Torch 1.13.1 Python import torch
    Keras 2.11.0 Python import keras
    gplearn 0.4.2 Python import gplearn
    hmmlearn 0.2.8 Python import hmmlearn
    tsfresh 0.20.0 Python import tsfresh
    Stable-Baselines3 1.7.0 Python from stable_baselines3 import *
    fastai 2.7.11 Python import fastai
    Deap 1.3.3 Python import deap
    XGBoost 1.7.4 Python import xgboost
    mlfinlab 1.6.0 Python import mlfinlab
    Accord 3.6.0 C# using Accord.MachineLearning;

    Add New Libraries

    To request a new library, contact us . We will add the library to the queue for review and deployment. Since the libraries run on our servers, we need to ensure they are secure and won't cause harm. The process of adding new libraries takes 2-4 weeks to complete. View the list of libraries currently under review on the Issues list of the Lean GitHub repository .

    Save Models

    After you train a model, you can save it into the Object Store . In QuantConnect Cloud, we back up your Object Store data on QuantConnect servers. In local algorithms, your local machine saves the Object Store data. If you save models in live algorithms, save them at the end of the training method so you can access the trained model again if your algorithm stops executing. If you save models in backtests, save them during the OnEndOfAlgorithm event handler so that saving multiple times doesn't slow down your backtest.

    To view examples of storing library-specific models, see Popular Libraries .

    Load Models

    You can load machine learning models from the Object Store or a custom data file like pickle. If you load models from the Object Store, before you load the model into your algorithm, in the Initialize method, check if the Object Store already contains the model. To avoid look-ahead bias in backtests, don't train your model on the same data you use to test the model.

     

    16.2 Training Models

    Introduction

    Algorithms usually must process each timeslice within 10 minutes, but the Train method allows you to increase this time to train machine learning models. The length of time you can train depends on your training quotas.

    Train Models

    To train models immediately, call the Train method and pass in the name of your training method.

    Train(MyTrainingMethod);
    self.Train(self.MyMethod)

    Immediate training is most useful for training your model when you first deploy your strategy to production or when the model's performance begins to degrade.

    Schedule Training Sessions

    You can schedule model training sessions in a similar way to a Scheduled Event. To schedule a training session do this, pass in a DateRules and TimeRules argument to the Train method.

    // Set TrainingMethod to be executed at 8:00 am every Sunday
    Train(DateRules.Every(DayOfWeek.Sunday), TimeRules.At(8, 0), MyTrainingMethod);
    # Set TrainingMethod to be executed at 8:00 am every Sunday
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8,0), self.MyTrainingMethod)

    We recommend you schedule your training sessions for when the market is closed to get the best compute allocation. While the market is open, your CPU is occupied with processing incoming tick data and handling other LEAN events.

    Training Quotas

    Training resources are allocated with a leaky bucket algorithm where you can use a maximum of n-minutes in a single training session and the number of available minutes refills over time. This design gives you burst allocations when you need them and recharges the allowance to prepare for the next training.

    Cloud Quotas

    If you execute algorithms in QuantConnect Cloud, see Training Quotas for more information about the training quotas.

    Local Quotas

    If you execute algorithms locally, the following table shows the default settings for the leaky bucket algorithm:

    Setting Value
    Capacity (minutes)
    120
    Time interval (minutes) 1440
    Refill amount (minutes per time interval)
    Capacity / 7

    To allow virtually unlimited training for local algorithms, add the following key-value pairs to your Lean / Launcher / config.json file:

    "scheduled-event-leaky-bucket-capacity" : 99999999,
    "scheduled-event-leaky-bucket-time-interval-minutes" : 1,
    "scheduled-event-leaky-bucket-refill-amount": 999999,

    Check Model Readiness

    In backtests, the Train method is synchronous, so it blocks your algorithm execution while the model trains. In live trading, the Train method is asynchronous, so ensure your model is trained before you continue the algorithm execution. Training occurs on a separate thread, so set a boolean flag to notify your algorithm of the model state. A semaphore is a thread-safe flag you can use to synchronize program operations across different threads.

    class SemaphoreTrainingAlgorithm(QCAlgorithm):
    
        # Model Object
        model = None
        # Model State Flag
        model_is_training = False
    
        def Initialize(self) -> None: 
            self.Train(self.my_training_method)
        
        def my_training_method(self) -> None: 
            self.model_is_training = True
            # Perform Work
            self.model_is_training = False
        
        def OnData(self, slice: Slice) -> None: 
            # Do not use model while it is being trained.
            if self.model_is_training:
                return
            
            # Once training is complete; use the model safely.
            result = self.model.Predict()
    
    public class SemaphoreTrainingAlgorithm : QCAlgorithm
    {
        // Model Object
        private MachineLeaningModel _model;
        // Model State Flag
        private bool _modelIsTraining;
    
        public override void Initialize()
        {
            Train(MyTrainingMethod);
        }
    
        private void MyTrainingMethod()
        {
            _modelIsTraining = true;
            // Perform Work
            _modelIsTraining = false;
        }
    
        public override void OnData(Slice slice)
        {
            // Do not use model while it is being trained.
            if (_modelIsTraining)
            {
                return;
            }
            // Once training is complete; use the model safely.
            var result = _model.Predict();
        }
    }

    Examples

    Demonstration Algorithms
    TrainingExampleAlgorithm.py Python TrainingExampleAlgorithm.cs C#

     

    16.3 Popular Libraries

    These are examples of using some of the most common machine learning libraries in an algorithm. Click one to learn more.

     

    16.3.1 GPlearn

    Introduction

    This page explains how to build, train, deploy and store GPlearn models.

    Import Libraries

    Import the gplearn and joblib libraries.

    from AlgorithmImports import *
    from gplearn.genetic import SymbolicRegressor, SymbolicTransformer
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the GPLearn model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a genetic programming feature transformation model and a genetic programming regression prediction model using the following features and labels:

    Data Category Description
    Features Daily percent change of the close price of the SPY over the last 5 days
    Labels Daily percent return of the SPY over the next day

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Follow these steps to create a method to build the model:

    1. Declare a set of functions to use for feature engineering.
    2. function_set = ['add', 'sub', 'mul', 'div',
                      'sqrt', 'log', 'abs', 'neg', 'inv',
                      'max', 'min']
    3. Call the SymbolicTransformer constructor with the preceding set of functions and then save it as a class variable.
    4. self.gp_transformer = SymbolicTransformer(function_set=function_set)
    5. Call the SymbolicRegressor constructor to instantiate the regression model.
    6. self.model = SymbolicRegressor()

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[float](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar.Close)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        training_df = list(self.training_data)[::-1]
        daily_pct_change = ((np.roll(training_df, -1) - training_df) / training_df)[:-1]
    
        features = []
        labels = []
        for i in range(len(daily_pct_change)-n_steps):
            features.append(daily_pct_change[i:i+n_steps])
            labels.append(daily_pct_change[i+n_steps])
        features = np.array(features)
        labels = np.array(labels)
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
    
        # Feature engineering
        self.gp_transformer.fit(features, labels)
        gp_features = self.gp_transformer.transform(features)
        new_features = np.hstack((features, gp_features))
    
        # Fit the regression model with transformed and raw features.
        self.model.fit(new_features, labels)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current close price to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol].Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features, _ = self.get_features_and_labels()
    
    # Get transformed features
    gp_features = self.gp_transformer.transform(features)
    new_features = np.hstack((features, gp_features))
    
    # Get next prediction
    prediction = self.model.predict(new_features)
    prediction = float(prediction.flatten()[-1])

    You can use the label prediction to place orders.

    if prediction > 0:
        self.SetHoldings(self.symbol, 1)
    elif prediction < 0:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save GPLearn models into the ObjectStore :

    1. Set the key names you want to store the models under in the ObjectStore.
    2. transformer_model_key = "transformer"
      regressor_model_key = "regressor"
    3. Call the GetFilePath method with the keys.
    4. transformer_file_name = self.ObjectStore.GetFilePath(transformer_model_key)
      regressor_file_name = self.ObjectStore.GetFilePath(regressor_model_key)

      This method returns the file paths where the models will be stored.

    5. Call the dump method the file paths.
    6. joblib.dump(self.gp_transformer, transformer_file_name)
      joblib.dump(self.model, regressor_file_name)

      If you dump the models using the joblib module before you save the models, you don't need to retrain the models.

    Load Models

    You can load and trade with pre-trained GPLearn models that you saved in the ObjectStore. To load a GPLearn model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(transformer_model_key) and self.ObjectStore.ContainsKey(regressor_model_key):
            transformer_file_name = self.ObjectStore.GetFilePath(transformer_model_key)
            regressor_file_name = self.ObjectStore.GetFilePath(regressor_model_key)
            self.gp_transformer = joblib.load(transformer_file_name)
            self.model = joblib.load(regressor_file_name)

    The ContainsKey method returns a boolean that represents if transformer_model_key and regressor_model_key are in the ObjectStore. If the ObjectStore does not contain the keys, save the model using them before you proceed.

    Clone Example Algorithm

     

    16.3.2 Hmmlearn

    Introduction

    This page explains how to build, train, deploy and store Hmmlearn models.

    Import Libraries

    Import the hmmlearn and joblib libraries.

    from AlgorithmImports import *
    from hmmlearn import hmm
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the hmmlearn model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, assume the market has only 2 regimes and the market returns follow a Gaussian distribution. Therefore, create a 2-component Hidden Markov Model with Gaussian emissions, which is equivalent to a Gaussian mixture model with 2 means.

    To build the model, call the GaussianHMM constructor with the number of components, a covariance type, and the number of iterations:

    self.model = hmm.GaussianHMM(n_components=2, covariance_type="full", n_iter=100)

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[float](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar.Close)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features(self):
        training_df = np.array(list(self.training_data)[::-1])
        daily_pct_change = (np.roll(training_df, 1) - training_df) / training_df
    
        return daily_pct_change[1:].reshape(-1, 1)
    
    def my_training_method(self):
        features = self.get_features()
        self.model.fit(features)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current close price to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol].Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    new_feature = self.get_features()
    prediction = self.model.predict(new_feature)
    prediction = float(prediction[-1])

    You can use the label prediction to place orders.

    if prediction == 1:
        self.SetHoldings(self.symbol, 1)
    else:            
        self.Liquidate(self.symbol)

    Save Models

    Follow these steps to save hmmlearn models into the ObjectStore :

    1. Set the key name you want to store the model under in the ObjectStore.
    2. model_key = "model.hmm"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the dump method the file path.
    6. joblib.dump(self.model, file_name)

      If you dump the model using the joblib module before you save the model, you don't need to retrain the model.

    Load Models

    You can load and trade with pre-trained hmmlearn models that you saved in the ObjectStore. To load a hmmlearn model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = joblib.load(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.3 Keras

    Introduction

    This page explains how to build, train, deploy and store Keras models.

    Import Libraries

    Import the keras libraries.

    from AlgorithmImports import *
    from tensorflow.keras.models import Sequential, load_model
    from tensorflow.keras.layers import Dense, Flatten
    from tensorflow.keras.optimizers import Adam

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the keras model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a neural-network regression model that uses the following features and labels:

    Data Category Description
    Features Daily percent change of the open, high, low, close, and volume of the SPY over the last 5 days
    Labels Daily percent return of the SPY over the next day

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Follow the below steps to build the model:

    1. In the Initialize method, create a Sequential object with several layers.
    2. self.model = Sequential([Dense(10, input_shape=(5,5), activation='relu'),
                               Dense(10, activation='relu'),
                               Flatten(),
                               Dense(1)])

      Set the input_shape of the first layer to (5, 5) because each sample contains the percent change of 5 factors (percent change of the open, high, low, close, and volume) over the previous 5 days. Call the Flatten constructor because the input is 2-dimensional but the output is just a single value.

    3. Call the compile method with a loss function, an optimizer, and a list of metrics to monitor.
    4. self.model.compile(loss='mse',
                         optimizer=Adam(),
                         metrics=['mae', 'mse'])

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[TradeBar](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        training_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.training_data)[::-1])
        daily_pct_change = training_df.pct_change().dropna()
    
        features = []
        labels = []
        for i in range(len(daily_pct_change)-n_steps):
            features.append(daily_pct_change.iloc[i:i+n_steps].values)
            labels.append(daily_pct_change['close'].iloc[i+n_steps])
        features = np.array(features)
        labels = np.array(labels)
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
        self.model.fit(features, labels, epochs=5)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol])

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features, _ = self.get_features_and_labels()
    features = features[-1].reshape(1, 5, 5)
    prediction = float(self.model.predict(features)[-1])

    You can use the label prediction to place orders.

    if prediction > 0:
        self.SetHoldings(self.symbol, 1)
    elif prediction < 0:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save keras models into the ObjectStore :

    1. Set the key name you want to store the model under in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the save method with the file path.
    6. self.model.save(file_name)

    Load Models

    You can load and trade with pre-trained keras models that you saved in the ObjectStore. To load a keras model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load_model method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = load_model(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.4 MlFinLab

    Introduction

    MlFinLab is a collection of production-ready algorithms (from the best journals and graduate-level textbooks), packed into a python library that enables portfolio managers and traders who want to leverage the power of machine learning by providing reproducible, interpretable, and easy to use tools. It covers every step of the machine learning strategy creation starting from data structures generation and finishing with backtest statistics.

    The mission of Hudson and Thames is to promote the scientific method within investment management by codifying frameworks, algorithms, and best practices to build the world’s central repository of ready to use implementations and intellectual property. For more information, see the Hudson and Thames website . The Hudson and Thames environment, which includes the MlFinLab library, is currently only available in QuantConnect Cloud.

    Import Libraries

    Follow these steps to import the mlfinlab library:

    1. Open a project .
    2. In the Project panel, click the LEAN Environment field and then click Hudson & Thames from the drop-down menu.
    3. Open one of the code files in your project.
    4. At the top of the code file, add the following snippet:
      import ht_auth
      ht_auth.SetToken("<mlfinlab_api_key>")
      import mlfinlab as ml

    MlFinLab costs £100 (+VAT) per month, per user. Follow these steps to get your API key:

    1. Create a profile on the Hudson & Thames website and log in.
    2. On the dashboard page under MlFinLab, click Buy .
    3. On the MlFinLab page, click Buy .
    4. In the Terms of Use window, accept the terms of use and then click Purchase .
    5. In the Purchase MlFinLab window, enter your payment card details and then click Subscribe Now .
    6. Wait for the success window to display.
    7. On the dashboard page, under MlFinLab, click View .
    8. On the MlFinLab page, click Copy API Key .

    Financial Data Structures

    Transform unstructured data sets into structured tick, volume, and dollar bars as well as the less common information-driven bars. With MlFinLab you can even generate bars on the go with our online data structures framework. For more information about data structures, see Standard Bars in the MlFinLab documentation.

    Labeling Techniques

    MlFinLab provides a comprehensive list of labeling techniques, including the following: Raw Returns, Fixed Horizon, Triple-Barrier & Meta-Labeling, and many more. For more information about labeling, see Labeling in the MlFinLab documentation.

    Feature Engineering

    This section of MlFinLab contains several important tools to manipulate, select and transform raw data into useful features. Feature engineering techniques you can use include: Fractionally Differentiated Features, Structural Breaks, Volatility Estimators, and even Automatic Feature Extraction. For more information about feature engineering, see Feature Importance in the MlFinLab documentation.

    Bet Sizing

    This section will allow you to optimally size your bets to improve returns or limit downside metrics in alignment with your risk preferences. Methods include Kelly Criterion, EF3M and dynamic bet sizes. For more information about bet sizing, see Bet Sizing in the MlFinLab documentation.

    Codependence Measures

    Improve your strategies by taking into account measures of codependence between assets in MlFinLab. Choose between correlation-based, information theory and copula-based metrics. For more information about codependence measures, see Measures of Codependence in the MlFinLab documentation.

    Generate Sythetic Data

    Generate data that simulate important events for example, flash crashes, world-wide economic crises, global pandemics, etc. to assess if an algorithm will fare well for any event. Having an abundance of realistic financial data has never been easier with MlFinLab. Examples of financial data that can be generated include stock prices, stock returns, correlation matrices, retail banking data, and all kinds of market microstructure data. For more information about synthetic data, see Synthetic Data Generation in the MlFinLab documentation.

    Clustering Techniques

    Discover a wide range of clustering techniques at your fingertips to improve the credibility of your investment strategy. MlFinLab offers both hierarchical clustering techniques and the ability to determine the optimal number of clusters. For more information about clustering techniques, see Clustering in the MlFinLab documentation.

    Networks Modeling

    Creates beautiful and informative visualizations of financial data, using network theory to describe complex systems such as financial markets. Use graphs such as a Minimum Spanning Tree, creating a mini Flask server using Plotly’s Dash to display the interactive graphs with MlFinLab. For more information about networks modeling, see Networks in the MlFinLab documentation.

    Example Algorithm

    The following example algorithm demonstrates how to use the mlfinlab library. The algorithm uses the trend_scanning_labels method to determine the trend direction of the Bitcoin-USD pair. If Bitcoin is in an uptrend, the algorithm allocations 100% of the portfolio to Bitcoin. Otherwise, it holds USD. The algorithm achieves a 1.79 Sharpe ratio, outperforming Bitcoin buy-and-hold, which achieves a 1.26 Sharpe ratio over the same time period.

    Support

    After you purchase MlFinLab, you get access to the Hudson and Thames Slack Community, where you and other quants can answer questions. Hudson and Thames also provide support under consulting.

    FAQs

    Note the following frequently asked questsions.

    How do I install MlFinLab on QuantConnect?

    To use MlFinLab on QuantConnect, see Import Libraries .

    How do I install MlFinLab on my local machine?

    To use MlFinLab on your local machine, see the Client Documentation that Hudson & Thames provides to avoid dependency issues. You receive the MlFinLab Client documentation after your purchase is successful.

    Are the Jupyter Notebooks downloadable?

    Yes, you can access the notebooks via the Client Documentation and download them.

    Does Hudson & Thames provide support?

    Yes, they provide support under consulting and you can ask their community on Slack if you have a question.

     

    16.3.5 PyTorch

    Introduction

    This page explains how to build, train, deploy and store PyTorch models.

    Import Libraries

    Import the torch and joblib libraries.

    from AlgorithmImports import *
    import torch
    from torch import nn
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the torch model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a neural-network regression model that uses the following features and labels:

    Data Category Description
    Features The last 5 closing prices.
    Labels The following day's closing price

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Follow these steps to create a method to build the model:

    1. Define a subclass of nn.Module to be the model.
    2. In this example, use the ReLU activation function for each layer.

      class NeuralNetwork(nn.Module):
          # Model Structure
          def __init__(self):
              super(NeuralNetwork, self).__init__()
              self.flatten = nn.Flatten()
              self.linear_relu_stack = nn.Sequential(
                  nn.Linear(5, 5),   # input size, output size of the layer
                  nn.ReLU(),         # Relu non-linear transformation
                  nn.Linear(5, 5),
                  nn.ReLU(),  
                  nn.Linear(5, 1),   # Output size = 1 for regression
              )
          
          # Feed-forward training/prediction
          def forward(self, x):
              x = torch.from_numpy(x).float()   # Convert to tensor in type float
              result = self.linear_relu_stack(x)
              return result
    3. Create an instance of the model and set its configuration to train on the GPU if it's available.
    4. device = 'cuda' if torch.cuda.is_available() else 'cpu'
      self.model = NeuralNetwork().to(device)

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[float](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar.Close)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        close_prices = list(self.training_data)[::-1]
    
        features = []
        labels = []
        for i in range(len(close_prices)-n_steps):
            features.append(close_prices[i:i+n_steps])
            labels.append(close_prices[i+n_steps])
        features = np.array(features)
        labels = np.array(labels)
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
    
        # Set the loss and optimization functions
        # In this example, use the mean squared error as the loss function and stochastic gradient descent as the optimizer
        loss_fn = nn.MSELoss()
        learning_rate = 0.001
        optimizer = torch.optim.SGD(self.model.parameters(), lr=learning_rate)
        
        # Create a for-loop to train for preset number of epoch
        epochs = 5
        for t in range(epochs):
            # Create a for-loop to fit the model per batch
            for batch, (feature, label) in enumerate(zip(features, labels)):
                # Compute prediction and loss
                pred = self.model(feature)
                real = torch.from_numpy(np.array(label).flatten()).float()
                loss = loss_fn(pred, real)
            
                # Perform backpropagation
                optimizer.zero_grad()
                loss.backward()
                optimizer.step()

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol].Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and pass it to the model.

    features, __ = self.get_features_and_labels()
    prediction = self.model(features[-1].reshape(1, -1))
    prediction = float(prediction.detach().numpy()[-1])

    You can use the label prediction to place orders.

    if prediction > slice[self.symbol].Price:
        self.SetHoldings(self.symbol, 1)
    elif prediction < slice[self.symbol].Price:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save PyTorch models into the ObjectStore :

    1. Set the key name of the model to be stored in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the dump method the file path.
    6. joblib.dump(self.model, file_name)

      If you dump the model using the joblib module before you save the model, you don't need to retrain the model.

    Load Models

    You can load and trade with pre-trained PyTorch models that you saved in the ObjectStore. To load a PyTorch model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = joblib.load(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.6 Scikit-Learn

    Introduction

    This page explains how to build, train, deploy and store Scikit-Learn models.

    Import Libraries

    Import the sklearn and joblib libraries.

    from AlgorithmImports import *
    from sklearn.svm import SVR
    from sklearn.model_selection import GridSearchCV
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the sklearn model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a support vector regression prediction model that uses the following features and labels:

    Data Category Description
    Features Daily percent change of the open, high, low, close, and volume of the SPY over the last 5 days
    Labels Daily percent return of the SPY over the next day

    The following image shows the time difference between the features and labels:

    Features and labels for training

    To build the model, call the GridSearchCV constructor with the SVR model, the parameter grid, a scoring method, the number of cross-validation folds:

    param_grid = {'C': [.05, .1, .5, 1, 5, 10], 
                'epsilon': [0.001, 0.005, 0.01, 0.05, 0.1], 
                'gamma': ['auto', 'scale']}
    self.model = GridSearchCV(SVR(), param_grid, scoring='neg_mean_squared_error', cv=5)

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[TradeBar](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        training_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.training_data)[::-1])
        daily_pct_change = training_df.pct_change().dropna()
    
        features = []
        labels = []
        for i in range(len(daily_pct_change)-n_steps):
            features.append(daily_pct_change.iloc[i:i+n_steps].values.flatten())
            labels.append(daily_pct_change['close'].iloc[i+n_steps])
        features = np.array(features)
        labels = np.array(labels)
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
        self.model = self.model.fit(features, labels).best_estimator_

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol])

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features, _ = self.get_features_and_labels()
    prediction = self.model.predict(features[-1].reshape(1, -1))
    prediction = float(prediction)

    You can use the label prediction to place orders.

    if prediction > 0:
        self.SetHoldings(self.symbol, 1)
    elif prediction < 0:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save sklearn models into the ObjectStore :

    1. Set the key name you want to store the model under in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the dump method the file path.
    6. joblib.dump(self.model, file_name)

      If you dump the model using the joblib module before you save the model, you don't need to retrain the model.

    Load Models

    You can load and trade with pre-trained sklearn models that you saved in the ObjectStore. To load a sklearn model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = joblib.load(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.7 Stable Baselines

    Introduction

    This page explains how to build, train, deploy and store stable baselines 3 models.

    Import Libraries

    Import the gym and stable_baselines3 libraries.

    from AlgorithmImports import *
    import gym
    from stable_baselines3 import DQN

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the stable_baselines model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, create a gym environment to initialize the training environment, agent, and reward. Then, create a reinforcement learning model by a single-asset deep Q-network learning algorithm using the following observations and rewards:

    Data Category Description
    Observations The 5-day open, high, low, close, and volume (OHLCV) of the SPY
    Rewards Maximum portfolio return

    Follow these steps to create a method to build the model:

    1. Create a custom gym environment class.
    2. In this example, create a custom environment with the previous 5 OHLCV log-return data as observation and the highest portfolio value as reward.

      class TradingEnv(gym.Env):
          FLAT = 0
          LONG = 1
          SHORT = 2
      
          def __init__(self, ohlcv, ret):
              super(TradingEnv, self).__init__()
              
              self.ohlcv = ohlcv
              self.ret = ret
              self.trading_cost = 0.01
              self.reward = 1
              
              # The number of step the training has taken, starts at 5 since we're using the previous 5 data for observation.
              self.current_step = 5
              # The last action
              self.last_action = 0
      
              # Define action and observation space
              # Example when using discrete actions, we have 3: LONG, SHORT and FLAT.
              n_actions = 3
              self.action_space = gym.spaces.Discrete(n_actions)
              # The observation will be the coordinate of the agent, shape for (5 previous data poionts, OHLCV)
              self.observation_space = gym.spaces.Box(low=-2, high=2, shape=(5, 5, 5), dtype=np.float64)
      
          def reset(self):
              # Reset the number of step the training has taken
              self.current_step = 5
              # Reset the last action
              self.last_action = 0
              # must return np.array type
              return self.ohlcv[self.current_step-5:self.current_step].astype(np.float32)
      
          def step(self, action):
              if action == self.LONG:
                  self.reward *= 1 + self.ret[self.current_step] - (self.trading_cost if self.last_action != action else 0)
              elif action == self.SHORT:
                  self.reward *= 1 + -1 * self.ret[self.current_step] - (self.trading_cost if self.last_action != action else 0)
              elif action == self.FLAT:
                      self.reward *= 1 - (self.trading_cost if self.last_action != action else 0)
              else:
                  raise ValueError("Received invalid action={} which is not part of the action space".format(action))
                  
              self.last_action = action
              self.current_step += 1
      
              # Have we iterate all data points?
              done = (self.current_step == self.ret.shape[0]-1)
      
              # Reward as return
              return self.ohlcv[self.current_step-5:self.current_step].astype(np.float32), self.reward, done, {}
    3. Get the processed training data.
    4. obs, rewards = self.get_observations_and_rewards()
    5. Initialize the environment with the observations and results.
    6. self.env = TradingEnv(obs, rewards)
    7. Call the DQN constructor with the learning policy and the gym environment.
    8. self.model = DQN(MlpPolicy, env)

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[TradeBar](training_length)
    history = self.History[TradeBar](self.spy, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_observations_and_rewards(self, n_step=5):
        training_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.training_data)[::-1])
        daily_pct_change = training_df['close'].pct_change().dropna()
    
        obs = []
        rewards = []
        for i in range(len(daily_pct_change)-n_step):
            obs.append(training_df.iloc[i:i+n_step].values)
            rewards.append(float(daily_pct_change.iloc[i+n_step]))
        obs = np.array(obs)
        rewards = np.array(rewards)
    
        return obs, rewards
    
    def my_training_method(self):
        obs, rewards = self.get_observations_and_rewards()
        self.env = TradingEnv(obs, rewards)
        self.model = DQN("MlpPolicy", self.env)
        self.model.learn(total_timesteps=500)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol])

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features, _ = self.get_observations_and_rewards()
    action, _ = self.model.predict(features[-5:], deterministic=True)
    _, _, _, _ = self.env.step(action)

    You can use the label prediction to place orders.

    if action == 0:
        self.Liquidate(self.spy)
    elif action == 1:
        self.SetHoldings(self.spy, 1)
    elif action == 2:
        self.SetHoldings(self.spy, -1)

    Save Models

    Follow these steps to save stable_baselines models into the ObjectStore :

    1. Set the key name of the model to be stored in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the save method the file path.
    6. self.model.save(file_name)

    Load Models

    You can load and trade with pre-trained keras models that you saved in the ObjectStore. To load a keras model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load_model method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = DQN.load(file_name, env=env)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.8 Tensorflow

    Introduction

    This page explains how to build, train, deploy and store Tensorflow v1 models. To view the tutorial on Tensorflow 2, see Keras .

    Import Libraries

    Import the tensorflow libraries.

    from AlgorithmImports import *
    import tensorflow.compat.v1 as tf
    from google.protobuf import json_format
    import json5
    
    tf.disable_v2_behavior()

    You need the google.protobuf and json5 libraries to store and load models.

    Disable tensorflow v2 behaviors in order to deploy a v1 model.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the tensorflow model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a neural-network regression prediction model that uses the following features and labels:

    Data Category Description
    Features The last 5 closing prices
    Labels The following day's closing price

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Follow these steps to create a method to build the model:

    1. Create a method to build the model for the algorithm class.
    2. def BuildModel(self):    
          # Instantiate a tensorflow session
          sess = tf.Session()
      
          # Declare the number of factors and then create placeholders for the input and output layers.
          num_factors = 5
          X = tf.placeholder(dtype=tf.float32, shape=[None, num_factors], name='X')
          Y = tf.placeholder(dtype=tf.float32, shape=[None])
          
          # Set up the weights and bias initializers for each layer.
          weight_initializer = tf.variance_scaling_initializer(mode="fan_avg", distribution="uniform", scale=1)
          bias_initializer = tf.zeros_initializer()
          
          # Create hidden layers that use the Relu activator.
          num_neurons_1 = 32
          num_neurons_2 = 16
          num_neurons_3 = 8
          
          W_hidden_1 = tf.Variable(weight_initializer([num_factors, num_neurons_1]))
          bias_hidden_1 = tf.Variable(bias_initializer([num_neurons_1]))
          hidden_1 = tf.nn.relu(tf.add(tf.matmul(X, W_hidden_1), bias_hidden_1))
          
          W_hidden_2 = tf.Variable(weight_initializer([num_neurons_1, num_neurons_2]))
          bias_hidden_2 = tf.Variable(bias_initializer([num_neurons_2]))
          hidden_2 = tf.nn.relu(tf.add(tf.matmul(hidden_1, W_hidden_2), bias_hidden_2))
          
          W_hidden_3 = tf.Variable(weight_initializer([num_neurons_2, num_neurons_3]))
          bias_hidden_3 = tf.Variable(bias_initializer([num_neurons_3]))
          hidden_3 = tf.nn.relu(tf.add(tf.matmul(hidden_2, W_hidden_3), bias_hidden_3))
          
          # Create the output layer and give it a name, so it is accessible after saving and loading the model.
          W_out = tf.Variable(weight_initializer([num_neurons_3, 1]))
          bias_out = tf.Variable(bias_initializer([1]))
          output = tf.transpose(tf.add(tf.matmul(hidden_3, W_out), bias_out), name='outer')
          
          # Set up the loss function and optimizers for gradient descent optimization and backpropagation.
          # This example uses mean-square error as the loss function because the close price is a continuous data and uses Adam as the optimizer because of its adaptive step size.
          loss = tf.reduce_mean(tf.squared_difference(output, Y))
          optimizer = tf.train.AdamOptimizer().minimize(loss)
          
          return sess, X, Y, output, optimizer
    3. Instantiate the model, input layers, output layer, and optimizer and then save them as class variables.
    4. self.model, self.X, self.Y, self.output, self.optimizer = self.BuildModel(features, labels)
    5. Call the run method with the result from the global_variables_initializer method.
    6. self.model.run(tf.global_variables_initializer())

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[float](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar.Close)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        close_prices = list(self.training_data)[::-1]
        
        features = []
        labels = []
        for i in range(len(close_prices)-n_steps):
            features.append(close_prices[i:i+n_steps])
            labels.append(close_prices[i+n_steps])
        features = np.array(features)
        labels = np.array(labels)
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
        self.model.run(self.optimizer, feed_dict={self.X: features, self.Y: labels})

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current close price to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol].Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the run method with new features.

    new_features, __ = self.get_features_and_labels()
    prediction = self.model.run(self.output, feed_dict={self.X: new_features[-1].reshape(1, -1)})
    prediction = float(prediction.flatten()[-1])

    You can use the label prediction to place orders.

    if prediction > slice[self.symbol].Price:
        self.SetHoldings(self.symbol, 1)
    else:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save Tensorflow models into the ObjectStore :

    1. Export the TensorFlow graph as a JSON object.
    2. graph_definition = tf.compat.v1.train.export_meta_graph()
      json_graph = json_format.MessageToJson(graph_definition)
    3. Export the TensorFlow weights as a JSON object.
    4. weights = self.model.run(tf.compat.v1.trainable_variables())
      weights = [w.tolist() for w in weights]
      json_weights = json5.dumps(weights)
    5. Save the graph and weights to the ObjectStore .
    6. self.ObjectStore.Save('graph', json_graph)
      self.ObjectStore.Save('weights', json_weights)

    Load Models

    You can load and trade with pre-trained tensorflow models that you saved in the ObjectStore. To load a tensorflow model from the ObjectStore, in the Initialize method, get the file path to the saved model and then recall the graph and weights of the model.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey('graph') and self.ObjectStore.ContainsKey('weights'):
            json_graph = self.ObjectStore.Read('graph')
            json_weights = self.ObjectStore.Read('weights')
    
            # Restore the tensorflow graph from JSON objects
            tf.reset_default_graph()
            graph_definition = json_format.Parse(json_graph, tf.MetaGraphDef())
            self.model = tf.Session()
            tf.train.import_meta_graph(graph_definition)
    
            # Select the input, output tensors and optimizer
            self.X = tf.get_default_graph().get_tensor_by_name('X:0')
            self.Y = tf.get_default_graph().get_tensor_by_name('Y:0')
            self.output = tf.get_default_graph().get_tensor_by_name('outer:0')
            self.optimizer = tf.get_default_graph().get_collection('Variable/Adam')
            
            # Restore the model weights from the JSON object.
            weights = [np.asarray(x) for x in json5.loads(json_weights)]
            assign_ops = []
            feed_dict = {}
            vs = tf.trainable_variables()
            zipped_values = zip(vs, weights)
            for var, value in zipped_values:
                value = np.asarray(value)
                assign_placeholder = tf.placeholder(var.dtype, shape=value.shape)
                assign_op = var.assign(assign_placeholder)
                assign_ops.append(assign_op)
                feed_dict[assign_placeholder] = value
            self.model.run(assign_ops, feed_dict=feed_dict)

    The ContainsKey method returns a boolean that represents if the graph and weights is in the ObjectStore. If the ObjectStore does not contain the keys, save the model using them before you proceed.

    Clone Example Algorithm

     

    16.3.9 Tslearn

    Introduction

    This page explains how to build, train, deploy and store Tslearn models.

    Import Libraries

    Import the tslearn libraries.

    from AlgorithmImports import *
    from tslearn.barycenters import softdtw_barycenter
    from tslearn.clustering import TimeSeriesKMeans

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the tslearn model.

    tickers = ["SPY", "QQQ", "DIA", 
               "AAPL", "MSFT", "TSLA", 
               "IEF", "TLT", "SHV", "SHY", 
               "GLD", "IAU", "SLV", 
               "USO", "XLE", "XOM"]
    symbols = [self.AddEquity(ticker, Resolution.Daily).Symbol for ticker in tickers]

    Build Models

    In this example, train a model that clusters the universe of Equities into distinct groups and then allocate an equal portion of the portfolio to each cluster. To cluster the securities, instead of using a real-time comparison, apply Dynamic Time Wrapping Barycenter Averaging (DBA) to their historical prices and then run a k-means clustering algorithm. DBA is a technique of averaging a few time-series into a single one without losing much of their information. Since not all time-series move efficiently like in ideal EMH assumption, this technique allows similarity analysis of different time-series with sticky lags. The following image shows a visualization of the process. For more information about the technical details, see Dynamic Time Warping in the tslearn documentation .

    Dynamic time wraping barycenter averaging visualization

    To perform DBA and then cluster the securities by k-means, create a TimeSeriesKMeans model:

    self.model = TimeSeriesKMeans(n_clusters=6,   # We have 6 main groups
                        metric="dtw")

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252
    self.training_data = {}
    history = self.History(self.symbols, training_length, Resolution.Daily).unstack(0).close
    for symbol in self.symbols:
        self.training_data[symbol] = RollingWindow[float](training_length)
        for close_price in history[symbol]:
            self.training_data[symbol].Add(close_price)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features(self):
        close_price = pd.DataFrame({symbol: list(data)[::-1] for symbol, data in self.training_data.items()})
        log_price = np.log(close_price)
        log_normal_price = (log_price - log_price.mean()) / log_price.std()
    
        return log_normal_price
    
    def my_training_method(self):
        features = self.get_features()
        self.model.fit(features.T.values)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        for kvp in slice.Bars:
            self.training_data[kvp.Key].Add(kvp.Value.Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features = self.get_features()
    self.labels = self.model.predict(features.T.values)

    You can use the label prediction to place orders.

    for i in set(self.labels):
        assets_in_cluster = features.columns[[n for n, k in enumerate(self.labels) if k == i]]
        size = 1/6/len(assets_in_cluster)
        self.SetHoldings([PortfolioTarget(symbol, size) for symbol in assets_in_cluster])

    Save Models

    Follow these steps to save tslearn models into the ObjectStore :

    1. Set the key name of the model to be stored in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the to_hdf5 method with the file path.
    6. self.model.to_hdf5(file_name + ".hdf5")

    Load Models

    You can load and trade with pre-trained tslearn models that saved in ObjectStore. To load a tslearn model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the from_hdf5 method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = TimeSeriesKMeans.from_hdf5(file_name + ".hdf5")

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.10 XGBoost

    Introduction

    This page explains how to build, train, deploy and store XGBoost models.

    Import Libraries

    Import the XGBoost and joblib libraries.

    from AlgorithmImports import *
    import xgboost as xgb
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the xgboost model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a gradient boost tree regression prediction model that uses the following features and labels:

    Data Category Description
    Features The last 5 closing prices
    Labels The following day's closing price

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[float](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar.Close)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        close_prices = np.array(list(self.training_data)[::-1])
        df = (np.roll(close_prices, -1) - close_prices) * 0.5 + close_prices * 0.5
        df = df[:-1]
    
        features = []
        labels = []
        for i in range(len(df)-n_steps):
            features.append(df[i:i+n_steps])
            labels.append(df[i+n_steps])
    
        features = np.array(features)
        labels = np.array(labels)
        features = (features - features.mean()) / features.std()
        labels = (labels - labels.mean()) / labels.std()
    
        d_matrix = xgb.DMatrix(features, label=labels)
    
        return d_matrix
    
    def my_training_method(self):
        d_matrix = self.get_features_and_labels()
        params = {
            'booster': 'gbtree',
            'colsample_bynode': 0.8,
            'learning_rate': 0.1,
            'lambda': 0.1,
            'max_depth': 5,
            'num_parallel_tree': 100,
            'objective': 'reg:squarederror',
            'subsample': 0.8,
          }
        self.model = xgb.train(params, d_matrix, num_boost_round=10)

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol].Close)

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    new_d_matrix = self.get_features_and_labels(df)
    prediction = self.model.predict(new_d_matrix)
    prediction = prediction.flatten()

    You can use the label prediction to place orders.

    if float(prediction[-1]) > float(prediction[-2]):
        self.SetHoldings(self.symbol, 1)
    else:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save xgboost models into the ObjectStore :

    1. Set the key name of the model to be stored in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the dump method the file path.
    6. joblib.dump(self.model, file_name)

      If you dump the model using the joblib module before you save the model, you don't need to retrain the model.

    Load Models

    You can load and trade with pre-trained xgboost models that saved in ObjectStore. To load a xgboost model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = joblib.load(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    16.3.11 Aesera

    Introduction

    This page explains how to build, train, deploy and store Aesera models.

    Import Libraries

    Import the aesera and sklearn libraries.

    from AlgorithmImports import *
    import aesara
    import aesara.tensor as at
    from sklearn.model_selection import train_test_split
    from sklearn.preprocessing import MinMaxScaler
    import joblib

    You need the joblib library to store models.

    Create Subscriptions

    In the Initialize method, subscribe to some data so you can train the sklearn model and make predictions.

    self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol

    Build Models

    In this example, build a logistic regression prediction model that uses the following features and labels:

    Data Category Description
    Features Normalized daily close price of the SPY over the last 5 days
    Labels Return direction of the SPY over the next day

    The following image shows the time difference between the features and labels:

    Features and labels for training

    Follow the below steps to build the model:

    1. Initialize variables.
    2. # Declare Aesara symbolic variables
      x = at.dmatrix("x")
      y = at.dvector("y")
      
      # initialize the weight vector w randomly using share so model coefficients keep their values
      # between training iterations (updates)
      rng = np.random.default_rng(100)
      w = aesara.shared(rng.standard_normal(5), name="w")
      
      # initialize the bias term
      b = aesara.shared(0., name="b")
    3. Construct the model graph.
    4. # Construct Aesara expression graph
      p_1 = 1 / (1 + at.exp(-at.dot(x, w) - b))       # Logistic transformation
      prediction = p_1 > 0.5                          # The prediction thresholded
      xent = y * at.log(p_1) - (1 - y) * at.log(1 - p_1)  # Cross-entropy log-loss function
      cost = xent.mean() + 0.01 * (w ** 2).sum()      # The cost to minimize (MSE)
      gw, gb = at.grad(cost, [w, b])                  # Compute the gradient of the cost
    5. Compile the model.
    6. self.train = aesara.function(
                inputs=[x, y],
                outputs=[prediction, xent],
                updates=((w, w - 0.1 * gw), (b, b - 0.1 * gb)))
      self.predict = aesara.function(inputs=[x], outputs=prediction)

    Train Models

    You can train the model at the beginning of your algorithm and you can periodically re-train it as the algorithm executes.

    Warm Up Training Data

    You need historical data to initially train the model at the start of your algorithm. To get the initial training data, in the Initialize method, make a history request .

    training_length = 252*2
    self.training_data = RollingWindow[TradeBar](training_length)
    history = self.History[TradeBar](self.symbol, training_length, Resolution.Daily)
    for trade_bar in history:
        self.training_data.Add(trade_bar)

    Define a Training Method

    To train the model, define a method that fits the model with the training data.

    def get_features_and_labels(self, n_steps=5):
        training_df = self.PandasConverter.GetDataFrame[TradeBar](list(self.training_data)[::-1])['close']
    
        features = []
        for i in range(1, n_steps + 1):
            close = training_df.shift(i)[n_steps:-1]
            close.name = f"close-{i}"
            features.append(close)
        features = pd.concat(features, axis=1)
        # Normalize using the 5 day interval
        features = MinMaxScaler().fit_transform(features.T).T[4:]
        
        Y = training_df.pct_change().shift(-1)[n_steps*2-1:-1].reset_index(drop=True)
        labels = np.array([1 if y > 0 else 0 for y in Y])   # binary class
    
        return features, labels
    
    def my_training_method(self):
        features, labels = self.get_features_and_labels()
        D = (features, labels)
        self.train(D[0], D[1])

    Set Training Schedule

    To train the model at the beginning of your algorithm, in the Initialize method, call the Train method.

    self.Train(self.my_training_method)

    To periodically re-train the model as your algorithm executes, in the Initialize method, call the Train method as a Scheduled Event .

    # Train the model every Sunday at 8:00 AM
    self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8, 0), self.my_training_method)

    Update Training Data

    To update the training data as the algorithm executes, in the OnData method, add the current TradeBar to the RollingWindow that holds the training data.

    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            self.training_data.Add(slice.Bars[self.symbol])

    Predict Labels

    To predict the labels of new data, in the OnData method, get the most recent set of features and then call the predict method.

    features, _ = self.get_features_and_labels()
    prediction = self.predict(features[-1].reshape(1, -1))
    prediction = float(prediction)

    You can use the label prediction to place orders.

    if prediction == 1:
        self.SetHoldings(self.symbol, 1)
    elif prediction == 0:            
        self.SetHoldings(self.symbol, -1)

    Save Models

    Follow these steps to save sklearn models into the ObjectStore :

    1. Set the key name you want to store the model under in the ObjectStore.
    2. model_key = "model"
    3. Call the GetFilePath method with the key.
    4. file_name = self.ObjectStore.GetFilePath(model_key)

      This method returns the file path where the model will be stored.

    5. Call the dump method the file path.
    6. joblib.dump(self.predict, file_name)

      If you dump the model using the joblib module before you save the model, you don't need to retrain the model.

    Load Models

    You can load and trade with pre-trained sklearn models that you saved in the ObjectStore. To load a sklearn model from the ObjectStore, in the Initialize method, get the file path to the saved model and then call the load method.

    def Initialize(self) -> None:
        if self.ObjectStore.ContainsKey(model_key):
            file_name = self.ObjectStore.GetFilePath(model_key)
            self.model = joblib.load(file_name)

    The ContainsKey method returns a boolean that represents if the model_key is in the ObjectStore. If the ObjectStore does not contain the model_key , save the model using the model_key before you proceed.

    Clone Example Algorithm

     

    17 Algorithm Framework

    17.1 Overview

    Introduction

    Since QuantConnect was formed in 2013, the community has created more than 2 million algorithms. Although they all seek to achieve different results, they can all be abstracted into the same core features. The Algorithm Framework is our attempt to provide this well-defined structure to the community, encouraging good design and making your work more reusable. LEAN provides many pre-built Algorithm Framework models you can use in your algorithms.

    Strategy Styles

    The algorithm framework works best for portfolio rebalancing, ranking, and multi-factor style strategies. The default portfolio construction models are designed to weigh and invest in the assets as the signals values shift, aiming to be fully invested as much as possible.

    Some strategies might find it difficult to fit this model. Technical entry signals are often tightly coupled with their exit criteria, they may not have defined hold periods, and they might follow the market to determine when to exit. This style of strategy can be addressed in a few ways:

    1. Short Term Signals - Emitting insights for short periods until they are no longer valid.
    2. Cancel Signals - Updating an insight's expiry time so that it's expired upon the exit signal.
    3. Alpha Exit Signal - Treating exit as its own signal, a separate Alpha model could indicate exit.
    4. Risk Model - Tracking exit using a risk model that attempts to lock in gains.

    These techniques are still not ideal for many strategies. For example, with only a single signal, the built in EqualWeightingPortfolioConstructionModel will allocate 100% of buying power to a single asset, over concentrating risk. If a second signal comes a few days later, it would sell 50% of the portfolio to free cash and invest in the second asset. This can create high trading costs through portfolio churn.

    With a custom portfolio construction model , signals can mean what you need for your specific strategy style. For example, you might create a " MultiBetPortfolioConstructionModel " that uses each insight to open a specific "bet" that is separately allocated capital and tracked.

    Important Terminology

    The following table defines important Algorithm Framework terminology:

    Term Description
    Universe Selection model A framework module that selects assets for your algorithm.
    Alpha model A framework module that generates trading signals on the assets in your universe.
    Insight An object that represents a trading signal. The Alpha model generates these objects for the Portfolio Construction model.
    Portfolio Construction model A framework module that determines position size targets based on the Insight objects it receives from the Alpha model.
    PortfolioTarget An object that represents the target position size for an asset in the universe. The Portfolio Construction model generates these objects for the Risk Management model.
    Risk Management A framework module that manages market risks and ensures the algorithm remains within target parameters. This model adjusts the PortfolioTarget objects it receives from the Portfolio Construction model before they reach the Execution model.
    Execution A framework module that places trades to reach the target risk-adjust portfolio based on the PortfolioTarget objects it receives from the Risk Management model.

    Framework Advantages

    We recommend you design strategies with the Algorithm Framework in most cases. The Algorithm Framework has many advantages over the classic algorithm design.

    Pluggable Algorithm Modules

    With the Algorithm Framework, your code can instantly utilize all modules built within the framework. The modules clip together in well-defined ways, which enable them to be shared and swapped interchangeably.

    Focus On Your Strengths

    If you write code in modules, you can focus on your strengths. If you are great at building universes, you can build Universe Selection modules. If you have risk management experience, you could write reusable risk monitoring technology.

    Reduce Development By Using Community Modules

    Easily share modules you've made between algorithms or pull in ones produced by the community. The strict separation of duties makes the Algorithm Framework perfect for reusing code between strategies.

    System Architecture

    The Algorithm Framework is built into the QCAlgorithm class, so your strategy can access all the normal methods you use for algorithm development. You should be able to copy and paste your algorithms across without any changes. You don't need a separate class.

    The Algorithm Framework modules communicate w

    The framework data output of each module flows into the following module. The assets that the Universe Selection model selects are fed into the Alpha model to generate trade signals ( Insight objects). The Insight objects from the Alpha model are fed into the Portfolio Construction model to create PortfolioTarget objects, which contain the target number of units to hold for each asset. The PortfolioTarget objects from the Portfolio Construction model are fed into the Risk Management model to ensure the targets are within safe risk parameters and to adjust the PortfolioTarget objects if necessary. The PortfolioTarget objects from the Risk Management model are fed into the Execution model, which efficiently places trades to acquire the target portfolio.

    The flow of data between the Algorithm Framework modules
    public class MyFrameworkAlgorithm : QCAlgorithm 
    { public void Initialize() { SetUniverseSelection(); AddAlpha(); SetPortfolioConstruction(); SetExecution(); AddRiskManagement(); } }
    class MyFrameworkAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetUniverseSelection()
            self.AddAlpha()
            self.SetPortfolioConstruction()
            self.SetExecution()
            self.AddRiskManagement()

    For simple strategies, it may seem like overkill to abstract out your algorithm concepts. However, even simple strategies can benefit from reusing the ecosystem of modules available in QuantConnect. Imagine pairing your EMA-cross Alpha model with a better execution system or plugging in an open-source trailing stop Risk Management model .

    Separation of Concerns

    The separation of concerns principle is an algorithm design principle where individual components are isolated and their responsibilities don't overlap. The Algorithm Framework is designed to uphold this design principle. The individual framework components shouldn't rely on the state of the other framework components in order to operate.

    In the Algorithm Framework, the models should not communicate. The universe constituents and the Insight objects you emit should be the same, regardless of what you select for the Portfolio Construction, Risk Management, and Execution models. If your algorithm logic naturally violates the separation of concerns design principle, it's more appropriate to use the classic or hybrid design .

    Framework vs Classic Design

    Select the classic or Algorithm Framework design based on the needs of your algorithm. If your algorithm uses special order types or passes information between the different algorithm components, use the classic design. If you can reuse existing modules and the Algorithm Framework modules can work in isolation, use the Algorithm Framework design.

     

    17.2 Universe Selection

    17.2.1 Key Concepts

    Introduction

    The Universe Selection model creates Universe objects, which select the assets for your algorithm. As the universe changes, we notify your algorithm through the OnSecuritiesChanged event handler. With this event handler, you can track the current universe constituents in other parts of your algorithm without breaking the separation of concerns design principle.

    Types of Universe Selection

    We have identified several types of universes that cover most people's requirements and built helper classes to make their implementation easier. The following table describes the types of pre-built Universe Selection models:

    Universe Type Description
    Manual Universes Universes that use a fixed, static set of assets
    Fundamental Universes Universes for US Equities that are based on coarse price or fundamental data
    Scheduled Universes Universes that trigger on regular, custom intervals
    Futures Universes Universes that subscribe to Future chains
    Option Universes Universes that subscribe to Option chains

    Add Models

    To add a Universe Selection model, in the Initialize method, call the AddUniverseSelection method.

    var symbols = new [] {QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)};
    AddUniverseSelection(new ManualUniverseSelectionModel(symbols));
    
    symbols = [Symbol.Create("SPY", SecurityType.Equity, Market.USA)]
    self.AddUniverseSelection(ManualUniverseSelectionModel(symbols))

    To view all the pre-built Universe Selection models, see Types of Universe Selection .

    Multi-Universe Algorithms

    You can add multiple Universe Selection models to a single algorithm.

    AddUniverseSelection(new EmaCrossUniverseSelectionModel());
    AddUniverseSelection(new FineFundamentalUniverseSelectionModel(SelectCoarse, SelectFine));
    self.AddUniverseSelection(EmaCrossUniverseSelectionModel())
    self.AddUniverseSelection(FineFundamentalUniverseSelectionModel(self.SelectCoarse, self.SelectFine))
    

    If you add multiple Universe Selection models, the algorithm subscribes to the constituents of all the models.

    Model Structure

    Universe Selection models should extend the UniverseSelectionModel class. Extensions of the UniverseSelectionModel class must implement the CreateUniverses method, which receives an algorithm object and returns an array of Universe objects.

    public class MyUniverseSelectionModel : UniverseSelectionModel
    {
        // Creates the universes for this algorithm
        public override IEnumerable<Universe> CreateUniverses(QCAlgorithm algorithm)
        {
            return new List<Universe>();
        }
    
        // Gets the next time the framework should invoke the `CreateUniverses` method to refresh the set of universes.
        public override DateTime GetNextRefreshTimeUtc()
        {
            return DateTime.MaxValue;
        }
    }
    class MyUniverseSelectionModel(UniverseSelectionModel):
    
        # Creates the universes for this algorithm
        def CreateUniverses(self, algorithm: QCAlgorithm) -> List[Universe]:
            universes = []
            return universes
        
        # Gets the next time the framework should invoke the `CreateUniverses` method to refresh the set of universes.
        def GetNextRefreshTimeUtc(self):
            return datetime.max

    The algorithm argument that the methods receive is an instance of the base QCAlgorithm class, not your subclass of it.

    Generally, you should be able to extend one of the pre-built Universe Selection types. If you need to do something that doesn't fit into the pre-built types, let us know and we'll create a new foundational type of Universe Selection model.

    Track Security Changes

    When the Universe Selection model adjusts the universe constituents, we notify your algorithm through the OnSecuritiesChanged event handler on your other framework components. The method receives QCAlgorithm and SecurityChanges objects. The QCAlgorithm object is an instance of the base QCAlgorithm class, not a reference to your algorithm object. To access the added securities, check the changes.AddedSecurities property. To access the removed securities, check the changes.RemovedSecurities property.

    public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
    {
        foreach (var security in changes.AddedSecurities)
        {
            Log($"Added {security.Symbol}");
        }
    
        foreach (var security in changes.RemovedSecurities)
        {
            Log($"Removed {security.Symbol}");
        }
    }
    def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
        for security in changes.AddedSecurities:
            self.Log(f"Added {security.Symbol}")
    
        for security in changes.RemovedSecurities:
            self.Log(f"Removed {security.Symbol}")

    Live Trading Considerations

    In live trading, the securities in your brokerage account are added to your user-defined universe. If your Universe Selection model doesn't select these securities, they are not removed from your user-defined universe. When you liquidate the positions, you can remove them from the user-defined universe. If you call the RemoveSecurity method, it automatically liquidates the position.

    To see the securities in your user-defined universe that were loaded from your brokerage account, check your algorithm's ActiveSecurities in the OnWarmupFinished event handler.

    Examples

    Demonstration Algorithms
    Manual Selection - BasicTemplateFrameworkAlgorithm.py Python Fundamental Selection - QC500UniverseSelectionModel.py Python Scheduled Selection - ScheduledUniverseSelectionModelRegressionAlgorithm.py Python Manual Selection - BasicTemplateFrameworkAlgorithm.cs C# Fundamental Selection - QC500UniverseSelectionModel.cs C# Scheduled Selection - ScheduledUniverseSelectionModelRegressionAlgorithm.cs C#

     

    17.2.2 Universe Settings

    Introduction

    Universe settings and security initializers enable you to configure some properties of the securities in a universe.

    Properties

    The universe settings of your algorithm configure some properties of the universe constituents. The following table describes the properties of the UniverseSettings object:

    Property: ExtendedMarketHours

    Should assets also feed extended market hours? You only receive extended market hours data if you create the subscription with an intraday resolution. If you create the subscription with daily resolution, the daily bars only reflect the regular trading hours.

    Data Type: bool | Default Value: false False

    Property: FillForward

    Should asset data fill forward?

    Data Type: bool | Default Value: true True

    Property: MinimumTimeInUniverse

    What's the minimum time assets should be in the universe?

    Data Type: TimeSpan timedelta | Default Value: TimeSpan.FromDays(1) timedelta(1)

    Property: Resolution

    What resolution should assets use?

    Data Type: Resolution | Default Value: Resolution.Minute

    Property: ContractDepthOffset

    What offset from the current front month should be used for continuous Future contracts ? 0 uses the front month and 1 uses the back month contract. This setting is only available for Future assets.

    Data Type: int | Default Value: 0

    Property: DataMappingMode

    How should continuous Future contracts be mapped? This setting is only available for Future assets.

    Data Type: DataMappingMode | Default Value: DataMappingMode.OpenInterest

    Property: DataNormalizationMode

    How should historical prices be adjusted? This setting is only available for Equity and Futures assets.

    Data Type: DataNormalizationMode | Default Value: DataNormalizationMode.Adjusted

    Property: Leverage

    What leverage should assets use in the universe? This setting is not available for derivative assets.

    Data Type: decimal float | Default Value: Security.NullLeverage

    To set the UniverseSettings , update the preceding properties in the Initialize method before you add the "Universe Selection model" These settings are globals, so they apply to all universes you create.

    // Request second resolution data. This will be slow!
    UniverseSettings.Resolution = Resolution.Second;
    AddUniverseSelection(new VolatilityETFUniverse());
    # Request second resolution data. This will be slow!
    self.UniverseSettings.Resolution = Resolution.Second
    self.AddUniverseSelection(VolatilityETFUniverse())

    Configure Securities

    Instead of configuring global universe settings, you can individually configure the settings of each security in the universe with a security initializer. Security initializers let you apply any security-level reality model or special data requests on a per-security basis. To set the security initializer, in the Initialize method, call the SetSecurityInitializer method and then define the security initializer.

    //In Initialize
    SetSecurityInitializer(CustomSecurityInitializer);
    
    private void CustomSecurityInitializer(Security security)
    {
        // Disable trading fees
        security.SetFeeModel(new ConstantFeeModel(0, "USD"));
    }
    
    #In Initialize
    self.SetSecurityInitializer(self.CustomSecurityInitializer)
    
    def CustomSecurityInitializer(self, security: Security) -> None:
        # Disable trading fees
        security.SetFeeModel(ConstantFeeModel(0, "USD"))
    

    For simple requests, you can use the functional implementation of the security initializer. This style lets you configure the security object with one line of code.

    SetSecurityInitializer(security => security.SetFeeModel(new ConstantFeeModel(0, "USD")));
    self.SetSecurityInitializer(lambda security: security.SetFeeModel(ConstantFeeModel(0, "USD")))

    In some cases, you may want to trade a security in the same time loop that you create the security subscription. To avoid errors, use a security initializer to set the market price of each security to the last known price. The GetLastKnownPrices method seeds the security price by gathering the security data over the last 3 days. If there is no data during this period, the security price remains at 0.

    var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
    SetSecurityInitializer(security => seeder.SeedSecurity(security));
    seeder = FuncSecuritySeeder(self.GetLastKnownPrices)
    self.SetSecurityInitializer(lambda security: seeder.SeedSecurity(security))

    If you call the SetSecurityInitializer method, it overwrites the default security initializer. The default security initializer uses the security-level reality models of the brokerage model to set the following reality models of each security:

    The default security initializer also sets the leverage of each security and intializes each security with a seeder function. To extend upon the default security initializer instead of overwriting it, create a custom BrokerageModelSecurityInitializer .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite some of the reality models        
            security.SetFeeModel(new ConstantFeeModel(0, "USD"));    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite some of the reality models        
            security.SetFeeModel(ConstantFeeModel(0, "USD"))

    To set a seeder function without overwriting the reality models of the brokerage, use the standard BrokerageModelSecurityInitializer .

    SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    self.SetSecurityInitializer(BrokerageModelSecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    

     

    17.2.3 Manual Universes

    Introduction

    The ManualUniverseSelectionModel selects a static, fixed set of assets. It is similar to adding securities with the traditional AddSecurity API methods. If your algorithm has a static universe, you can use automatic indicators instead of manual indicators in your algorithm.

    Manual universes can be prone to look-ahead bias . For example, if you select a set of securities that have performed well during the backtest period, you are incorporating information from the future into the backtest and the algorithm may underperform in live mode.

    Add Manual Universe Selection

    To add a ManualUniverseSelectionModel to your algorithm, in the Initialize method, call the AddUniverseSelection method. The ManualUniverseSelectionModel constructor expects a list of Symbol objects that represent the universe constituents. To create the Symbol objects, call the Symbol.Create method.

    var tickers = new[] {"SPY", "QQQ", "IWM"};
    var symbols = tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA));
    AddUniverseSelection(new ManualUniverseSelectionModel(symbols));
    tickers = ["SPY", "QQQ", "IWM"]
    symbols = [ Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers]
    self.AddUniverseSelection(ManualUniverseSelectionModel(symbols))

    To move the universe tickers and Symbol objects outside of the algorithm class, create a universe selection model that inherits the ManualUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new IndexUniverseSelectionModel());
    
    // Outside of the algorithm class
    class IndexUniverseSelectionModel : ManualUniverseSelectionModel
    {
        public IndexUniverseSelectionModel()
            : base(SelectSymbols()) {}
    
        public static IEnumerable<Symbol> SelectSymbols()
        {
            var tickers = new[] {"SPY", "QQQ", "IWM"};
            return tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA));
        }
    }
    # In Initialize
    self.AddUniverseSelection(IndexUniverseSelectionModel())
    
    # Outside of the algorithm class
    class IndexUniverseSelectionModel(ManualUniverseSelectionModel):
        def __init__(self):
            tickers = ["SPY", "QQQ", "IWM"]
            symbols = [Symbol.Create(ticker, SecurityType.Equity, Market.USA) for ticker in tickers]
            super().__init__(symbols)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.2.4 Fundamental Universes

    Introduction

    A FundamentalUniverseSelectionModel selects a universe of US Equities based on CoarseFundamental and, sometimes, FineFundamental data. If the model uses CoarseFundamental data, it relies on the US Equity Coarse Universe dataset. If the Universe Selection model uses FineFundamental data, it relies on the US Fundamental dataset.

    These types of universes operate on daily schedule. In backtests, they select assets at midnight. In live trading, the selection timing depends on the data feed you use.

    If you use a fundamental Universe Selection model, the only way to unsubscribe from a security is to return a list from the selection functions that doesn't include the security Symbol . The RemoveSecurity method doesn't work with these types of Universe Selection models.

    Coarse Fundamental Selection

    The CoarseFundamentalUniverseSelectionModel selects assets based on CoarseFundamental data. To use this model, define a coarse selection function. The coarse selection function receives a list of CoarseFundamental objects and returns a list of Symbol objects. The Symbol objects you return from the coarse selection function are the constituents of the universe.

    public override void Initialize()
    {
        AddUniverseSelection(new CoarseFundamentalUniverseSelectionModel(SelectCoarse));
    }
    
    private IEnumerable<Symbol> SelectCoarse(IEnumerable<CoarseFundamental> coarse)
    {
        // Return most liquid assets w/ fundamentals
        return coarse.Where(c => c.HasFundamentalData)
                     .OrderByDescending(c => c.DollarVolume)
                     .Take(100)
                     .Select(c => c.Symbol);
    }
    def Initialize(self) -> None:
        self.AddUniverseSelection(CoarseFundamentalUniverseSelectionModel(self.SelectCoarse))
    
    def SelectCoarse(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        selected = [c for c in coarse if c.HasFundamentalData]
        sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
        return [c.Symbol for c in sorted_by_dollar_volume[:100]] # Return most liquid assets w/ fundamentals

    To move the coarse selection function outside of the algorithm class, create a universe selection model that inherits the CoarseFundamentalUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new MostLiquidFundamentalUniverseSelectionModel(UniverseSettings));
    
    // Outside of the algorithm class
    class MostLiquidFundamentalUniverseSelectionModel : CoarseFundamentalUniverseSelectionModel
    {
        public MostLiquidFundamentalUniverseSelectionModel(UniverseSettings universeSettings)
            : base(default(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>>), universeSettings)
        {
        }
    
        public override IEnumerable<Symbol> SelectCoarse(QCAlgorithm algorithm, IEnumerable<CoarseFundamental> coarse)
        {
            return coarse.Where(c => c.HasFundamentalData)
                         .OrderByDescending(c => c.DollarVolume)
                         .Take(100)
                         .Select(c => c.Symbol);
        }
    }
    # In Initialize
    self.AddUniverseSelection(MostLiquidFundamentalUniverseSelectionModel(self.UniverseSettings))
    
    # Outside of the algorithm class
    class MostLiquidFundamentalUniverseSelectionModel(CoarseFundamentalUniverseSelectionModel):
        def __init__(self, universe_settings: UniverseSettings) -> None:
            super().__init__(self.SelectCoarse, universe_settings)
    
        def SelectCoarse(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
            selected = [c for c in coarse if c.HasFundamentalData]
            sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
            return [c.Symbol for c in sorted_by_dollar_volume[:100]]

    To return the current universe constituents from the coarse selection function, return Universe.Unchanged .

    To view the implementation of this model, see the LEAN GitHub repository .

    Fine Fundamental Selection

    The FineFundamentalUniverseSelectionModel selects assets based on CoarseFundamental and FineFundamental data. This is the only model that provides corporate fundamental data to your algorithm. To use this model, define a coarse selection function and a fine selection function. The coarse selection function receives a list of CoarseFundamental objects and returns a list of Symbol objects. To filter the CoarseFundamental down to the securities that have fundamental data, add a HasFundamentalData filter to the coarse selection function. The fine selection function receives a subset of FineFundamental objects generated from coarse selection results and returns a list of Symbol objects. The Symbol objects you return from the fine selection function are the constituents of the universe.

    public override void Initialize()
    {
         AddUniverseSelection(new FineFundamentalUniverseSelectionModel(SelectCoarse, SelectFine));
    }
    
    private IEnumerable<Symbol> SelectCoarse(IEnumerable<CoarseFundamental> coarse)
    {
        // Return most liquid assets w/ fundamentals
        return coarse.Where(c => c.HasFundamentalData)
                     .OrderByDescending(c => c.DollarVolume)
                     .Take(100)
                     .Select(c => c.Symbol);
    }
    
    private IEnumerable<Symbol> SelectFine(IEnumerable<FineFundamental> fine)
    {
        // Return assets with lowest P/E ratios
        return fine.OrderBy(f => f.ValuationRatios.PERatio)
                   .Take(10)
                   .Select(f => f.Symbol);
    }
    
    def Initialize(self) -> None:
        self.AddUniverseSelection(FineFundamentalUniverseSelectionModel(self.SelectCoarse, self.SelectFine))
    
    def SelectCoarse(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
        selected = [c for c in coarse if c.HasFundamentalData]
        sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
        return [c.Symbol for c in sorted_by_dollar_volume[:100]] # Return most liquid assets w/ fundamentals
    
    def SelectFine(self, fine: List[FineFundamental]) -> List[Symbol]:
        sorted_by_pe_ratio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=False)
        return [c.Symbol for c in sorted_by_pe_ratio[:10]] # Return assets with lowest P/E ratios

    To move the selection functions outside of the algorithm class, create a universe selection model that inherits the FineFundamentalUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new LowPERatioUniverseSelectionModel(UniverseSettings));
    
    // Outside of the algorithm class
    class LowPERatioUniverseSelectionModel : FineFundamentalUniverseSelectionModel
    {
        public LowPERatioUniverseSelectionModel(UniverseSettings universeSettings = null)
            : base(default(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>>), 
                   default(Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>>),
                   universeSettings)
        {
        }
    
        public override IEnumerable<Symbol> SelectCoarse(QCAlgorithm algorithm, IEnumerable<CoarseFundamental> coarse)
        {
            return coarse.Where(c => c.HasFundamentalData)
                         .OrderByDescending(c => c.DollarVolume)
                         .Take(100)
                         .Select(c => c.Symbol);
        }
    
        public override IEnumerable<Symbol> SelectFine(QCAlgorithm algorithm, IEnumerable<FineFundamental> fine)
        {
            return fine.OrderBy(f => f.ValuationRatios.PERatio)
                       .Take(10)
                       .Select(f => f.Symbol);
        }
    }
    # In Initialize
    self.AddUniverseSelection(LowPERatioUniverseSelectionModel(self.UniverseSettings))
    
    # Outside of the algorithm class
    class LowPERatioUniverseSelectionModel(FineFundamentalUniverseSelectionModel):
        def __init__(self, universe_settings: UniverseSettings = None) -> None:
            super().__init__(self.SelectCoarse, self.SelectFine, universe_settings)
    
        def SelectCoarse(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
            selected = [c for c in coarse if c.HasFundamentalData]
            sorted_by_dollar_volume = sorted(selected, key=lambda c: c.DollarVolume, reverse=True)
            return [c.Symbol for c in sorted_by_dollar_volume[:100]]
    
        def SelectFine(self, fine: List[FineFundamental]) -> List[Symbol]:
            sorted_by_pe_ratio = sorted(fine, key=lambda x: x.ValuationRatios.PERatio, reverse=False)
            return [c.Symbol for c in sorted_by_pe_ratio[:10]]

    To return the current universe constituents from the coarse or fine selection function, return Universe.Unchanged .

    If you add a FineFundamentalUniverseSelectionModel to your algorithm, you can access fundamental data in the fine selection function or from the Equity object. To access fundamental data from the Equity object, use the Equity.Fundamentals property.

    To view the implementation of this model, see the LEAN GitHub repository .

    EMA Cross Selection

    The EmaCrossUniverseSelectionModel applies two exponential moving average (EMA) indicators to the price history of assets and then selects the assets that have their fast EMA furthest above their slow EMA on a percentage basis.

    public override void Initialize()
    {
        AddUniverseSelection(new EmaCrossUniverseSelectionModel());
    }
    def Initialize(self) -> None:
        self.AddUniverseSelection(EmaCrossUniverseSelectionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    fastPeriod int Fast EMA period 100
    slowPeriod int Slow EMA period 300
    universeCount int Maximum number of members of this universe selection 500
    universeSettings UniverseSettings The settings used when adding symbols to the algorithm None null

    If you don't provide a universeSettings argument, the algorithm.UniverseSettings are used by default.

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.2.5 ETF Constituents Universes

    Introduction

    The ETFConstituentsUniverseSelectionModel selects a daily universe of US Equities based on the constituents of an ETF. These Universe Selection models rely on the US ETF Constituents dataset.

    Add ETF Constituents Universe Selection

    To add an ETFConstituentsUniverseSelectionModel to your algorithm, in the Initialize method, call the AddUniverseSelection method. The ETFConstituentsUniverseSelectionModel constructor expects an ETF Symbol .

    AddUniverseSelection(new ETFConstituentsUniverseSelectionModel(etfSymbol));
    self.AddUniverseSelection(ETFConstituentsUniverseSelectionModel(etfSymbol))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    etfSymbol Symbol Symbol of the ETF to get constituents for
    universeSettings UniverseSettings The universe settings . If you don't provide an argument, the model uses the algorithm.UniverseSettings by default. null None
    universeFilterFunc Func<IEnumerable<ETFConstituentData>, IEnumerable<Symbol>> Callable[[List[ETFConstituentData]], List[Symbol]] Function to filter ETF constituents. If you don't provide an argument, the model selects all of the ETF constituents by default. null None

    If you provide a universeFilterFunc argument, you can use the following attributes of the ETFConstituentData objects to select your universe:

    The following example shows how to select the 10 Equities with the largest weight in the SPY ETF:

    public override void Initialize()
    {
        var symbol = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA);
        AddUniverseSelection(new ETFConstituentsUniverseSelectionModel(symbol, UniverseSettings, ETFConstituentsFilter));
    }
    
    private IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
    {
        return constituents.OrderByDescending(c => c.Weight).Take(10).Select(c => c.Symbol);
    }
    def Initialize(self) -> None:
        symbol = Symbol.Create("SPY", SecurityType.Equity, Market.USA)
        universe = ETFConstituentsUniverseSelectionModel(symbol, self.UniverseSettings, self.ETFConstituentsFilter)
        self.AddUniverseSelection(universe)
    
    def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
        selected = sorted([c for c in constituents if c.Weight],
            key=lambda c: c.Weight, reverse=True)[:10]
        return [c.Symbol for c in selected]

    To move the ETF Symbol and the selection function outside of the algorithm class, create a universe selection model that inherits the ETFConstituentsUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new LargestWeightSPYETFUniverseSelectionModel(UniverseSettings));
    
    // Outside of the algorithm class
    class LargestWeightSPYETFUniverseSelectionModel : ETFConstituentsUniverseSelectionModel
    {
        public LargestWeightSPYETFUniverseSelectionModel(UniverseSettings universeSettings = null)
            : base(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA), 
                universeSettings, ETFConstituentsFilter)
        {
        }
    
        private static IEnumerable<Symbol> ETFConstituentsFilter(IEnumerable<ETFConstituentData> constituents)
        {
            return constituents.OrderByDescending(c => c.Weight).Take(10).Select(c => c.Symbol);
        }
    }
    # In Initialize
    self.AddUniverseSelection(LargestWeightSPYETFUniverseSelectionModel(self.UniverseSettings))
    
    # Outside of the algorithm class
    class LargestWeightSPYETFUniverseSelectionModel(ETFConstituentsUniverseSelectionModel):
        def __init__(self, universe_settings: UniverseSettings = None) -> None:
            symbol = Symbol.Create("SPY", SecurityType.Equity, Market.USA)
            super().__init__(symbol, universe_settings, self.ETFConstituentsFilter)
    
        def ETFConstituentsFilter(self, constituents: List[ETFConstituentData]) -> List[Symbol]:
            selected = sorted([c for c in constituents if c.Weight],
                key=lambda c: c.Weight, reverse=True)[:10]
            return [c.Symbol for c in selected]

    To return the current universe constituents from the selection function, return Universe.Unchanged .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.2.6 Scheduled Universes

    Introduction

    A Scheduled Universe Selection model selects assets at fixed, regular intervals. In live trading, you can use this type of model to fetch tickers from Dropbox or to perform periodic historical analysis and select some assets.

    Scheduled Universe Selection

    The ScheduledUniverseSelectionModel selects assets on the schedule you provide. To use this model, provide a DateRule , TimeRule , and a selector function. The DateRule and TimeRule define the selection schedule. The selector function receives a datetime DateTime object and returns a list of Symbol objects. The Symbol objects you return from the selector function are the constituents of the universe.

    AddUniverseSelection(new ScheduledUniverseSelectionModel(dateRule, timeRule, selector));
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(dateRule, timeRule, selector))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    dateRule IDateRule Date rule defines what days the universe selection function will be invoked
    timeRule ITimeRule Time rule defines what times on each day selected by date rule the universe selection function will be invoked
    selector Func<DateTime, IEnumerable<Symbol>> Callable[[datetime], List[Symbol]] Selector function accepting the date time firing time and returning the universe selected symbols
    settings UniverseSettings Universe settings for subscriptions added via this universe, null will default to algorithm's universe settings null None

    If you don't provide a settings argument, the algorithm.UniverseSettings is used by default.

    The model assumes the timeRule argument is in Coordinated Universal Time (UTC). To use a different timezone, pass a timeZone argument of type DateTimeZone before the dateRule argument.

    To return the current universe constituents from the selector function, return Universe.Unchanged .

    // Selection will run on mon/tues/thurs at 00:00/06:00/12:00/18:00
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.Every(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Thursday),
        TimeRules.Every(TimeSpan.FromHours(6)),
        SelectSymbols // selection function in algorithm.
    ));
    
    // Create selection function which returns symbol objects.
    private IEnumerable<Symbol> SelectSymbols(DateTime dateTime)
    {
        var tickers = new[] {"SPY", "AAPL", "IBM"};
        return tickers.Select(ticker =>
            QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA));
    }
    
    # Selection will run on mon/tues/thurs at 00:00/06:00/12:00/18:00
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.Every(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Thursday),
        self.TimeRules.Every(timedelta(hours = 6)),
        self.SelectSymbols # selection function in algorithm.
    ))
    
    # Create selection function which returns symbol objects.
    def SelectSymbols(self, dateTime: datetime) -> List[Symbol]:
        tickers = ['SPY', 'AAPL', 'IBM']
        return [Symbol.Create(ticker, SecurityType.Equity, Market.USA)
            for ticker in tickers]

    To view the implementation of this model, see the LEAN GitHub repository .

    Date Rules

    The following table describes the supported DateRules :

    Member Description
    self.DateRules.SetDefaultTimeZone(time_zone: DateTimeZone) DateRules.SetDefaultTimeZone(DateTimeZone timeZone); Sets the time zone for the DateRules object used in all methods in this table. The default time zone is the algorithm time zone .
    self.DateRules.On(year: int, month: int, day: int) DateRules.On(int year, int month, int day) Trigger an event on a specific date.
    self. DateRules.EveryDay() Trigger an event every day.
    self.DateRules.EveryDay(symbol: Symbol) DateRules.EveryDay(Symbol symbol) Trigger an event every day a specific symbol is trading.
    self.DateRules.Every(days: List[DayOfWeek]) DateRules.Every(params DayOfWeek[] days) Trigger an event on specific days throughout the week. To view the DayOfWeek enum members, see DayOfWeek Enum in the .NET documentation.
    self.DateRules.MonthStart(daysOffset: int = 0) DateRules.MonthStart(int daysOffset = 0) Trigger an event on the first day of each month plus an offset.
    self.DateRules.MonthStart(symbol: Symbol, daysOffset: int = 0) DateRules.MonthStart(Symbol symbol, int daysOffset = 0) Trigger an event on the first tradable date of each month for a specific symbol plus an offset.
    self.DateRules.MonthEnd(daysOffset: int = 0) DateRules.MonthEnd(int daysOffset = 0) Trigger an event on the last day of each month minus an offset.
    self.DateRules.MonthEnd(symbol: Symbol, daysOffset: int = 0) DateRules.MonthEnd(Symbol symbol, int daysOffset = 0) Trigger an event on the last tradable date of each month for a specific symbol minus an offset.
    self.DateRules.WeekStart(daysOffset: int = 0) DateRules.WeekStart(int daysOffset = 0) Trigger an event on the first day of each week plus an offset.
    self.DateRules.WeekStart(symbol: Symbol, daysOffset: int = 0) DateRules.WeekStart(Symbol symbol, int daysOffset = 0) Trigger an event on the first tradable date of each week for a specific symbol plus an offset.
    self.DateRules.WeekEnd(daysOffset: int = 0) DateRules.WeekEnd(int daysOffset = 0) Trigger an event on the last day of each week minus an offset.
    self.DateRules.WeekEnd(symbol: Symbol, daysOffset: int = 0) DateRules.WeekEnd(Symbol symbol, int daysOffset = 0) Trigger an event on the last tradable date of each week for a specific symbol minus an offset.
    self. DateRules.Today Trigger an event once today.
    self. DateRules.Tomorrow Trigger an event once tomorrow.

    Time Rules

    The following table describes the supported TimeRules :

    Member Description
    self.TimeRules.SetDefaultTimeZone(time_zone: DateTimeZone) TimeRules.SetDefaultTimeZone(DateTimeZone timeZone) Sets the time zone for the TimeRules object used in all methods in this table, except when a different time zone is given. The default time zone is the algorithm time zone .
    self.TimeRules.AfterMarketOpen(symbol: Symbol, minutesAfterOpen: float = 0, extendedMarketOpen: bool = False) TimeRules.AfterMarketOpen(Symbol symbol, double minutesAfterOpen = 0, bool extendedMarketOpen = false) Trigger an event a few minutes after market open for a specific symbol (default is 0). This rule doesn't work for Crypto securities or custom data.
    self.TimeRules.BeforeMarketClose(symbol: Symbol, minutesBeforeClose: float = 0, extendedMarketOpen: bool = False) TimeRules.BeforeMarketClose(Symbol symbol, double minutesBeforeClose = 0, bool extendedMarketOpen = false) Trigger an event a few minutes before market close for a specific symbol (default is 0). This rule doesn't work for Crypto securities or custom data.
    self.TimeRules.Every(interval: timedelta) TimeRules.Every(TimeSpan interval) Trigger an event every period interval starting at midnight.
    self. TimeRules.Now Trigger an event at the current time of day.
    self. TimeRules.Midnight Trigger an event at midnight.
    self. TimeRules.Noon Trigger an event at noon.
    self.TimeRules.At(hour: int, minute: int, second: int = 0) TimeRules.At(int hour, int minute, int second = 0) Trigger an event at a specific time of day (e.g. 13:10).
    self.TimeRules.At(hour: int, minute: int, second: int, time_zone: DateTimeZone) TimeRules.At(int hour, int minute, int second, DateTimeZone timeZone) Trigger an event at a specific time of day in the given time zone (e.g. 13:10 UTC).

    Examples

    // Select the universe on a specific date at a specific time 
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.On(2013, 10, 7),
        TimeRules.At(13, 0),
        SelectSymbols));
    
    // Select the universe 10 minutes after SPY starts trading each day
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.EveryDay("SPY"),
        TimeRules.AfterMarketOpen("SPY", 10),
        SelectSymbols));
    
    // Select the universe 10 minutes before SPY stops trading each day
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.EveryDay("SPY"),
        TimeRules.BeforeMarketClose("SPY", 10),
        SelectSymbols));
    
    // Select the universe on Monday and Friday at noon
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday),
        TimeRules.At(12, 0),
        SelectSymbols));
    
    // Select the universe now
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.Today,
        TimeRules.Now,
        SelectSymbols));
    
    // Select the universe tomorrow at midnight
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.Tomorrow,
        TimeRules.Midnight,
        SelectSymbols));
    
    // Select the universe today at noon
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.Today,
        TimeRules.Noon,
        SelectSymbols));
    
    // Select the universe every 10 minutes on everyday 
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.EveryDay(), 
        TimeRules.Every(TimeSpan.FromMinutes(10)),
        SelectSymbols));
                
    // Select the universe at the market open on the first day of the month the SPY starts trading
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.MonthStart("SPY"),
        TimeRules.AfterMarketOpen("SPY"),
        SelectSymbols));
    
    // Select the universe at the market close on the last day of the month the SPY trades
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.MonthEnd("SPY"),
        TimeRules.BeforeMarketClose("SPY"),
        SelectSymbols));
    
    // Select the universe 5 minutes after SPY starts trading each week
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.WeekStart("SPY"),
        TimeRules.AfterMarketOpen("SPY", 5),
        SelectSymbols));
    
    // Select the universe 5 minutes before the SPY stops trading each week
    AddUniverseSelection(new ScheduledUniverseSelectionModel(
        DateRules.WeekEnd("SPY"),
        TimeRules.BeforeMarketClose("SPY", 5),
        SelectSymbols));
    
    
    // Define a selection function that returns Symbol objects
    private IEnumerable<Symbol> SelectSymbols(DateTime dateTime)
    {
        var tickers = new[] {"SPY", "AAPL", "IBM"};
        return tickers.Select(ticker =>
            QuantConnect.Symbol.Create(ticker, SecurityType.Equity, Market.USA));
    }      
    
    # Select the universe on a specific date at a specific time 
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.On(2013, 10, 7), 
        self.TimeRules.At(13, 0),
        self.select_symbols))
        
    # Select the universe 10 minutes after SPY starts trading each day
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.EveryDay("SPY"), 
        self.TimeRules.AfterMarketOpen("SPY", 10),
        self.select_symbols))
    
    # Select the universe 10 minutes before SPY stops trading each day
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.EveryDay("SPY"),
        self.TimeRules.BeforeMarketClose("SPY", 10),
        self.select_symbols))
    
    # Select the universe on Monday and Friday at noon
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday),
        self.TimeRules.At(12, 0),
        self.select_symbols))
    
    # Select the universe now
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.Today,
        self.TimeRules.Now,
        self.select_symbols))
    
    # Select the universe tomorrow at midnight
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.Tomorrow,
        self.TimeRules.Midnight,
        self.select_symbols))
        
    # Select the universe today at noon
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.Today,
        self.TimeRules.Noon,
        self.select_symbols))
    
    # Select the universe every 10 minutes on everyday 
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.EveryDay(), 
        self.TimeRules.Every(timedelta(minutes=10)),
        self.select_symbols))
    
    # Select the universe at the market open on the first day of the month the SPY starts trading
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.MonthStart("SPY"),
        self.TimeRules.AfterMarketOpen("SPY"),
        self.select_symbols))
    
    # Select the universe at the market close on the last day of the month the SPY trades
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.MonthEnd("SPY"),
        self.TimeRules.BeforeMarketClose("SPY"),
        self.select_symbols))
    
    # Select the universe 5 minutes after SPY starts trading each week
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.WeekStart("SPY"),
        self.TimeRules.AfterMarketOpen("SPY", 5),
        self.select_symbols))
    
    # Select the universe 5 minutes before the SPY stops trading each week
    self.AddUniverseSelection(ScheduledUniverseSelectionModel(
        self.DateRules.WeekEnd("SPY"),
        self.TimeRules.BeforeMarketClose("SPY", 5),
        self.select_symbols))
    
    
    # Define a selection function that returns Symbol objects
    def select_symbols(self, date_time: datetime) -> List[Symbol]:
        tickers = ['SPY', 'AAPL', 'IBM']
        return [Symbol.Create(ticker, SecurityType.Equity, Market.USA)
            for ticker in tickers]
    
    Demonstration Algorithms
    ScheduledUniverseSelectionModelRegressionAlgorithm.py Python ScheduledUniverseSelectionModelRegressionAlgorithm.cs C#

     

    17.2.7 Futures Universes

    Introduction

    A Future Universe Selection model selects contracts for a set of Futures.

    Future Universe Selection

    The FutureUniverseSelectionModel selects all the contracts for a set of Futures you specify. To use this model, provide a refreshInterval and a selector function. The refreshInterval defines how frequently LEAN calls the selector function. The selector function receives a DateTime datetime object that represents the current Coordinated Universal Time (UTC) and returns a list of Symbol objects. The Symbol objects you return from the selector function are the Futures of the universe.

    AddUniverseSelection(new FutureUniverseSelectionModel(refreshInterval, futureChainSymbolSelector));
    from Selection.FutureUniverseSelectionModel import FutureUniverseSelectionModel
    
    self.AddUniverseSelection(FutureUniverseSelectionModel(refreshInterval, futureChainSymbolSelector))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    refreshInterval TimeSpan timedelta Time interval between universe refreshes
    futureChainSymbolSelector Func<DateTime, IEnumerable<Symbol>> Callable[[datetime], List[Symbol]] A function that selects the Future symbols. To view the supported assets in the US Futures dataset, see Supported Assets .
    universeSettings UniverseSettings Universe settings define attributes of created subscriptions, such as their resolution and the minimum time in universe before they can be removed null None

    If you don't provide a universeSettings argument, the algorithm.UniverseSettings is used by default.

    public override void Initialize()
    {
        AddUniverseSelection(
            new FutureUniverseSelectionModel(TimeSpan.FromDays(1), SelectFutureChainSymbols)
        );
    }
    
    private static IEnumerable<Symbol> SelectFutureChainSymbols(DateTime utcTime)
    {
        return new[] {
            QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
            QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX)
        };
    }
    from Selection.FutureUniverseSelectionModel import FutureUniverseSelectionModel
    
    def Initialize(self) -> None:
        universe = FutureUniverseSelectionModel(timedelta(days=1), self.select_future_chain_symbols)
        self.SetUniverseSelection(universe)
    
    def select_future_chain_symbols(self, utc_time: datetime) -> List[Symbol]:
        return [ Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
                 Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX) ]

    This model uses the default Future contract filter, which doesn't select any Futures contracts. To use a different filter, subclass the FutureUniverseSelectionModel and define a Filter method. The Filter method accepts and returns a FutureFilterUniverse object to select the Futures contracts. The following table describes the filter methods of the FutureFilterUniverse class:

    Method Description
    StandardsOnly() Selects standard contracts
    IncludeWeeklys() Selects non-standard weekly contracts
    WeeklysOnly() Selects weekly contracts
    FrontMonth() Selects the front month contract
    BackMonths() Selects the non-front month contracts
    BackMonth() Selects the back month contracts
    Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
    Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
    Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
    Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
    OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

    Depending on how you define the contract filter, LEAN may call it once a day or at every time step.

    To move the selection functions outside of the algorithm class, create a universe selection model that inherits the FutureUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new FrontMonthFutureUniverseSelectionModel());
    
    // Outside of the algorithm class
    class FrontMonthFutureUniverseSelectionModel : FutureUniverseSelectionModel
    {
        public FrontMonthFutureUniverseSelectionModel()
            : base(TimeSpan.FromDays(1), SelectFutureChainSymbols) {}
    
        private static IEnumerable<Symbol> SelectFutureChainSymbols(DateTime utcTime)
        {
            return new List<Symbol> {
                QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
                QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX)
            };
        }
    
        protected override FutureFilterUniverse Filter(FutureFilterUniverse filter)
        {
            return filter.FrontMonth().OnlyApplyFilterAtMarketOpen();
        }
    }
    from Selection.FutureUniverseSelectionModel import FutureUniverseSelectionModel
    
    # In Initialize
    self.AddUniverseSelection(FrontMonthFutureUniverseSelectionModel())
    
    # Outside of the algorithm class
    class FrontMonthFutureUniverseSelectionModel(FutureUniverseSelectionModel):
        def __init__(self,) -> None:
            super().__init__(timedelta(1), self.select_future_chain_symbols)
    
        def select_future_chain_symbols(self, utcTime: datetime) -> List[Symbol]:
            return [ 
                Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
                Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX) 
            ]
    
        def Filter(self, filter: FutureFilterUniverse) -> FutureFilterUniverse:
            return filter.FrontMonth().OnlyApplyFilterAtMarketOpen()

    Some of the preceding filter methods only set an internal enumeration in the FutureFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the FutureFilterUniverse .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Open Interest Future Universe Selection

    The OpenInterestFutureUniverseSelectionModel is an extension of the FutureUniverseSelectionModel that selects the contract with the greatest open interest on a daily basis.

    AddUniverseSelection(new OpenInterestFutureUniverseSelectionModel(algorithm, futureChainSymbolSelector));

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    algorithm IAlgorithm Algorithm
    futureChainSymbolSelector Func<DateTime, IEnumerable<Symbol>> A function that selects the Future symbols. To view the supported assets in the US Futures dataset, see Supported Assets .
    chainContractsLookupLimit int? Limit on how many contracts to query for open interest 6
    resultsLimit int? Limit on how many contracts will be part of the universe 1
    public override void Initialize()
    {
        var symbols = new[] {
            QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
            QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX)
        }; 
        AddUniverseSelection(new OpenInterestFutureUniverseSelectionModel(this, dateTime => symbols));
    }

    To move the selection functions outside of the algorithm class, create a universe selection model that inherits the OpenInterestFutureUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new GoldOpenInterestFutureUniverseSelectionModel(this));
    
    // Outside of the algorithm class
    class GoldOpenInterestFutureUniverseSelectionModel : OpenInterestFutureUniverseSelectionModel
    {
        public GoldOpenInterestFutureUniverseSelectionModel(QCAlgorithm algorithm, 
            int? chainContractsLookupLimit = 6, int? resultsLimit = 1)
            : base(algorithm, SelectFutureChainSymbols, chainContractsLookupLimit, resultsLimit) {}
    
        private static IEnumerable<Symbol> SelectFutureChainSymbols(DateTime utcTime)
        {
            return new List<Symbol> { 
                QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX) 
            };
        }
    }

    To view the implementation of this model, see the LEAN GitHub repository .

    The OpenInterestFutureUniverseSelectionModel isn't currently available for Python. To track the feature progress, subscribe to GitHub Issue #6352 .

     

    17.2.8 Options Universes

    Introduction

    An Option Universe Selection model selects contracts for a set of Options.

    Options Universe Selection

    The OptionUniverseSelectionModel selects all the available contracts for the Equity Options, Index Options, and Future Options you specify. To use this model, provide a refreshInterval and a selector function. The refreshInterval defines how frequently LEAN calls the selector function. The selector function receives a DateTime datetime object that represents the current Coordinated Universal Time (UTC) and returns a list of Symbol objects. The Symbol objects you return from the selector function are the Options of the universe.

    AddUniverseSelection(new OptionUniverseSelectionModel(refreshInterval, optionChainSymbolSelector));
    from Selection.OptionUniverseSelectionModel import OptionUniverseSelectionModel 
    
    self.AddUniverseSelection(OptionUniverseSelectionModel(refreshInterval, optionChainSymbolSelector))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    refreshInterval TimeSpan timedelta Time interval between universe refreshes
    optionChainSymbolSelector Func<DateTime, IEnumerable<Symbol>> Callable[[datetime], List[Symbol]] A function that selects the Option symbols
    universeSettings UniverseSettings Universe settings define attributes of created subscriptions, such as their resolution and the minimum time in universe before they can be removed null None

    If you don't provide a universeSettings argument, the algorithm.UniverseSettings is used by default.

    public override void Initialize()
    {
        AddUniverseSelection(
            new OptionUniverseSelectionModel(TimeSpan.FromDays(1), SelectOptionChainSymbols)
        );
    }
    
    private IEnumerable<Symbol> SelectOptionChainSymbols(DateTime utcTime)
    {
        // Equity Options example:
        //var tickers = new[] {"SPY", "QQQ", "TLT"};
        //return tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.Option, Market.USA));
    
        // Index Options example:
        //var tickers = new[] {"VIX", "SPX"};
        //return tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.IndexOption, Market.USA));
    
        // Future Options example:
        var futureSymbol = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME);
        var futureContractSymbols = FutureChainProvider.GetFutureContractList(futureSymbol, Time);
        foreach (var symbol in futureContractSymbols)
        {
            yield return QuantConnect.Symbol.CreateCanonicalOption(symbol);
        }
    }
    from Selection.OptionUniverseSelectionModel import OptionUniverseSelectionModel 
    
    def Initialize(self) -> None:
        universe = OptionUniverseSelectionModel(timedelta(days=1), self.select_option_chain_symbols)
        self.SetUniverseSelection(universe)
    
    def select_option_chain_symbols(self, utc_time: datetime) -> List[Symbol]:
        # Equity Options example:
        #tickers = ["SPY", "QQQ", "TLT"]
        #return [Symbol.Create(ticker, SecurityType.Option, Market.USA) for ticker in tickers]
    
        # Index Options example:
        #tickers = ["VIX", "SPX"]
        #return [Symbol.Create(ticker, SecurityType.IndexOption, Market.USA) for ticker in tickers]
    
        # Future Options example:
        future_symbol = Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME)
        future_contract_symbols = self.FutureChainProvider.GetFutureContractList(future_symbol, self.Time)
        return [Symbol.CreateCanonicalOption(symbol) for symbol in future_contract_symbols]

    This model uses the default Option filter, which selects the Option contracts with the following characteristics at every time step:

    To use a different filter for the contracts, subclass the OptionUniverseSelectionModel and define a Filter method. The Filter method accepts and returns an OptionFilterUniverse object to select the Option contracts. The following table describes the methods of the OptionFilterUniverse class:

    Method Description
    Strikes(int minStrike, int maxStrike) Strikes(minStrike: int, maxStrike: int) Selects contracts that are within minStrike strikes below the underlying price and maxStrike strikes above the underlying price
    CallsOnly() Selects call contracts
    PutsOnly() Selects put contracts
    StandardsOnly() Selects standard contracts
    IncludeWeeklys() Selects non-standard weeklys contracts
    WeeklysOnly() Selects weekly contracts
    FrontMonth() Selects the front month contract
    BackMonths() Selects the non-front month contracts
    BackMonth() Selects the back month contracts
    Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
    Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
    Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
    Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
    OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day

    Depending on how you define the contract filter, LEAN may call it once a day or at every time step.

    To move the selection functions outside of the algorithm class, create a universe selection model that inherits the OptionUniverseSelectionModel class.

    // In Initialize
    AddUniverseSelection(new EarliestExpiringAtTheMoneyCallOptionUniverseSelectionModel(this));
    
    // Outside of the algorithm class
    class EarliestExpiringAtTheMoneyCallOptionUniverseSelectionModel : OptionUniverseSelectionModel
    {
        public EarliestExpiringAtTheMoneyCallOptionUniverseSelectionModel(QCAlgorithm algorithm)
                : base(TimeSpan.FromDays(1), utcTime => SelectOptionChainSymbols(algorithm, utcTime)) {}
        
        private static IEnumerable<Symbol> SelectOptionChainSymbols(QCAlgorithm algorithm, DateTime utcTime)
        {
            // Equity Options example:
            //var tickers = new[] {"SPY", "QQQ", "TLT"};
            //return tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.Option, Market.USA));
    
            // Index Options example:
            //var tickers = new[] {"VIX", "SPX"};
            //return tickers.Select(ticker => QuantConnect.Symbol.Create(ticker, SecurityType.IndexOption, Market.USA));
    
            // Future Options example:
            var futureSymbol = QuantConnect.Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME);
            var futureContractSymbols = algorithm.FutureChainProvider.GetFutureContractList(futureSymbol, algorithm.Time);
            foreach (var symbol in futureContractSymbols)
            {
                yield return QuantConnect.Symbol.CreateCanonicalOption(symbol);
            }
        }
    
        protected override OptionFilterUniverse Filter(OptionFilterUniverse filter)
        {
            return filter.Strikes(-1, -1).Expiration(0, 7).CallsOnly().OnlyApplyFilterAtMarketOpen();
        }
    }
    
    from Selection.OptionUniverseSelectionModel import OptionUniverseSelectionModel 
    
    # In Initialize
    self.AddUniverseSelection(EarliestExpiringAtTheMoneyCallOptionUniverseSelectionModel(self))
    
    # Outside of the algorithm class
    class EarliestExpiringAtTheMoneyCallOptionUniverseSelectionModel(OptionUniverseSelectionModel):
        def __init__(self, algorithm):
            self.algo = algorithm
            super().__init__(timedelta(1), self.select_option_chain_symbols)
        
        def select_option_chain_symbols(self, utc_time: datetime) -> List[Symbol]:
            # Equity Options example:
            #tickers = ["SPY", "QQQ", "TLT"]
            #return [Symbol.Create(ticker, SecurityType.Option, Market.USA) for ticker in tickers]
    
            # Index Options example:
            #tickers = ["VIX", "SPX"]
            #return [Symbol.Create(ticker, SecurityType.IndexOption, Market.USA) for ticker in tickers]
    
            # Future Options example:
            future_symbol = Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME)
            future_contract_symbols = self.algo.FutureChainProvider.GetFutureContractList(future_symbol, self.algo.Time)
            return [Symbol.CreateCanonicalOption(symbol) for symbol in future_contract_symbols]
    
        def Filter(self, option_filter_universe: OptionFilterUniverse) -> OptionFilterUniverse:
            return option_filter_universe.Strikes(-1, -1).Expiration(0, 7).CallsOnly().OnlyApplyFilterAtMarketOpen()

    Some of the preceding filter methods only set an internal enumeration in the OptionFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the OptionFilterUniverse .

    To override the default pricing model of the Options, set a pricing model in a security initializer.

    To override the initial guess of implied volatility , set and warm up the underlying volatility model .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Option Chained Universe Selection

    An Option chained universe subscribes to Option contracts on the constituents of a US Equity universe .

    AddUniverseOptions(universe, optionFilter);
    
    self.AddUniverseOptions(universe, optionFilter)

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    universe Universe The universe to chain onto the Option Universe Selection model
    optionFilter Func<OptionFilterUniverse, OptionFilterUniverse> Callable[[OptionFilterUniverse], OptionFilterUniverse] The Option filter universe to use

    The optionFilter function receives and returns an OptionFilterUniverse to select the Option contracts. The following table describes the methods of the OptionFilterUniverse class:

    Method Description
    Strikes(int minStrike, int maxStrike) Strikes(minStrike: int, maxStrike: int) Selects contracts that are within minStrike strikes below the underlying price and maxStrike strikes above the underlying price
    CallsOnly() Selects call contracts
    PutsOnly() Selects put contracts
    StandardsOnly() Selects standard contracts
    IncludeWeeklys() Selects non-standard weeklys contracts
    WeeklysOnly() Selects weekly contracts
    FrontMonth() Selects the front month contract
    BackMonths() Selects the non-front month contracts
    BackMonth() Selects the back month contracts
    Expiration(TimeSpan minExpiry, TimeSpan maxExpiry) Expiration(minExpiry: timedelta, maxExpiry: timedelta) Selects contracts that expire within a range of dates relative to the current day
    Expiration(int minExpiryDays, int maxExpiryDays) Expiration(minExpiryDays: int, maxExpiryDays: int) Selects contracts that expire within a range of dates relative to the current day
    Contracts(IEnumerable<Symbol> contracts) Contracts(contracts: List[Symbol]) Selects a list of contracts
    Contracts(Func<IEnumerable<Symbol>, IEnumerable< Symbol>> contractSelector) Contracts(contractSelector: Callable[[List[Symbol]], List[Symbol]]) Selects contracts that a selector function selects
    OnlyApplyFilterAtMarketOpen() Instructs the engine to only filter contracts on the first time step of each market day
    public override void Initialize()
    {
        var universe = AddUniverse(Universe.DollarVolume.Top(10));
        AddUniverseOptions(universe, OptionFilterFunction);
    }
    
    private OptionFilterUniverse OptionFilterFunction(OptionFilterUniverse optionFilterUniverse)
    {
        return optionFilterUniverse.Strikes(-2, +2).FrontMonth().CallsOnly();
    }
    def Initialize(self) -> None:
        universe = self.AddUniverse(self.Universe.DollarVolume.Top(10))
        self.AddUniverseOptions(universe, self.OptionFilterFunction)
    
    def OptionFilterFunction(self, option_filter_universe: OptionFilterUniverse) -> OptionFilterUniverse:
        return option_filter_universe.Strikes(-2, +2).FrontMonth().CallsOnly()

    Some of the preceding filter methods only set an internal enumeration in the OptionFilterUniverse that it uses later on in the filter process. This subset of filter methods don't immediately reduce the number of contract Symbol objects in the OptionFilterUniverse .

    To override the default pricing model of the Options, set a pricing model in a security initializer.

    To override the initial guess of implied volatility , set and warm up the underlying volatility model .

    To view the implementation of this model, see the LEAN GitHub repository .

     

    17.3 Alpha

    17.3.1 Key Concepts

    Introduction

    The Alpha model predicts market trends and signals the best moments to trade. These signals, or Insight objects, contain the Direction , Magnitude , and Confidence of a market prediction and the suggested portfolio Weight . You should generate insights on the set of assets provided by the Universe Selection model and only generate them when your predictions change.

    Add Models

    To add an Alpha model, in the Initialize method, call the AddAlpha method.

    AddAlpha(new EmaCrossAlphaModel());
    self.AddAlpha(EmaCrossAlphaModel())

    To view all the pre-built Alpha models, see Supported Models .

    Multi-Alpha Algorithms

    You can add multiple Alpha models to a single algorithm and generate Insight objects with all of them.

    AddAlpha(new RsiAlphaModel());
    AddAlpha(new EmaCrossAlphaModel());
    self.AddAlpha(RsiAlphaModel())
    self.AddAlpha(EmaCrossAlphaModel())

    Each Alpha model has a unique name. The Insight objects they generate are automatically named according to the Alpha model name.

    If you add multiple Alpha models, each alpha model receives the current slice in the order that you add the Alphas. The combined stream of Insight objects is passed to the Portfolio Construction model that defines how the Insight collection is combined. If you have a hybrid algorithm, the combined stream of Insight objects is passed to the event handler .

    Model Structure

    Alpha models should extend the AlphaModel class. Extensions of the AlphaModel class must implement the Update method, which receives a Slice object and returns an array of Insight objects. Extensions should also implement the OnSecuritiesChanged method to track security changes in the universe.

    // Algorithm framework model that produces insights
    class MyAlphaModel : AlphaModel
    {
        // Updates this Alpha model with the latest data from the algorithm.
        // This is called each time the algorithm receives data for subscribed securities
        public override IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice data) 
        {
            var insights = new List<Insight>();
            return insights;
        }
    
        public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes) 
        {
            // Security additions and removals are pushed here.
            // This can be used for setting up algorithm state.
            // changes.AddedSecurities
            // changes.RemovedSecurities
        }
    }
    # Algorithm framework model that produces insights
    class MyAlphaModel(AlphaModel):
    
        def Update(self, algorithm: QCAlgorithm, data: Slice) -> List[Insight]:
            # Updates this Alpha model with the latest data from the algorithm.
            # This is called each time the algorithm receives data for subscribed securities
            # Generate insights on the securities in the universe.
            insights = []
            return insights
    
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            # Security additions and removals are pushed here.
            # This can be used for setting up algorithm state.
            # changes.AddedSecurities
            # changes.RemovedSecurities
            pass

    Method Parameters

    The algorithm parameter that the methods receive is an instance of the base QCAlgorithm class, not your subclass of it. To access members of your algorithm object, either use a global variable or pass an algorithm reference to Alpha model constructor. Both of these approaches violate the separation of concerns principle.

    The data parameter contains the latest data available to the algorithm.

    The changes parameter contains the universe changes.

    Model Names

    To ensure your Alpha model is compatible with all Portfolio Construction models , assign a unique name to your Alpha model. Some Portfolio Construction models can combine multiple Alpha models together, so it can be important to distinguish between the Alpha models. By default, we use the class-type name as the Alpha model name.

    public class RsiAlphaModel : AlphaModel
    {
        // Give your alpha a name (perhaps based on its constructor args?)
        public override string Name { get; }
    }

    Example

    To view a full example of an AlphaModel subclass, see the ConstantAlphaModel ConstantAlphaModel in the LEAN GitHub repository.

    Track Security Changes

    The Universe Selection model may select a dynamic universe of assets, so you should not assume a fixed set of assets in the Alpha model. When the Universe Selection model adds and removes assets from the universe, it triggers an OnSecuritiesChanged event. In the OnSecuritiesChanged event handler, you can initialize the security-specific state or load any history required for your Alpha model.

    class MyAlphaModel : AlphaModel
    {
        private Dictionary<symbol, symboldata> _symbolDataBySymbol = new Dictionary<symbol, symboldata>();
        
        public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes) {
            foreach (var security in changes.AddedSecurities)
            {               
                _symbolDataBySymbol[security.Symbol] = new SymbolData(algorithm, security.Symbol);
            }
    
            foreach (var security in changes.RemovedSecurities)
            {
                if (_symbolDataBySymbol.ContainsKey(security.Symbol))
                {
                    _symbolDataBySymbol[security.Symbol].dispose();
                    _symbolDataBySymbol.Remove(security.Symbol);
                }
            }
        }
    
        public class SymbolData 
        {
            private QCAlgorithm _algorithm;
            private Symbol _symbol;
            private SimpleMovingAverage _indicator;
            private TradeBarConsolidator _consolidator;
    
            public SymbolData(QCAlgorithm algorithm, Symbol symbol)
            {
                _algorithm = algorithm;
                _symbol = symbol;
    
                _indicator = new SimpleMovingAverage(20);
                _consolidator = new TradeBarConsolidator(1);
                algorithm.SubscriptionManager.AddConsolidator(symbol, _consolidator);
                algorithm.RegisterIndicator(symbol, _indicator, _consolidator);
                algorithm.WarmUpIndicator(symbol, _indicator);
            }
    
            public void dispose()
            {
                _algorithm.SubscriptionManager.RemoveConsolidator(_symbol, _consolidator);
            }
        }
    }
    class MyAlphaModel(AlphaModel):
        symbol_data_by_symbol = {}
    
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            for security in changes.AddedSecurities:
                self.symbol_data_by_symbol[security.Symbol] = SymbolData(algorithm, security.Symbol)
    
            for security in changes.RemovedSecurities:
                if security.Symbol in self.symbol_data_by_symbol:
                    symbol_data = self.symbol_data_by_symbol.pop(security.Symbol, None)
                    if symbol_data:
                        symbol_data.dispose()
    
    class SymbolData:
        def __init__(self, algorithm, symbol):
            self.algorithm = algorithm
            self.symbol = symbol
    
            self.indicator = SimpleMovingAverage(20)
            self.consolidator = TradeBarConsolidator(1)
            algorithm.SubscriptionManager.AddConsolidator(symbol, self.consolidator)
            algorithm.RegisterIndicator(symbol, self.indicator, self.consolidator)
            algorithm.WarmUpIndicator(self.symbol, self.indicator)
        
        def dispose(self):
            self.algorithm.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)

    Insights

    An Insight is a single prediction for an asset. The Update method returns an array of Insight objects. You can think of these as actionable trading signals, indicating the asset direction, magnitude, and confidence in the near future. All insights can take a weight parameter to set the desired weighting for the insight. If you change the cash of the algorithm, it will affect the orders, but not necessarily the insights.

    The Portfolio Construction model consumes the Insight objects from the Alpha model. It's up to the Portfolio Construction model to define how Insight objects are converted into PortfolioTarget objects. In the pre-built Portfolio Construction models, down insights translate to short-biased trades, up insights translate to long-biased trades, and flat insights usually close open positions, but this doesn't have to be the case in custom Portfolio Construction models .

    Insight Properties

    Insight objects have the following properties:

    Create Insights

    To create an Insight , call the Insight constructor.

    # Insight(symbol, period, type, direction, magnitude=None, confidence=None, sourceModel=None, weight=None)
    insight = Insight("IBM", timedelta(minutes=20), InsightType.Price, InsightDirection.Up)
    // new Insight(symbol, period, type, direction, magnitude=null, confidence=null, sourceModel=null, weight=null);
    var insight = new Insight("IBM", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up);

    In the Insight constructor, the period argument can be a timedelta TimeSpan object or a function that receives a DateTime datetime object and returns the expiry DateTime datetime . Some of the constructor arguments are optional to create the Insight object, but some of the Portfolio Construction models may require these properties. To check which Insight properties a Portfolio Construction model requires, see Supported Models .

    You can also use the helper method to create Insight objects of the Price type.

    # Insight.Price(symbol, period, direction, magnitude=None, confidence=None, sourceModel=None, weight=None) 
    insight = Insight.Price("IBM", timedelta(minutes = 20), InsightDirection.Up)
    
    # Insight.Price(symbol, resolution, barCount, direction, magnitude=None, confidence=None, sourceModel=None, weight=None) 
    insight = Insight.Price("IBM", Resolution.Minute, 20, InsightDirection.Up)
    // new Insight(symbol, period, direction, magnitude=null, confidence=null, sourceModel=null, weight=null)
    var insight = Insight.Price("IBM", TimeSpan.FromMinutes(20), InsightDirection.Up);
    
    // new Insight(symbol, resolution, barCount, direction, magnitude=null, confidence=null, sourceModel=null, weight=null)
    var insight = Insight.Price("IBM", Resolution.Minute, 20, InsightDirection.Up);

    In the Price method, the period argument can be a timedelta TimeSpan object, a DateTime datetime object, or a function that receives a DateTime datetime object and returns the expiry DateTime datetime .

    Group Insights

    Sometimes an algorithm's performance relies on multiple insights being traded together, like in pairs trading and options straddles. These types insights should be grouped. Insight groups signal to the Execution model that the insights need to be acted on as a single unit to maximize the alpha created.

    To mark insights as a group, call the Insight.Group method.

    return Insight.Group(insight1, insight2, insight3);
    return Insight.Group([insight1, insight2,insight3])
    

    Cancel Insights

    If an Alpha model in your algorithm emits an Insight to enter a position but it determines the trading opportunity has pre-maturely ended, you should cancel the Insight. For example, say you want your algorithm to enter a long position in a security when its Relative Strength Index (RSI) moves below 20 and then liquidate the position when the security's RSI moves above 30. If you emit an Insight that has a duration of 30 days when the RSI moves below 20 but the RSI moves above 30 in 10 days, you should cancel the Insight.

    To cancel an Insight, call its Cancel / Expire method with the algorithm's Coordinated Universal Time (UTC).

    self.insight.Cancel(algorithm.UtcTime)
    _insight.Cancel(algorithm.UtcTime);

    If you don't have a reference to the Insight you want to cancel, get it from the InsightManager .

    When you cancel an insight, it's CloseTimeUtc property is set to one second into the past.

    Stop Loss Orders Workaround

    In some cases, if you add a Risk Management model that uses stop loss logic, the Risk Management model generates PortfolioTarget objects with a 0 quantity to make the Execution model liquidate your positions, but then the Portfolio Construction model generates PortfolioTarget objects with a non-zero quantity to make the Execution model re-enter the same position. This issue can occur if your Portfolio Construction model rebalances and your Alpha model still has an active insight for the liquidated securities. To avoid this issue, add the stop loss order logic to the Alpha model. When the stop loss is hit, emit a flat insight for the security. Note that this is a workaround, but it violates the separation of concerns principle since the Alpha Model shouldn't react to open positions.

    Universe Timing Considerations

    If the Alpha model manages some indicators or consolidators for securities in the universe and the universe selection runs during the indicator sampling period or the consolidator aggregation period, the indicators and consolidators might be missing some data. For example, take the following scenario:

    In this scenario, you create and warm-up the indicator at noon. Since it runs at noon, the history request that gathers daily data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. This process doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    17.3.2 Supported Models

    Introduction

    This page describes the pre-built Alpha models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the GitHub repository . If none of these models perform exactly how you want, create a custom Alpha model .

    Null Model

    The NullAlphaModel doesn't emit any insights. It's the default Alpha model.

    AddAlpha(new NullAlphaModel());
    self.AddAlpha(NullAlphaModel())

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Constant Model

    The ConstantAlphaModel always returns the same insight for each security.

    AddAlpha(new ConstantAlphaModel(type, direction, period));
    self.AddAlpha(ConstantAlphaModel(type, direction, period))

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    type InsightType The type of insight
    direction InsightDirection The direction of the insight
    period TimeSpan timedelta The period over which the insight will come to fruition
    magnitude double? float/NoneType The predicted change in magnitude as a +/- percentage null None
    confidence double? float/NoneType The confidence in the insight null None
    weight double? float/NoneType The portfolio weight of the insights null None

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Historical Returns Model

    The HistoricalReturnsAlphaModel buys securities that have a positive trailing return and sells securities that have a negative trailing return. It sets the magnitude of the Insight objects to the trailing rate of change.

    AddAlpha(new HistoricalReturnsAlphaModel());
    self.AddAlpha(HistoricalReturnsAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    lookback int Historical return lookback period 1
    resolution Resolution The resolution of historical data Resolution.Daily

    This model cancels all the active insights it has emit for a security when the security has a 0% historical return.

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    EMA Cross Model

    The EmaCrossAlphaModel uses an exponential moving average (EMA) cross to create insights. When the slow EMA crosses above the fast EMA, it emits up insights. When the slow EMA crosses below the fast EMA, it emits down insights. It sets the duration of Insight objects to be the product of the resolution and fastPeriod arguments.

    AddAlpha(new EmaCrossAlphaModel());
    self.AddAlpha(EmaCrossAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    fastPeriod int The fast EMA period 12
    slowPeriod int The slow EMA period 26
    resolution Resolution The resolution of data sent into the EMA indicators Resolution.Daily

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    MACD Model

    The MacdAlphaModel emits insights based on moving average convergence divergence (MACD) crossovers. If the MACD signal line is 1% above the security price, the model emits an up insight. If the MACD signal line is 1% below the security price, the model emits a down insight. If the MACD signal line is within 1% of the security price, the model cancels all the active insights it has emitted for the security.

    AddAlpha(new MacdAlphaModel());
    self.AddAlpha(MacdAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    fastPeriod int The MACD fast period 12
    slowPeriod int The MACD slow period 26
    signalPeriod int The smoothing period for the MACD signal 9
    movingAverageType MovingAverageType The type of moving average to use in the MACD MovingAverageType.Exponential
    resolution Resolution The resolution of data sent into the MACD indicator Resolution.Daily

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    RSI Model

    The RsiAlphaModel generates insights based on the relative strength index (RSI) indicator values. When the RSI value passes above 70, the model emits a down insight. When the RSI value passes below 30, the model emits an up insight. The model uses the Wilder moving average type and sets the duration of Insight objects to be the product of the resolution and period arguments.

    AddAlpha(new RsiAlphaModel());
    self.AddAlpha(RsiAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    period int The RSI indicator period 14
    resolution Resolution The resolution of data sent into the RSI indicator Resolution.Daily

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Base Pairs Trading Model

    The BasePairsTradingAlphaModel analyzes every possible pair combination from securities that the Universe Selection model selects. This model calculates a ratio between the two securities by dividing their historical prices over a lookback window. It then calculates the mean of this ratio by taking the 500-period EMA of the quotient. When the ratio diverges far enough from the mean ratio, this model emits generates alternating long ratio/short ratio insights emitted as a group to capture the reversion of the ratio.

    AddAlpha(new BasePairsTradingAlphaModel());
    self.AddAlpha(BasePairsTradingAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    lookback int Lookback period of the analysis 1
    resolution Resolution Analysis resolution Resolution.Daily
    threshold decimal float The percent [0, 100] deviation of the ratio from the mean before emitting an insight 1

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Pearson Correlation Pairs Trading Model

    The PearsonCorrelationPairsTradingAlphaModel ranks every pair combination by its Pearson correlation coefficient and trades the pair with the highest correlation. This model follows the same insight logic as the BasePairsTradingModel .

    AddAlpha(new PearsonCorrelationPairsTradingAlphaModel());
    self.AddAlpha(PearsonCorrelationPairsTradingAlphaModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    lookback int Lookback period of the analysis 15
    resolution Resolution Analysis resolution Resolution.Minute
    threshold decimal float The percent [0, 100] deviation of the ratio from the mean before emitting an insight 1
    minimumCorrelation double float The minimum correlation to consider a tradable pair 0.5

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.4 Portfolio Construction

    17.4.1 Key Concepts

    Introduction

    The Portfolio Construction model receives Insight objects from the Alpha model and creates PortfolioTarget objects for the Risk Management model. A PortfolioTarget provides the number of units of an asset to hold.

    Set Models

    To set a Portfolio Construction model, in the Initialize method, call the SetPortfolioConstruction method.

    SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel());
    self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())

    To view all the pre-built Portfolio Construction models, see Supported Models .

    Model Structure

    Portfolio Construction models should extend the PortfolioConstructionModel class or one of the supported models . Extensions of the PortfolioConstructionModel class should implement the CreateTargets method, which receives an array of Insight objects from the Alpha model at every time step and returns an array of PortfolioTarget objects. The Portfolio Construction model seeks to answer the question, "how many units should I buy based on the insight predictions I've been presented?".

    If you don't override the CreateTargets method, the base class implementation calls the model's IsRebalanceDue , DetermineTargetPercent , and GetTargetInsights helper methods. The GetTargetInsights method, in turn, calls the model's ShouldCreateTargetForInsight method. You can override any of these helper methods. If you don't override the CreateTargets method from the PortfolioConstructionModel class, your class must at least override the DetermineTargetPercent method.

    // Portfolio construction scaffolding class; basic method args.
    class MyPortfolioConstructionModel : PortfolioConstructionModel
    {
        // Create list of PortfolioTarget objects from Insights
        public override List<PortfolioTarget> CreateTargets(QCAlgorithm algorithm, Insight[] insights)
        {
            return new List<PortfolioTarget>();
        }
        
        // Determines if the portfolio should rebalance based on the provided rebalancing func
        protected virtual bool IsRebalanceDue(Insight[] insights, DateTime algorithmUtc) => true;
        
        // Determines the target percent for each insight
        protected override Dictionary<Insight, double> DetermineTargetPercent(List<Insight> activeInsights)
        {
            return new Dictionary<Insight, double>();
        }
    
        // Gets the target insights to calculate a portfolio target percent for, they will be piped to DetermineTargetPercent()
        protected override List<Insight> GetTargetInsights()
        {
            return new List<Insight>();
        }
    
        // Determine if the portfolio construction model should create a target for this insight
        protected override bool ShouldCreateTargetForInsight(Insight insight) => true;
    
        // OPTIONAL: Security change details
        public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
        {
            // Security additions and removals are pushed here.
            // This can be used for setting up algorithm state.
            // changes.AddedSecurities
            // changes.RemovedSecurities
        }
    }
     # Portfolio construction scaffolding class; basic method args.
    class MyPortfolioConstructionModel(PortfolioConstructionModel):
        # Create list of PortfolioTarget objects from Insights
        def CreateTargets(self, algorithm: QCAlgorithm, insights: List[Insight]) -> List[PortfolioTarget]:
            return []
    	
        # Determines if the portfolio should rebalance based on the provided rebalancing func
        def IsRebalanceDue(self, insights: List[Insight], algorithmUtc: datetime) -> bool:
            return True
    
        # Determines the target percent for each insight
        def DetermineTargetPercent(self, activeInsights: List[Insight]) -> Dict[Insight, float]:
            return {}
    
        # Gets the target insights to calculate a portfolio target percent for, they will be piped to DetermineTargetPercent()
        def GetTargetInsights(self) -> List[Insight]:
            return []
    
        # Determine if the portfolio construction model should create a target for this insight
        def ShouldCreateTargetForInsight(self, insight: Insight) -> bool:
            return True
    
        # OPTIONAL: Security change details
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            # Security additions and removals are pushed here.
            # This can be used for setting up algorithm state.
            # changes.AddedSecurities:
            # changes.RemovedSecurities:
            pass
    

    The Portfolio Construction model should remove expired insights from the Insight Manager . The CreateTargets definition of the base PortfolioConstructionModel class already removes them during each rebalance. Therefore, if you override the CreateTargets method and don't call the CreateTargets definition of the base class, your new method definition should remove expired insights from the Insight Manager.

    The model should also remove all a security's insights from the Insight Manager when the security is removed from the universe . The OnSecuritiesChanged definition of the base PortfolioConstructionModel class already does this. Therefore, if you override the OnSecuritiesChanged method and don't call the OnSecuritiesChanged definition of the base class, your new method definition should remove the security's insights from the Insight Manager.

    The algorithm argument that the methods receive is an instance of the base QCAlgorithm class, not your subclass of it.

    You may use the PortfolioBias enumeration in the definition of Portfolio Construction model methods. The PortfolioBias enumeration has the following members:

    To view a full example of a PortfolioConstructionModel subclass, see the EqualWeightingPortfolioConstructionModel EqualWeightingPortfolioConstructionModel in the LEAN GitHub repository.

    Multi-Alpha Algorithms

    If you add multiple Alpha models , each Alpha model receives the current slice in the order that you add the Alphas. The combined stream of Insight objects is passed to the Portfolio Construction model.

    Each Portfolio Construction model has a unique method to combine Insight objects. The base PortfolioConstructionModel that most PCM's inherit from doesn't combine information from Insight objects with the same Symbol - but just gets the most recent active insight. To combine the active insights differently, override the GetTargetInsights , and return all active insights. The DetermineTargetPercent method implements the combination criteria and determines the target for each Symbol .

    public class MultipleAlphaPortfolioConstructionModel : PortfolioConstructionModel
    {
        protected override List<Insight> GetTargetInsights()
        {
            return InsightCollection.GetActiveInsights(Algorithm.UtcTime).ToList();
        }
    
        protected override Dictionary<Insight, double> DetermineTargetPercent(List<Insight> activeInsights)
        {
            return new Dictionary<Insight, double>();
        }
    }
    class MultipleAlphaPortfolioConstructionModel(PortfolioConstructionModel):
        def GetTargetInsights(self) -> List[Insight]:
            return list(self.InsightCollection.GetActiveInsights(self.Algorithm.UtcTime))
    
        def DetermineTargetPercent(self, activeInsights: List[Insight]) -> Dict[Insight, float]:
            return {}

    Portfolio Targets

    The Portfolio Construction model returns PortfolioTarget objects, which are passed to the Risk Management model.

    To create a PortfolioTarget object based on a quantity, pass the Symbol and quantity to the PortfolioTarget constructor.

    // Create a new portfolio target for 1200 IBM shares.
    var target = new PortfolioTarget("IBM", 1200);
    # Create a new portfolio target for 1200 IBM shares.
    target = PortfolioTarget("IBM", 1200)

    To create a PortfolioTarget object based on a portfolio weight, call the Percent method. This method is only available for margin accounts.

    // Calculate target equivalent to 10% of portfolio value
    var target = PortfolioTarget.Percent(algorithm, "IBM", 0.1);
    # Calculate target equivalent to 10% of portfolio value
    target = PortfolioTarget.Percent(algorithm, "IBM", 0.1)

    The CreateTargets method of your Portfolio Construction model must return an array of PortfolioTarget objects.

    return new PortfolioTarget[] {  new PortfolioTarget("IBM", 1200)  };
    return [ PortfolioTarget("IBM", 1200) ]

    Portfolio Target Collection

    The PortfolioTargetCollection class is a helper class to manage PortfolioTarget objects. The class manages an internal dictionary that has the security Symbol as the key and a PortfolioTarget as the value.

    Add Portfolio Targets

    To add a PortfolioTarget to the PortfolioTargetCollection , call the Add method.

    _targetsCollection.Add(portfolioTarget);
    self.targets_collection.Add(portfolio_target)

    To add a list of PortfolioTarget objects, call the AddRange method.

    _targetsCollection.AddRange(portfolioTargets);
    self.targets_collection.AddRange(portfolio_targets)

    Check Membership

    To check if a PortfolioTarget exists in the PortfolioTargetCollection , call the Contains method.

    var targetInCollection = _targetsCollection.Contains(portfolioTarget);
    target_in_collection = self.targets_collection.Contains(portfolio_target)

    To check if a Symbol exists in the PortfolioTargetCollection , call the ContainsKey method.

    var symbolInCollection = _targetsCollection.ContainsKey(symbol);
    symbol_in_collection = self.targets_collection.ContainsKey(symbol)

    To get all the Symbol objects, use the Keys property.

    var symbols = _targetsCollection.Keys;
    symbols = self.targets_collection.Keys

    Access Portfolio Targets

    To access the PortfolioTarget objects for a Symbol, index the PortfolioTargetCollection with the Symbol.

    var portfolioTarget = _targetsCollection[symbol];
    portfolio_target = self.targets_collection[symbol]

    To iterate through the PortfolioTargetCollection , call the GetEnumerator method.

    var enumerator = _targetsCollection.GetEnumerator();
    enumerator = self.targets_collection.GetEnumerator()

    To get all the PortfolioTarget objects, use the Values property

    var portfolioTargets = _targetsCollection.Values;
    portfolio_targets = self.targets_collection.Values

    Order Portfolio Targets by Margin Impact

    To get an enumerable where position reducing orders are executed first and the remaining orders are executed in decreasing order value, call the OrderByMarginImpact method.

    foreach (var target in _targetsCollection.OrderByMarginImpact(algorithm))
    {
        // Place order
    }
    for target in self.targets_collection.OrderByMarginImpact(algorithm):
        # Place order

    This method won't return targets for securities that have no data yet. This method also won't return targets for which the sum of the current holdings and open orders quantity equals the target quantity.

    Remove Portfolio Targets

    To remove a PortfolioTarget from the PortfolioTargetCollection , call the Remove method.

    removeSuccessful = _targetsCollection.Remove(symbol);
    remove_successful = self.targets_collection.Remove(symbol)

    To remove all the PortfolioTarget objects, call the Clear method.

    _targetsCollection.Clear();
    self.targets_collection.Clear()

    To remove all the PortfolioTarget objects that have been fulfilled, call the ClearFulfilled method.

    _targetsCollection.ClearFulfilled(algorithm);
    self.targets_collection.ClearFulfilled(algorithm)

    Copy Portfolio Targets

    To copy a subset of the PortfolioTarget objects in the PortfolioTargetCollection to an array, call the CopyTo method. The arrayIndex argument is the zero-based index in the array at which copying begins.

    _targetsCollection.CopyTo(array, arrayIndex);
    self.targets_collection.CopyTo(array, arrayIndex)

    Rebalance Frequency

    If you use a Portfolio Construction model that is a subclass of the PortfolioConstructionModel class, you can set the rebalancing frequency of the model with a function. The rebalancing function receives the Coordinated Universal Time (UTC) of the algorithm and should return the next rebalance UTC time or None null . If the function returns None null , the model doesn't rebalance unless the rebalance settings trigger a rebalance. For a full example of a custom rebalance function, see the PortfolioRebalanceOnCustomFuncRegressionAlgorithm PortfolioRebalanceOnCustomFuncRegressionAlgorithm .

    If you use a Portfolio Construction model with the following characteristics, you can also set the rebalancing frequency of the model with a timedelta TimeSpan , Resolution , or DateRules :

    To check which of the pre-built Portfolio Construction models support this functionality, see Supported Models .

    Rebalance Settings

    By default, portfolio construction models create PortfolioTarget objects to rebalance the portfolio when any of the following events occur:

    To disable rebalances when the Alpha model emits insights or when insights expire, set RebalancePortfolioOnInsightChanges to false.

    // In Initialize
    Settings.RebalancePortfolioOnInsightChanges = false;
    # In Initialize
    self.Settings.RebalancePortfolioOnInsightChanges = False

    To disable rebalances when security changes occur, set RebalancePortfolioOnSecurityChanges to false.

    // In Initialize
    Settings.RebalancePortfolioOnSecurityChanges = false;
    # In Initialize
    self.Settings.RebalancePortfolioOnSecurityChanges = False

    Portfolio Optimizer Structure

    Some portfolio construction models contain an optimizer that accepts the historical returns of each security and returns a list of optimized portfolio weights. Portfolio optimizer models must implement the IPortfolioOptimizer interface, which has an Optimize method.

    public class MyPortfolioOptimizer : IPortfolioOptimizer
    {
        public double[] Optimize(double[,] historicalReturns, double[] expectedReturns = null, double[,] covariance = null)
        {
            // Create weights
            return weights;
        }
    }
    class MyPortfolioOptimizer:
    
        def Optimize(self, historicalReturns: pd.DataFrame, expectedReturns: pd.Series = None, covariance: pd.DataFrame = None) -> pd.Series:
            # Create weights
            return weights

    The following table describes the arguments the Optimize method accepts:

    Argument Data Type Description Default Value
    historicalReturns double[,] DataFrame Matrix of annualized historical returns where each column represents a security and each row returns for the given date/time (size: K x N)
    expectedReturns double[] Series Array of double with the portfolio annualized expected returns (size: K x 1) null None
    covariance double[,] DataFrame Multi-dimensional array of double with the portfolio covariance of annualized returns (size: K x K) null None

    The method should return a K x 1 array of double objects that represent the portfolio weights.

    To view all the pre-built portfolio optimization algorithms, see Supported Optimizers .

    To view a full example of an IPortfolioOptimizer implementation, see the MaximumSharpeRatioPortfolioOptimizer MaximumSharpeRatioPortfolioOptimizer in the LEAN GitHub repository.

    Track Security Changes

    The Universe Selection model may select a dynamic universe of assets, so you should not assume a fixed set of assets in the Portfolio Construction model. When the Universe Selection model adds and removes assets from the universe, it triggers an OnSecuritiesChanged event. In the OnSecuritiesChanged event handler, you can initialize the security-specific state or load any history required for your Portfolio Construction model.

    class MyPortfolioConstructionModel : PortfolioConstructionModel{
        private Dictionary<symbol, symboldata> _symbolDataBySymbol = new Dictionary<symbol, symboldata>();
    
        public override void OnSecuritiesChanged(QCAlgorithmFramework algorithm, SecurityChanges changes)
        {
            base.OnSecuritiesChanged(algorithm, changes);
            foreach (var security in changes.AddedSecurities)
            {               
                _symbolDataBySymbol[security.Symbol] = new SymbolData(security.Symbol);
            }
    
            foreach (var security in changes.RemovedSecurities)
            {
                if (_symbolDataBySymbol.ContainsKey(security.Symbol))
                {
                    _symbolDataBySymbol.Remove(security.Symbol);
                }
            }
        }
    
        public class SymbolData 
        {
            private Symbol _symbol;
    
            public SymbolData(Symbol symbol)
            {
                _symbol = symbol;
                // Store and manage Symbol-specific data
            }
        }
    }
    class MyPortfolioConstructionModel(PortfolioConstructionModel):
        symbol_data_by_symbol = {}
    
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            super().OnSecuritiesChanged(algorithm, changes)
            for security in changes.AddedSecurities:
                self.symbol_data_by_symbol[security.Symbol] = SymbolData(security.Symbol)
    
            for security in changes.RemovedSecurities:
                if security.Symbol in self.symbol_data_by_symbol:
                    self.symbol_data_by_symbol.pop(security.Symbol, None)
    
    class SymbolData:
        def __init__(self, symbol):
            self.symbol = symbol
            # Store and manage Symbol-specific data

    Universe Timing Considerations

    If the Portfolio Construction model manages some indicators or consolidators for securities in the universe and the universe selection runs during the indicator sampling period or the consolidator aggregation period, the indicators and consolidators might be missing some data. For example, take the following scenario:

    In this scenario, you create and warm-up the indicator at noon. Since it runs at noon, the history request that gathers daily data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. This process doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    17.4.2 Supported Models

    Introduction

    This page describes the pre-built Portfolio Construction models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the GitHub repository . If none of these models perform exactly how you want, create a custom Portfolio Construction model .

    Null Model

    The NullPortfolioConstructionModel is the default Portfolio Construction model. It doesn't return any PortfolioTarget objects. It's useful if you need to analyze an Alpha model in isolation.

    SetPortfolioConstruction(new NullPortfolioConstructionModel()); 
    self.SetPortfolioConstruction(NullPortfolioConstructionModel()) 

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Equal Weighting Model

    The EqualWeightingPortfolioConstructionModel assigns an equal share of the portfolio to the securities with active insights. This weighting scheme is useful for universe rotation based on simple portfolio strategies.

    SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel());
    self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance resolution Resolution Rebalancing frequency Resolution.Daily

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Confidence Weighted Model

    The ConfidenceWeightedPortfolioConstructionModel generates target portfolio weights based on the Insight.Confidence for the last Insight of each Symbol. If the Insight has a direction of InsightDirection.Up , the model generates long targets. If the Insight has a direction of InsightDirection.Down , the model generates short targets. If the sum of all the last active Insight per Symbol is greater than 1, the model factors down each target percent holdings proportionally so the sum is 1. The model ignores Insight objects that have no Confidence value.

    SetPortfolioConstruction(new ConfidenceWeightedPortfolioConstructionModel());
    self.SetPortfolioConstruction(ConfidenceWeightedPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance resolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Insight Weighting Model

    The InsightWeightingPortfolioConstructionModel generates target portfolio weights based on the Insight.Weight for the last Insight of each Symbol. If the Insight has a direction of InsightDirection.Up , the model generates long targets. If the Insight has a direction of InsightDirection.Down , the model generates short targets. If the sum of all the last active Insight per Symbol is greater than 1, the model factors down each target percent holdings proportionally so the sum is 1. The model ignores Insight objects that have no Weight value.

    SetPortfolioConstruction(new InsightWeightingPortfolioConstructionModel());
    self.SetPortfolioConstruction(InsightWeightingPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance resolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Sector Weighting Model

    The SectorWeightingPortfolioConstructionModel generates target portfolio weights based on the CompanyReference.IndustryTemplateCode provided by the US Fundamental dataset . The target percent holdings of each sector is 1/S where S is the number of sectors and the target percent holdings of each security is 1/N where N is the number of securities of each sector. If the insight has a direction of InsightDirection.Up , the model generates long targets. If the insight has a direction of InsightDirection.Down , the model generates short targets. The model ignores Insight objects for Symbols that have no CompanyReference.IndustryTemplateCode .

    SetPortfolioConstruction(new SectorWeightingPortfolioConstructionModel());
    self.SetPortfolioConstruction(SectorWeightingPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance resolution Resolution Rebalancing frequency Resolution.Daily

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Accumulative Insight Model

    The AccumulativeInsightPortfolioConstructionModel generates target portfolio weights based on all the active insights of a security. For each active Insight of direction InsightDirection.Up , it increases the position size by a fixed percent. For each active Insight of direction InsightDirection.Down , it decreases the position size by a fixed percent. For each active Insight of direction InsightDirection.Flat , it moves the position size towards 0 by a fixed percent.

    SetPortfolioConstruction(new AccumulativeInsightPortfolioConstructionModel());
    self.SetPortfolioConstruction(AccumulativeInsightPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance rebalanceFunc Func<DateTime, DateTime?> Any of the following types:
    • timedelta
    • Resolution
    • DateRules
    • None
    • Callable[[datetime], datetime]
    A function that receives the algorithm UTC time and returns the next expected rebalance time. If the function returns None null , the portfolio doesn't rebalance. Rebalancing parameter. If it's a timedelta , DateRules or Resolution , it's converted into a function. If it's None , it's ignored. The function returns the next expected rebalance time for a given algorithm UTC DateTime. The function returns None if unknown, in which case the function will be called again in the next loop. If the function returns the current time, the portfolio rebalances. None null
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort
    percent PortfolioBias The percentage amount of the portfolio value to allocate to a single insight 0.03 (3%)

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Mean Variance Optimization Model

    The MeanVarianceOptimizationPortfolioConstructionModel seeks to build a portfolio with the least volatility possible and achieve a target return.

    SetPortfolioConstruction(new MeanVarianceOptimizationPortfolioConstructionModel());
    self.SetPortfolioConstruction(MeanVarianceOptimizationPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance rebalanceResolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort
    lookback int Historical return lookback period 1
    period int The time interval of history price to calculate the weight 63
    resolution Resolution The resolution of the history price Resolution.Daily
    targetReturn double float The target portfolio return 0.02 (2%)
    optimizer IPortfolioOptimizer The portfolio optimization algorithm null None

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency . If you don't provide an optimizer argument, the default one is the MinimumVariancePortfolioOptimizer with upper and lower weights that respect the portfolioBias .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Black Litterman Optimization Model

    The BlackLittermanOptimizationPortfolioConstructionModel receives Insight objects from multiple Alphas and combines them into a single portfolio. These multiple sources of Alpha models can be seen as the "investor views" required in the classical model.

    SetPortfolioConstruction(new BlackLittermanOptimizationPortfolioConstructionModel());
    self.SetPortfolioConstruction(BlackLittermanOptimizationPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance rebalanceResolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort
    lookback int Historical return lookback period 1
    period int The time interval of history price to calculate the weight 63
    resolution Resolution The resolution of the history price Resolution.Daily
    risk_free_rate riskFreeRate double float The risk free rate 0.0
    delta double float The risk aversion coefficient of the market portfolio 2.5
    tau double float The model parameter indicating the uncertainty of the CAPM prior 0.05
    optimizer IPortfolioOptimizer The portfolio optimization algorithm null None

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency . If you don't provide an optimizer argument, the default one is the MinimumVariancePortfolioOptimizer with upper and lower weights that respect the portfolioBias .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Mean Reversion Model

    The MeanReversionPortfolioConstructionModel implements an on-line portfolio selection technique, named "On-Line Moving Average Reversion" (OLMAR). The basic idea is to represent multi-period mean reversion as "Moving Average Reversion" (MAR), which explicitly predicts next price relatives using moving averages and then forms portfolios with online learning techniques.

    SetPortfolioConstruction(new MeanReversionPortfolioConstructionModel());
    self.SetPortfolioConstruction(MeanReversionPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance rebalanceResolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort
    reversionThreshold decimal float Reversion threshold 1
    windowSize int The window size of mean price 20
    resolution Resolution The resolution of the history price Resolution.Daily

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Reference:

    Risk Parity Model

    The RiskParityPortfolioConstructionModel seeks to build a portfolio with the equal contribution of risk to the total portfolio risk from all assets.

    SetPortfolioConstruction(new RiskParityPortfolioConstructionModel());
    self.SetPortfolioConstruction(RiskParityPortfolioConstructionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    rebalance rebalanceResolution Resolution Rebalancing frequency Resolution.Daily
    portfolioBias PortfolioBias The bias of the portfolio PortfolioBias.LongShort
    lookback int Historical return lookback period 1
    period int The time interval of history price to calculate the weight 252
    resolution Resolution The resolution of the history price Resolution.Daily
    optimizer IPortfolioOptimizer The portfolio optimization algorithm null None

    This model supports other data types for the rebalancing frequency argument. For more information about the supported types, see Rebalance Frequency . If you don't provide an optimizer argument, the default one is the RiskParityPortfolioOptimizer .

    This model removes expired insights from the Insight Manager during each rebalance. It also removes all insights for a security when the security is removed from the universe .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.4.3 Supported Optimizers

    Introduction

    This page describes the pre-built Portfolio Optimizer models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the GitHub repository . If none of these models perform exactly how you want, create a custom Portfolio Optimizer model .

    Maximum Sharpe Ratio Optimizer

    The MaximumSharpeRatioPortfolioOptimizer seeks to maximize the portfolio Sharpe Ratio .

    var optimizer = new MaximumSharpeRatioPortfolioOptimizer();
    optimizer = MaximumSharpeRatioPortfolioOptimizer()

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    minimum_weight lower double float The lower bounds on portfolio weights -1
    maximum_weight upper double float The upper bounds on portfolio weights 1
    risk_free_rate riskFreeRate double float The risk free rate 0

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Minimum Variance Optimizer

    The MinimumVariancePortfolioOptimizer seeks to minimize the portfolio variance and achieve a target return.

    var optimizer = new MinimumVariancePortfolioOptimizer();
    optimizer = MinimumVariancePortfolioOptimizer()

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    minimum_weight lower double float The lower bounds on portfolio weights -1
    maximum_weight upper double float The upper bounds on portfolio weights 1
    target_return targetReturn double float The target portfolio return 0.02 (2%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Unconstrained Mean Variance Optimizer

    The UnconstrainedMeanVariancePortfolioOptimizer seeks to find the optimal risk-adjusted portfolio that lies on the efficient frontier.

    var optimizer = new UnconstrainedMeanVariancePortfolioOptimizer(historicalReturns);
    optimizer = UnconstrainedMeanVariancePortfolioOptimizer(historical_returns)

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    historicalReturns double[,] DataFrame Matrix of historical returns where each column represents a security and each row returns for the given date/time (size: K x N)
    expectedReturns double[] Series Array of double with the portfolio expected returns (size: K x 1) null None
    covariance double[,] DataFrame Multi-dimensional array of double with the portfolio covariance of returns (size: K x K) null None

    If you don't provide an argument for expectedReturns or covariance , it's calculated based on the historicalReturns .

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Risk Parity Optimizer

    The RiskParityPortfolioOptimizer seeks to equalize the individual risk contribution to the total portfolio risk from each asset.

    var optimizer = new RiskParityPortfolioOptimizer();
    optimizer = RiskParityPortfolioOptimizer()

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    minimum_weight lower double float The lower bounds on portfolio weights 1e-05
    maximum_weight upper double float The upper bounds on portfolio weights sys.float_info.max Double.MaxValue

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.5 Risk Management

    17.5.1 Key Concepts

    Introduction

    The Risk Management model seeks to manage risk on the PortfolioTarget collection it receives from the Portfolio Construction model before the targets reach the Execution model. There are many creative ways to manage risk. Some examples of risk management include the following:

    Add Models

    To set a Risk Management model, in the Initialize method, call the AddRiskManagement method.

    self.AddRiskManagement(NullRiskManagementModel())
    AddRiskManagement(new NullRiskManagementModel());

    To view all the pre-built Risk Management models, see Supported Models .

    Multi-Model Algorithms

    To add multiple Risk Management models, in the Initialize method, call the AddRiskManagement method multiple times.

    AddRiskManagement(new MaximumDrawdownPercentPerSecurity());
    AddRiskManagement(new MaximumSectorExposureRiskManagementModel());
    self.AddRiskManagement(MaximumDrawdownPercentPerSecurity())
    self.AddRiskManagement(MaximumSectorExposureRiskManagementModel())

    If you add multiple Risk Management models, the original collection of PortfolioTarget objects from the Portfolio Construction model is passed to the first Risk Management model. The risk-adjusted targets from the first Risk Management model are passed to the second Risk Management model. The process continues sequentially until all of the Risk Management models have had an opportunity to adjust the targets.

    Model Structure

    Risk Management models should extend the RiskManagementModel class. Extensions of the RiskManagementModel class must implement the ManageRisk method, which receives an array of PortfolioTarget objects from the Portfolio Construction model at every time step and should return an array of risk-adjusted PortfolioTarget objects. The method should only return the adjusted targets, not all of targets. If the method creates a PortfolioTarget object to liquidate a security, cancel the security's insights to avoid re-entering the position.

    class MyRiskManagementModel : RiskManagementModel
    {
        // Adjust the portfolio targets and return them. If no changes emit nothing.
        public override List<PortfolioTarget> ManageRisk(QCAlgorithm algorithm, PortfolioTarget[] targets)
        {
            return new List<PortfolioTarget>();
        }
    
        // Optional: Be notified when securities change
        public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
        {
            // Security additions and removals are pushed here.
            // This can be used for setting up algorithm state.
            // changes.AddedSecurities
            // changes.RemovedSecurities
        }
    }
    class MyRiskManagementModel(RiskManagementModel):
        # Adjust the portfolio targets and return them. If no changes emit nothing.
        def ManageRisk(self, algorithm: QCAlgorithm, targets: List[PortfolioTarget]) -> List[PortfolioTarget]:
            return []
    
        # Optional: Be notified when securities change
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            # Security additions and removals are pushed here.
            # This can be used for setting up algorithm state.
            # changes.AddedSecurities
            # changes.RemovedSecurities
            pass
    

    The algorithm argument that the methods receive is an instance of the base QCAlgorithm class, not your subclass of it.

    To view a full example of a RiskManagementModel subclass, see the MaximumDrawdownPercentPerSecurity MaximumDrawdownPercentPerSecurity in the LEAN GitHub repository.

    Track Security Changes

    The Universe Selection model may select a dynamic universe of assets, so you should not assume a fixed set of assets in the Risk Management model. When the Universe Selection model adds and removes assets from the universe, it triggers an OnSecuritiesChanged event. In the OnSecuritiesChanged event handler, you can initialize the security-specific state or load any history required for your Risk Management model.

    class MyRiskManagementModel : RiskManagementModel{
        private Dictionary<symbol, symboldata> _symbolDataBySymbol = new Dictionary<symbol, symboldata>();
    
        public override void OnSecuritiesChanged(QCAlgorithmFramework algorithm, SecurityChanges changes)
        {
            base.OnSecuritiesChanged(algorithm, changes);
            foreach (var security in changes.AddedSecurities)
            {               
                _symbolDataBySymbol[security.Symbol] = new SymbolData(security.Symbol);
            }
    
            foreach (var security in changes.RemovedSecurities)
            {
                if (_symbolDataBySymbol.ContainsKey(security.Symbol))
                {
                    _symbolDataBySymbol.Remove(security.Symbol);
                }
            }
        }
    
        public class SymbolData 
        {
            private Symbol _symbol;
    
            public SymbolData(Symbol symbol)
            {
                _symbol = symbol;
                // Store and manage Symbol-specific data
            }
        }
    }
    class MyRiskManagementModel(RiskManagementModel):
        symbol_data_by_symbol = {}
    
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            super().OnSecuritiesChanged(algorithm, changes)
            for security in changes.AddedSecurities:
                self.symbol_data_by_symbol[security.Symbol] = SymbolData(security.Symbol)
    
            for security in changes.RemovedSecurities:
                if security.Symbol in self.symbol_data_by_symbol:
                    self.symbol_data_by_symbol.pop(security.Symbol, None)
    
    class SymbolData:
        def __init__(self, symbol):
            self.symbol = symbol
            # Store and manage Symbol-specific data

    Portfolio Target Collection

    The PortfolioTargetCollection class is a helper class to manage PortfolioTarget objects. The class manages an internal dictionary that has the security Symbol as the key and a PortfolioTarget as the value.

    Add Portfolio Targets

    To add a PortfolioTarget to the PortfolioTargetCollection , call the Add method.

    _targetsCollection.Add(portfolioTarget);
    self.targets_collection.Add(portfolio_target)

    To add a list of PortfolioTarget objects, call the AddRange method.

    _targetsCollection.AddRange(portfolioTargets);
    self.targets_collection.AddRange(portfolio_targets)

    Check Membership

    To check if a PortfolioTarget exists in the PortfolioTargetCollection , call the Contains method.

    var targetInCollection = _targetsCollection.Contains(portfolioTarget);
    target_in_collection = self.targets_collection.Contains(portfolio_target)

    To check if a Symbol exists in the PortfolioTargetCollection , call the ContainsKey method.

    var symbolInCollection = _targetsCollection.ContainsKey(symbol);
    symbol_in_collection = self.targets_collection.ContainsKey(symbol)

    To get all the Symbol objects, use the Keys property.

    var symbols = _targetsCollection.Keys;
    symbols = self.targets_collection.Keys

    Access Portfolio Targets

    To access the PortfolioTarget objects for a Symbol, index the PortfolioTargetCollection with the Symbol.

    var portfolioTarget = _targetsCollection[symbol];
    portfolio_target = self.targets_collection[symbol]

    To iterate through the PortfolioTargetCollection , call the GetEnumerator method.

    var enumerator = _targetsCollection.GetEnumerator();
    enumerator = self.targets_collection.GetEnumerator()

    To get all the PortfolioTarget objects, use the Values property

    var portfolioTargets = _targetsCollection.Values;
    portfolio_targets = self.targets_collection.Values

    Order Portfolio Targets by Margin Impact

    To get an enumerable where position reducing orders are executed first and the remaining orders are executed in decreasing order value, call the OrderByMarginImpact method.

    foreach (var target in _targetsCollection.OrderByMarginImpact(algorithm))
    {
        // Place order
    }
    for target in self.targets_collection.OrderByMarginImpact(algorithm):
        # Place order

    This method won't return targets for securities that have no data yet. This method also won't return targets for which the sum of the current holdings and open orders quantity equals the target quantity.

    Remove Portfolio Targets

    To remove a PortfolioTarget from the PortfolioTargetCollection , call the Remove method.

    removeSuccessful = _targetsCollection.Remove(symbol);
    remove_successful = self.targets_collection.Remove(symbol)

    To remove all the PortfolioTarget objects, call the Clear method.

    _targetsCollection.Clear();
    self.targets_collection.Clear()

    To remove all the PortfolioTarget objects that have been fulfilled, call the ClearFulfilled method.

    _targetsCollection.ClearFulfilled(algorithm);
    self.targets_collection.ClearFulfilled(algorithm)

    Copy Portfolio Targets

    To copy a subset of the PortfolioTarget objects in the PortfolioTargetCollection to an array, call the CopyTo method. The arrayIndex argument is the zero-based index in the array at which copying begins.

    _targetsCollection.CopyTo(array, arrayIndex);
    self.targets_collection.CopyTo(array, arrayIndex)

    Universe Timing Considerations

    If the Risk Management model manages some indicators or consolidators for securities in the universe and the universe selection runs during the indicator sampling period or the consolidator aggregation period, the indicators and consolidators might be missing some data. For example, take the following scenario:

    In this scenario, you create and warm-up the indicator at noon. Since it runs at noon, the history request that gathers daily data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. This process doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    17.5.2 Supported Models

    Introduction

    This page describes the pre-built Risk Management models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the GitHub repository . If none of these models perform exactly how you want, create a custom Risk Management model .

    Null Model

    The NullRiskManagementModel is the default Risk Management model. It doesn't adjust any of the PortfolioTarget objects it receives from the Portfolio Construction model.

    AddRiskManagement(new NullRiskManagementModel());
    self.AddRiskManagement(NullRiskManagementModel())

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Maximum Security Drawdown Model

    The MaximumDrawdownPercentPerSecurity model monitors the unrealized profit percentage of each security in the portfolio. When the percentage drops below a threshold relative to the opening price, it liquidates the position and cancels all insights in the Insight Manager that are for the security. This model can operate even when the Portfolio Construction model provides an empty list of PortfolioTarget objects.

    AddRiskManagement(new MaximumDrawdownPercentPerSecurity());
    self.AddRiskManagement(MaximumDrawdownPercentPerSecurity())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    maximumDrawdownPercent decimal float The maximum percentage drawdown allowed for any single security holding 0.05 (5%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Maximum Portfolio Drawdown Model

    The MaximumDrawdownPercentPortfolio model monitors the portfolio drawdown . The drawdown can be relative to the starting portfolio value or the maximum portfolio value. When the portfolio value drops below a percentage threshold, the model liquidates the portfolio and cancels all insights in the Insight Manager . To liquidate the portfolio, the model must receive at least 1 PortfolioTarget after the drawdown threshold is passed. After the portfolio is liquidated, the model resets. This model can operate even when the Portfolio Construction model provides an empty list of PortfolioTarget objects.

    AddRiskManagement(new MaximumDrawdownPercentPortfolio());
    self.AddRiskManagement(MaximumDrawdownPercentPortfolio())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    maximumDrawdownPercent decimal float Maximum spread accepted comparing to current price in percentage 0.05 (5%)
    isTrailing bool If "false", the drawdown is relative to the starting value of the portfolio. If "true", the drawdown is relative the last maximum portfolio value False false

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Maximum Unrealized Profit Model

    The MaximumUnrealizedProfitPercentPerSecurity model monitors the unrealized profit of each security in the portfolio. When the unrealized profit exceeds a profit threshold, it liquidates the position and cancels all insights in the Insight Manager that are for the security. This model can operate even when the Portfolio Construction model provides an empty list of PortfolioTarget objects.

    AddRiskManagement(new MaximumUnrealizedProfitPercentPerSecurity());
    self.AddRiskManagement(MaximumUnrealizedProfitPercentPerSecurity())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    maximumUnrealizedProfitPercent decimal float The maximum percentage unrealized profit allowed for any single security holding 0.05 (5%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Maximum Sector Exposure Model

    The MaximumSectorExposureRiskManagementModel limits the absolute portfolio exposure in a each industry sector to a predefined maximum percentage. If the absolute portfolio exposure exceeds the maximum percentage, the weight of each Equity in the sector is scaled down so the sector doesn't exceed the maximum percentage. This process requires assets that are selected by Morningstar fine fundamental data . This model can operate even when the Portfolio Construction model provides an empty list of PortfolioTarget objects.

    AddRiskManagement(new MaximumSectorExposureRiskManagementModel());
    self.AddRiskManagement(MaximumSectorExposureRiskManagementModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    maximumSectorExposure decimal float The maximum exposure for any sector 0.2 (20%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Trailing Stop Model

    The TrailingStopRiskManagementModel monitors the drawdown of each security in the portfolio. When the peak-to-trough drawdown of the unrealized profit exceeds a threshold, it liquidates the position and cancels all insights in the Insight Manager that are for the security. This model can operate even when the Portfolio Construction model provides an empty list of PortfolioTarget objects.

    AddRiskManagement(new TrailingStopRiskManagementModel());
    self.AddRiskManagement(TrailingStopRiskManagementModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    maximumDrawdownPercent decimal float The maximum percentage drawdown allowed for algorithm portfolio compared with the highest unrealized profit 0.05 (5%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.6 Execution

    17.6.1 Key Concepts

    Introduction

    The Execution model receives an array of risk-adjusted PortfolioTarget objects from the Risk Management model and places trades in the market to satisfy the targets. The Execution model only receives updates to the portfolio target share counts. It doesn't necessarily receive all of the targets at once.

    Set Models

    To set an Execution model, in the Initialize method, call the SetExecution method.

    SetExecution(new ImmediateExecutionModel()); 
    self.SetExecution(ImmediateExecutionModel()) 

    To view all the pre-built Execution models, see Supported Models .

    Model Structure

    Execution models should extend the ExecutionModel class. Extensions of the ExecutionModel must implement the Execute method, which receives an array of PortfolioTarget objects at every time step and is responsible for reaching the target portfolio as efficiently as possible. The Portfolio Construction model creates the PortfolioTarget objects, the Risk Management model may adjust them, and then the Execution model places the orders to fulfill them.

     // Basic Execution Model Scaffolding Structure Example
    class MyExecutionModel : ExecutionModel {
    
       // Fill the supplied portfolio targets efficiently.
       public override void Execute(QCAlgorithmFramework algorithm, IPortfolioTarget[] targets)
       {
          // NOP
       }
    
       //  Optional: Securities changes event for handling new securities.
       public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
       {
            // Security additions and removals are pushed here.
            // This can be used for setting up algorithm state.
            // changes.AddedSecurities
            // changes.RemovedSecurities
       }
    }
    # Execution Model scaffolding structure example
    class MyExecutionModel(ExecutionModel):
    
        # Fill the supplied portfolio targets efficiently
        def Execute(self, algorithm: QCAlgorithm, targets: List[PortfolioTarget]) -> None:
            pass
    
        # Optional: Securities changes event for handling new securities.
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            # Security additions and removals are pushed here.
            # This can be used for setting up algorithm state.
            # changes.AddedSecurities
            # changes.RemovedSecurities
            pass

    The algorithm argument that the methods receive is an instance of the base QCAlgorithm class, not your subclass of it.

    The following table describes the properties of the PortfolioTarget class that you may access in the Execution model:

    Property Data Type Description
    Symbol Symbol Asset to trade
    Quantity decimal float Number of units to hold

    To view a full example of an ExecutionModel subclass, see the ImmediateExecutionModel ImmediateExecutionModel in the LEAN GitHub repository.

    Track Security Changes

    The Universe Selection model may select a dynamic universe of assets, so you should not assume a fixed set of assets in the Execution model. When the Universe Selection model adds and removes assets from the universe, it triggers an OnSecuritiesChanged event. In the OnSecuritiesChanged event handler, you can initialize the security-specific state or load any history required for your Execution model.

    class MyExecutionModel : ExecutionModel{
        private Dictionary<symbol, symboldata> _symbolDataBySymbol = new Dictionary<symbol, symboldata>();
    
        public override void OnSecuritiesChanged(QCAlgorithmFramework algorithm, SecurityChanges changes)
        {
            foreach (var security in changes.AddedSecurities)
            {               
                _symbolDataBySymbol[security.Symbol] = new SymbolData(security.Symbol);
            }
    
            foreach (var security in changes.RemovedSecurities)
            {
                if (_symbolDataBySymbol.ContainsKey(security.Symbol))
                {
                    _symbolDataBySymbol.Remove(security.Symbol);
                }
            }
        }
    
        public class SymbolData 
        {
            private Symbol _symbol;
    
            public SymbolData(Symbol symbol)
            {
                _symbol = symbol;
                // Store and manage Symbol-specific data
            }
        }
    }
    class MyExecutionModel(ExecutionModel):
        symbol_data_by_symbol = {}
    
        def OnSecuritiesChanged(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
            for security in changes.AddedSecurities:
                self.symbol_data_by_symbol[security.Symbol] = SymbolData(security.Symbol)
    
            for security in changes.RemovedSecurities:
                if security.Symbol in self.symbol_data_by_symbol:
                    self.symbol_data_by_symbol.pop(security.Symbol, None)
    
    class SymbolData:
        def __init__(self, symbol):
            self.symbol = symbol
            # Store and manage Symbol-specific data

    Portfolio Target Collection

    The PortfolioTargetCollection class is a helper class to manage PortfolioTarget objects. The class manages an internal dictionary that has the security Symbol as the key and a PortfolioTarget as the value.

    Add Portfolio Targets

    To add a PortfolioTarget to the PortfolioTargetCollection , call the Add method.

    _targetsCollection.Add(portfolioTarget);
    self.targets_collection.Add(portfolio_target)

    To add a list of PortfolioTarget objects, call the AddRange method.

    _targetsCollection.AddRange(portfolioTargets);
    self.targets_collection.AddRange(portfolio_targets)

    Check Membership

    To check if a PortfolioTarget exists in the PortfolioTargetCollection , call the Contains method.

    var targetInCollection = _targetsCollection.Contains(portfolioTarget);
    target_in_collection = self.targets_collection.Contains(portfolio_target)

    To check if a Symbol exists in the PortfolioTargetCollection , call the ContainsKey method.

    var symbolInCollection = _targetsCollection.ContainsKey(symbol);
    symbol_in_collection = self.targets_collection.ContainsKey(symbol)

    To get all the Symbol objects, use the Keys property.

    var symbols = _targetsCollection.Keys;
    symbols = self.targets_collection.Keys

    Access Portfolio Targets

    To access the PortfolioTarget objects for a Symbol, index the PortfolioTargetCollection with the Symbol.

    var portfolioTarget = _targetsCollection[symbol];
    portfolio_target = self.targets_collection[symbol]

    To iterate through the PortfolioTargetCollection , call the GetEnumerator method.

    var enumerator = _targetsCollection.GetEnumerator();
    enumerator = self.targets_collection.GetEnumerator()

    To get all the PortfolioTarget objects, use the Values property

    var portfolioTargets = _targetsCollection.Values;
    portfolio_targets = self.targets_collection.Values

    Order Portfolio Targets by Margin Impact

    To get an enumerable where position reducing orders are executed first and the remaining orders are executed in decreasing order value, call the OrderByMarginImpact method.

    foreach (var target in _targetsCollection.OrderByMarginImpact(algorithm))
    {
        // Place order
    }
    for target in self.targets_collection.OrderByMarginImpact(algorithm):
        # Place order

    This method won't return targets for securities that have no data yet. This method also won't return targets for which the sum of the current holdings and open orders quantity equals the target quantity.

    Remove Portfolio Targets

    To remove a PortfolioTarget from the PortfolioTargetCollection , call the Remove method.

    removeSuccessful = _targetsCollection.Remove(symbol);
    remove_successful = self.targets_collection.Remove(symbol)

    To remove all the PortfolioTarget objects, call the Clear method.

    _targetsCollection.Clear();
    self.targets_collection.Clear()

    To remove all the PortfolioTarget objects that have been fulfilled, call the ClearFulfilled method.

    _targetsCollection.ClearFulfilled(algorithm);
    self.targets_collection.ClearFulfilled(algorithm)

    Copy Portfolio Targets

    To copy a subset of the PortfolioTarget objects in the PortfolioTargetCollection to an array, call the CopyTo method. The arrayIndex argument is the zero-based index in the array at which copying begins.

    _targetsCollection.CopyTo(array, arrayIndex);
    self.targets_collection.CopyTo(array, arrayIndex)

    Universe Timing Considerations

    If the Execution model manages some indicators or consolidators for securities in the universe and the universe selection runs during the indicator sampling period or the consolidator aggregation period, the indicators and consolidators might be missing some data. For example, take the following scenario:

    In this scenario, you create and warm-up the indicator at noon. Since it runs at noon, the history request that gathers daily data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. This process doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    17.6.2 Supported Models

    Introduction

    This page describes the pre-built Execution models in LEAN. The number of models grows over time. To add a model to LEAN, make a pull request to the GitHub repository . If none of these models perform exactly how you want, create a custom Execution model .

    Null Model

    The NullExecutionModel doesn't place any trades.

    SetExecution(new NullExecutionModel());
    self.SetExecution(NullExecutionModel())

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Immediate Model

    The ImmediateExecutionModel is the default Execution model. It uses market orders to immediately fill portfolio targets. It's similar to placing market orders in line with your algorithm logic.

    SetExecution(new ImmediateExecutionModel());
    self.SetExecution(ImmediateExecutionModel())

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Spread Model

    The SpreadExecutionModel executes trades with market orders if the exchange is open and the bid-ask spread is within a threshold percentage. The model only works if the security subscription provides QuoteBar data. The spread percentage is calculated as

    $$ \frac{a - b}{p} $$

    where $a$ is the ask price, $b$ is the bid price, and $p$ is the price.

    SetExecution(new SpreadExecutionModel());
    self.SetExecution(SpreadExecutionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    acceptingSpreadPercent decimal float Maximum spread accepted comparing to current price in percentage 0.005 (0.5%)

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    Standard Deviation Model

    The StandardDeviationExecutionModel seeks to fill orders when the price is more than 2 standard deviations lower than the average price over a trailing period. The intent is to find dips in the market to place trades. In strongly trending markets, this procedure can result in delayed trade placement since it might be a while before the next price spike or dip.

    SetExecution(new StandardDeviationExecutionModel());
    self.SetExecution(StandardDeviationExecutionModel())

    The following table describes the arguments the model accepts:

    Argument Data Type Description Default Value
    period decimal float Period of the standard deviation indicator 60
    deviations int The number of deviations away from the mean before submitting an order 2
    resolution Resolution The resolution of the STD and SMA indicators Resolution.Minute

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

    VWAP Model

    The VolumeWeightedAveragePriceExecutionModel works to fill your orders at or better than the volume-weighted average price (VWAP) for the trading day. This is a best-effort algorithm, so no guarantee can be made that it will reach the VWAP.

    VWAP execution model implementation
    VWAP Execution Model Fill Placements

    The model uses market orders and it only works if the security subscription provides intraday data. It sets a maximum order size of 1% of the current bar's volume, but you can update the maximum order size through the MaximumOrderQuantityPercentVolume member.

    SetExecution(new VolumeWeightedAveragePriceExecutionModel());
    self.SetExecution(VolumeWeightedAveragePriceExecutionModel())

    To view the implementation of this model, see the LEAN GitHub repository LEAN GitHub repository .

     

    17.7 Hybrid Algorithms

    Introduction

    Classic style algorithms can also use Algorithm Framework modules. This allows you to get the best of both styles of algorithm design, combining easily pluggable modules with the superior control of classic format.

    Examples of popular use-cases of a hybrid approach are:

    Universe Selection

    You can add one or more Framework Universe Selection Models to your algorithm and it will operate normally. You can also combine it with the AddUniverse method of the classic approach. The following example initializes a classic algorithm with framework universe selection models:

    public override void Initialize()
    {
        SetUniverseSelection(new ManualUniverseSelectionModel(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)));
        AddUniverseSelection(new ManualUniverseSelectionModel(QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA)));
        AddUniverseSelection(new QC500UniverseSelectionModel());
        AddUniverse(CoarseSelection);
    }
    def Initialize(self):
        self.SetUniverseSelection(ManualUniverseSelectionModel([ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]))
        self.AddUniverseSelection(ManualUniverseSelectionModel([ Symbol.Create("AAPL", SecurityType.Equity, Market.USA) ]))
        self.AddUniverseSelection(QC500UniverseSelectionModel())
        self.AddUniverse(self.CoarseSelection)

    Alpha

    You can add one or multiple Alpha models to your classic algorithm and place the orders using Insight objects without a Portfolio Construction model. To receive the collection of Insight objects in a your classic algorithm, implement the InsightsGenerated event handler:

    public override void Initialize()
    {
        AddAlpha(new EmaCrossAlphaModel());
        InsightsGenerated += OnInsightsGenerated;
    }
    private void OnInsightsGenerated(IAlgorithm algorithm, GeneratedInsightsCollection insightsCollection)
    {
        var insights = insightsCollection.Insights;
    }
    def Initialize(self):
        self.AddAlpha(EmaCrossAlphaModel())
        self.InsightsGenerated += self.OnInsightsGenerated
    
    def OnInsightsGenerated(self, algorithm: IAlgorithm, insights_collection: GeneratedInsightsCollection) -> None:
        insights = insights_collection.Insights

    Portfolio Construction

    You can add a Portfolio Construction model to your classic algorithm and have it place orders without returning Insight objects from an Alpha model. To emit insights without an Alpha model, in the OnData method, call the EmitInsights method.

    The following example uses a Portfolio Construction Framework model with EmitInsights method in a classic algorithm:

    public override void Initialize()
    {
        SetPortfolioConstruction(new EqualWeightingPortfolioConstructionModel());
    }
    
    public override void OnData(Slice slice)
    {
    	EmitInsights(new Insight("GOOG", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up));
    	EmitInsights(new []{
    		new Insight("AAPL", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up),
    		new Insight("MSFT", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up)
    	});
    }
    def Initialize(self):
        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())
    
    def OnData(self, slice):
    	self.EmitInsights(Insight("GOOG", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up))
    	self.EmitInsights([
    		Insight("AAPL", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up),
    		Insight("MSFT", TimeSpan.FromMinutes(20), InsightType.Price, InsightDirection.Up)
    	])

    Risk Management

    Some Risk Management Models don't require a Portfolio Construction model to provide PortfolioTarget objects, allowing them to directly monitor the portfolio holdings and liquidate positions when neccessary. To see which pre-built Risk Management models don't need the Portfolio Construction model to provide PortfolioTarget objects, see Supported Models .

    You can add one or more Risk Management Models to your algorithm and it will operate normally. The following example initializes a classic algorithm with framework risk management models:

    public override void Initialize()
    {
        AddRiskManagement(new MaximumDrawdownPercentPerSecurity(0.05m));
        AddRiskManagement(new MaximumUnrealizedProfitPercentPerSecurity(0.1m));
    }
    def Initialize(self):
        self.AddRiskManagement(MaximumDrawdownPercentPerSecurity(0.05))
        self.AddRiskManagement(MaximumUnrealizedProfitPercentPerSecurity(0.1))

    Execution

    Execution models can place orders for your strategy instead of placing them manually. To do so, PortfolioTarget s are routed to the Execute method of the Execution Model to place orders.

    The following example uses a Framework Execution Model in a classic style algorithm:

    public override void Initialize()
    {
        SetExecution(new ImmediateExecutionModel());
    }
    def Initialize(self):
        self.SetExecution(ImmediateExecutionModel())

    Universe Timing Considerations

    If the Alpha, Portfolio Construction, Risk Management, or Execution model manages some indicators or consolidators for securities in the universe and the universe selection runs during the indicator sampling period or the consolidator aggregation period, the indicators and consolidators might be missing some data. For example, take the following scenario:

    In this scenario, you create and warm-up the indicator at noon. Since it runs at noon, the history request that gathers daily data to warm up the indicator won't contain any data from the current day and the consolidator that updates the indicator also won't aggregate any data from before noon. This process doesn't cause issues if the indicator only uses the close price to calculate the indicator value (like the simple moving average indicator) because the first consolidated bar that updates the indicator will have the correct close price. However, if the indicator uses more than just the close price to calculate its value (like the True Range indicator), the open, high, and low values of the first consolidated bar may be incorrect, causing the initial indicator values to be incorrect.

     

    17.8 Insight Manager

    Introduction

    The InsightManager tracks all of the Insight objects in your algorithm. It's an InsightCollection , which stores all of your insights in an internal dictionary that has the security Symbol as the key and a list of Insight objects as the value. You can access the manager anywhere in your algorithm where you have reference to the algorithm class. If you want to use an InsightCollection in your algorithm that's seperate from the InsightManager , create a new InsightCollection .

    Add Insights

    To add insights to the InsightManager , return a list of Insight objects from the Update method of your Alpha model or call the EmitInsights method. If you manage an InsightCollection that's seperate from the InsightManager , there are some methods to add Insight objects to it.

    To add an insight to an InsightCollection , call the Add method.

    _insightCollection.Add(insight);
    self.insight_collection.Add(insight)

    To add a list of insights, call the AddRange method.

    _insightCollection.AddRange(insights);
    self.insight_collection.AddRange(insights)

    Check Membership

    To check if an insight exists in the InsightManager , call the Contains method.

    if (algorithm.Insights.Contains(insight))
    {
        
    }
    if self.algorithm.Insights.Contains(insight):
        pass

    To check if the InsightManager has an insight for a Symbol , call the ContainsKey method.

    if (algorithm.Insights.ContainsKey(symbol))
    {
        
    }
    if self.algorithm.Insights.ContainsKey(symbol):
        pass

    To check if the InsightManager has active insights for a Symbol at a specific Coordinated Universal Time (UTC), call the HasActiveInsights method.

    if (algorithm.Insights.HasActiveInsights(symbol, utcTime))
    {
        
    }
    if self.algorithm.Insights.HasActiveInsights(symbol, utc_time):
        pass

    Get Insights

    To get the insights for a Symbol , index the InsightManager with the Symbol .

    if (algorithm.Insights.ContainsKey(symbol))
    {
        var insights = algorithm.Insights[symbol];
    }
    if self.algorithm.Insights.ContainsKey(symbol):
        insights = self.algorithm.Insights[symbol]

    To get the insights that pass a filter, call the GetInsights method.

    var insights = algorithm.Insights.GetInsights(insight => insight.Direction == InsightDirection.Up);
    insights = self.algorithm.Insights.GetInsights(lambda insight: insight.Direction == InsightDirection.Up)

    To iterate through the InsightManager , call the GetEnumerator method.

    var enumerator = algorithm.Insights.GetEnumerator();
    enumerator = self.algorithm.Insights.GetEnumerator()

    To get all of the insights that will be active at a certain UTC time, call the GetActiveInsights method.

    var activeInsights = algorithm.Insights.GetActiveInsights(utcTime);
    active_insights = self.algorithm.Insights.GetActiveInsights(utc_time)

    Get the Next Expiry Time

    To get the next insight expiry time in UTC, call the GetNextExpiryTime method.

    var nextExpiry = algorithm.Insights.GetNextExpiryTime();
    next_expiry = self.algorithm.Insights.GetNextExpiryTime()

    Remove Insights

    Only the Portfolio Construction model should remove insights from the InsightManager . It should remove insights when the insights expire and when the corresponding security leaves the universe .

    To remove an insight from the InsightManager , call the Remove method.

    var removeSuccessful = algorithm.Insights.Remove(insight);
    remove_successful = self.algorithm.Insights.Remove(insight)

    To remove all the insights for a set of Symbol objects, pass a list of Symbol objects the Clear method.

    algorithm.Insights.Clear(symbols);
    self.algorithm.Insights.Clear(symbols)

    To remove all the Insight objects, call the Clear method.

    algorithm.Insights.Clear();
    self.algorithm.Insights.Clear()

    To remove all the insights that will be expired at a certain UTC time, call the RemoveExpiredInsights method.

    var expiredInsights = algorithm.Insights.RemoveExpiredInsights(utcTime);
    expired_insights = self.algorithm.Insights.RemoveExpiredInsights(utc_time)

    Cancel Insights

    In some cases, you may want to cancel an Insight. For example, if a Risk Management model in your algorithm liquidates a security, it should also cancel all of the active insights for the security. If you don't cancel the insights, the Portfolio Construction model might create a new PortfolioTarget to re-enter the position.

    Another example of a situtation where you would want to cancel an Insight is when an Alpha model in your algorithm determines the trading opportunity has pre-maturely ended. For instance, say you want your algorithm to enter a long position in a security when its Relative Strength Index (RSI) moves below 20 and then liquidate the position when the security's RSI moves above 30. If you emit an Insight that has a duration of 30 days when the RSI moves below 20 but the RSI moves above 30 in 10 days, you should cancel the Insight when the RSI moves above 30.

    To cancel insights, call the Cancel / Expire method with a list of Insight objects.

    algorithm.Insights.Cancel(insights)
    algorithm.Insights.Cancel(insights);

    To cancel all the insights for some securities, call the Cancel / Expire method with a list of Symbol objects.

    algorithm.Insights.Cancel(symbols)
    algorithm.Insights.Cancel(symbols);

    When you cancel an active insight, it's CloseTimeUtc property is set to one second into the past.

    Copy Insights

    To copy a subset of the Insight objects in the InsightManager to an array, call the CopyTo method. The arrayIndex argument is the zero-based index in the array at which copying begins.

    algorithm.Insights.CopyTo(array, arrayIndex);
    self.algorithm.Insights.CopyTo(array, arrayIndex)

    Preserve Insights Between Deployments

    Follow these steps to use the Object Store to preserve the algorithm state across live deployments:

    1. Create an algorithm that defines a storage key and adds insights to the Insight Manager .
    2. public class ObjectStoreChartingAlgorithm : QCAlgorithm
      {
          private string _insightKey;
          public override void Initialize()
          {
              _insightKey = $"{ProjectId}/insights";
              SetUniverseSelection(new ManualUniverseSelectionModel(QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA)));
              SetAlpha(new ConstantAlphaModel(InsightType.Price, InsightDirection.Up, TimeSpan.FromDays(5), 0.025, null));    
          }
      }
      class ObjectStoreChartingAlgorithm(QCAlgorithm):
          def Initialize(self):
              self.insight_key = f"{self.ProjectId}/insights"
              self.SetUniverseSelection(ManualUniverseSelectionModel([ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]))
              self.SetAlpha(ConstantAlphaModel(InsightType.Price, InsightDirection.Up, timedelta(5), 0.025, None))
    3. At the top of the algorithm file, add the following imports:
    4. from Newtonsoft.Json import JsonConvert
      from System.Collections.Generic import List

      Insight objects are a C# objects, so you need the preceding C# libraries to serialize and deserialize them.

    5. In the OnEndOfAlgorithm event handler of the algorithm, get the Insight objects and save them in the Object Store as a JSON object.
    6. public override void OnEndOfAlgorithm()
      {
          var insights = Insights.GetInsights(x => x.IsActive(UtcTime));
          ObjectStore.SaveJson(_insightKey, insights);
      }
      def OnEndOfAlgorithm(self):
          insights = self.Insights.GetInsights(lambda x: x.IsActive(self.UtcTime))
          content = ','.join([JsonConvert.SerializeObject(x) for x in insights])
          self.ObjectStore.Save(self.insight_key, f'[{content}]')
    7. At the bottom of the Initialize method, read the Insight objects from the Object Store and add them to the Insight Manager .
    8. if (ObjectStore.ContainsKey(_insightKey))
      {
          var insights = ObjectStore.ReadJson<List<Insight>>(_insightKey);
          Insights.AddRange(insights);
      }
      if self.ObjectStore.ContainsKey(self.insight_key):
          insights = self.ObjectStore.ReadJson[List[Insight]](self.insight_key)
          self.Insights.AddRange(insights)

    The following algorithm provides a full example of preserving the Insight state between deployments:

    Properties

    The InsightManager has the following properties:

     

    18 Charting

    Introduction

    We provide a powerful charting API that you can use to build many chart types.

    Charts

    Charts contain a collection of series, which display data on the chart. To add a chart to an algorithm, create a Chart object and then call the AddChart method.

    var chart = new Chart("<chartName>");
    AddChart(chart);
    chart = Chart("<chartName>")
    self.AddChart(chart)

    The Chart constructor expects a name argument. The following chart names are reserved:

    Series

    A chart series displays data on the chart. To add a series to a chart, create a Series object and then call the AddSeries method.

    var series = new Series("<seriesName>");
    chart.AddSeries(series);
    series = Series("<seriesName>")
    chart.AddSeries(series)

    Arguments

    There are several other headers for the Series constructor.

    Series(name, type)
    Series(name, type, index)
    Series(name, type, index, unit)
    Series(name, type, unit)
    Series(name, type, unit, color)
    Series(name, type, unit, color, symbol)
    

    The following table describes the constructor arguments:

    Argument Data Type Description
    name string str Name of the series
    type SeriesType Type of the series
    index int Index position on the chart of the series
    unit string str Unit for the series axis
    color Color Color of the series
    symbol ScatterMarkerSymbol Symbol for the marker in a scatter plot series

    The default Series is a line chart with a "$" unit on index 0.

    Names

    The Series constructor expects a name argument. If you add a series to one of the default charts, some series names may be reserved. The following table shows the reserved series name for the default charts:

    Chart Name Reserved Series Names
    Strategy Equity Equity, Daily Performance
    Capacity Strategy Capacity
    Drawdown Equity Drawdown
    Benchmark Benchmark

    Types

    The SeriesType enumeration has the following members:

    Index

    The series index refers to its position in the chart. If all the series are at index 0, they lay on top of each other. If each series has its own index, each series will be separate on the chart. The following image shows an EMA cross chart with both EMA series set to the same index:

    Ema values are on the same chart window

    The following image shows the same EMA series, but with the short EMA on index 0 and the long EMA on index 1:

    Ema values are on separate chart windows

    Colors

    To view the available Color options, see the Color Struct Properties in the .NET documentation.

    Scatter Marker Symbols

    The ScatterMarkerSymbol enumeration has the following members:

    Plot Data

    To add a data point to a chart series, call the Plot method. If you haven't already created a chart and series with the names you pass to the Plot method, the chart and/or series is automatically created.

    Plot("<chartName>", "<seriesName>", value);
    self.Plot("<chartName>", "<seriesName&gt", value)

    The value argument can be an integer for decimal number. If the chart is a time series, the value is added to the chart using the algorithm time as the x-coordinate.

    To plot the current value of indicators, call the Plot method. The method accepts up to four indicators.

    // In Initialize
    var symbol = AddEquity("SPY");
    var smaShort = SMA(symbol, 10);
    var smaLong = SMA(symbol, 20);
    
    // In OnData
    Plot("<chartName>", smaShort, smaLong)
    # In Initialize
    symbol = self.AddEquity("SPY")
    sma_short = self.SMA(symbol, 10)
    sma_long = self.SMA(symbol, 20)
    
    # In OnData
    self.Plot("<chartName>", sma_short, sma_long)

    To plot all of the values of some indicators, in the Initialize method, call the PlotIndicator method. The method plots each indicator value as the indicator updates. The method accepts up to four indicators.

    var symbol = AddEquity("SPY");
    var smaShort = SMA(symbol, 10);
    var smaLong = SMA(symbol, 20);
    PlotIndicator("<chartName>", smaShort, smaLong)
    symbol = self.AddEquity("SPY")
    sma_short = self.SMA(symbol, 10)
    sma_long = self.SMA(symbol, 20)
    self.PlotIndicator("<chartName>", sma_short, sma_long)

    Examples

    The following example shows how to plot the daily closing price of SPY with a scatter plot:

    public class ChartingDemoAlgorithm : QCAlgorithm
    {
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2022, 1, 1);
            AddEquity("SPY", Resolution.Daily);
            var chart = new Chart("Price");
            AddChart(chart);
            chart.AddSeries(new Series("SPY", SeriesType.Scatter, "$", Color.Green, ScatterMarkerSymbol.Triangle));
        }
    
        public override void OnEndOfDay(Symbol symbol)
        {
            Plot("Price", "SPY", Securities[symbol].Price);
        }
    }
    class ChartingDemoAlgorithm(QCAlgorithm):
    
        def Initialize(self) -> None:
            self.SetStartDate(2021, 1, 1)
            self.SetEndDate(2022, 1, 1)
            self.AddEquity("SPY", Resolution.Daily)
            chart = Chart("Price")
            self.AddChart(chart)
            chart.AddSeries(Series("SPY", SeriesType.Scatter, "$", Color.Green, ScatterMarkerSymbol.Triangle))
    
        def OnEndOfDay(self, symbol: Symbol) -> None:
            self.Plot("Price", "SPY", self.Securities[symbol].Price)
    Time series of SPY closing price during 2021.

    To see a full example, run the CustomChartingAlgorithm CustomChartingAlgorithm .

    View Charts

    The following table describes where you can access your charts, depending on how to deploy your algorithms:

    Location Algorithm Lab Algorithms CLI Cloud Algorithms CLI Local Algorithms
    Backtest results page green check green check
    Live results page green check green check
    /backtests/read endpoint green check green check
    /live/read endpoint green check green check
    ReadBacktest method green check green check
    ReadLiveAlgorithm method green check green check
    Local JSON file in your <projectName> / backtests / <timestamp> or <projectName> / live / <timestamp> directory green check green check

    Quotas

    Custom charts are limited to 4,000 data points. Intensive charting requires hundreds of megabytes of data, which is too much to stream online or display in a web browser. If you exceed the quota, the following message displays:

    Exceeded maximum points per chart, data skipped

    You can create up to 10 custom chart series per algorithm. If you exceed the quota, your algorithm stops executing and the following message displays:

    Exceeded maximum series count: Each backtest can have up to 10 series in total.

    In live trading, charts are sampled every one and ten minutes. If you create 1-minute resolution custom charts, the IDE charting will downgrade the granularity and display the 10-minutes sampling after a certain amount of samples.

     

    19 Logging

    Introduction

    Algorithms can record string messages ('log statements') to a file for analysis after a backtest is complete, or as a live algorithm is running. These records can assist in debugging logical flow errors in the project code. Consider adding them in the code block of an if statement to signify an error has been caught.

    It's good practice to add logging statements to live algorithms so you can understand its behavior and keep records to compare against backtest results. If you don't add logging statements to a live algorithm and the algorithm doesn't trade as you expect, it's difficult to evaluate the underlying problem.

    Log Messages

    Log statements are added to the log file while your algorithm continues executing. Logging dataset information is not permitted. Use Log statements to debug your backtests and live trading algorithms.

    If you execute algorithms in QuantConnect Cloud, log length is capped by organization tier . If your organization hits the daily limit, contact us .

    If you log the same content multiple times, only the first instance is added to the log file. To bypass this rate-limit, add a timestamp to your log messages.

    For live trading, the log files of each cloud project can store up to 100,000 lines for up to one year. If you log more than 100,000 lines or some lines become older than one year, we remove the oldest lines in the files so your project stays within the quota.

    To record the algorithm state when the algorithm stops executing, add log statements to the OnEndOfAlgorithm event handler.

    Log("My log message");
    self.Log("My log message")

    Debug Messages

    Debug statements are the same as log statements, but Debug statements are orange in the Cloud Terminal. Use these statements when you want to give more attention to a message in the Cloud Terminal. Debug messages can be up to 200 characters in length. If you send multiple debug statements within 1 second, your messages are rate-limited to avoid crashing your browser.

    Debug("My debug message");
    self.Debug("My debug message")

    Error Messages

    Error statements are the same as log statements, but Error statements are displayed in red text in the Cloud Terminal. Use these statements when you want to give the most attention to a message in the Cloud Terminal. Error statements are rate-limited like debug statements.

    Error("My error message");
    self.Error("My error message")

    Quit Messages

    Quit statements cause your project to stop running and may log some data to the log file and Cloud Terminal. These statements are orange in the Cloud Terminal. When you call the Quit method, the program continues executing until the end of the method definition. If you want to quit execution immediately, return after you call Quit .

    Quit("My quit message");
    self.Quit("My quit message")

    Runtime Statistics

    Runtime statistics show the performace of your algorithm at a single moment in time.

    The following table describes the default runtime statistics:

    Statistic Description
    Capacity The maximum amount of money an algorithm can trade before its performance degrades from market impact.
    Equity The total portfolio value if all of the holdings were sold at current market rates.
    Fees The total quantity of fees paid for all the transactions.
    Holdings The absolute sum of the items in the portfolio.
    Net Profit The dollar-value return across the entire trading period.
    PSR The probability that the estimated Sharpe ratio of an algorithm is greater than a benchmark (1).
    Return The rate of return across the entire trading period.
    Unrealized The amount of profit a portfolio would capture if it liquidated all open positions and paid the fees for transacting and crossing the spread.
    Volume The total value of assets traded for all of an algorithm's transactions.

    The capacity statistic is only available for live algorithms.

    To add a custom runtime statistic, call the SetRuntimeStatistic method with a name and value . The value argument can be a string or a number.

    SetRuntimeStatistic(name, value);
    self.SetRuntimeStatistic(name, value)

    Access Logs and Statistics

    The following table describes where you can access the logs and runtime statistics, depending on how to deploy your algorithms:

    Location Algorithm Lab Algorithms CLI Cloud Algorithms CLI Local Algorithms
    Backtest results page green check green check
    Live results page green check green check
    ReadBacktest green check green check
    ReadLive green check green check
    Local log file in your <projectName> / backtests / <timestamp> or <projectName> / live / <timestamp> directory green check green check

     

    20 Live Trading

    QuantConnect enables you to run your algorithms in live mode with real-time market data. You can use the same algorithm for backtesting and live trading with different brokerages and data feeds.

    See Also

    QuantConnect Live Trading
    Supported Brokerages

     

    20.1 Key Concepts

    Introduction

    Algorithms should generally work seamlessly shifting from backtesting to live trading with no changes required. In backtesting algorithm events are triggered as fast as possible, whereas in live trading events are triggered in realtime.

    Algorithm Portfolio

    The live trading algorithm portfolio is loaded from the brokerage holdings, including open orders. When there are unsupported asset types in the portfolio the live trading strategy is stopped as we cannot be sure how to model the asset.

    In paper trading the algorithm starts from no portfolio, and attempts to remember the previous portfolio state from the last time the portfolio was deployed.

    Your algorithm should not assume it starts from an empty portfolio as you may have holdings from previous deployments.

    Stateful Strategies

    There is no automatic state management of live strategies in QuantConnect. We recommend algorithms reconstruct state or indicator needs using the WarmUp and History methods.

    Once the algorithm has warmed up some objects you can use the Object Store to save the data for the next algorithm restart.

    In the event the algorithm is terminated unexpectedly, you should review the live algorithm portfolio at the brokerage to confirm it will behave as expected.

    Data Delivery Times

    Most data is available at the same time as in backtesting, with the exception of daily data which is often delayed by 4-8 hours (4am - 8am).

    US Equities universe selection data is processed at 7-8am ET.

    Other Brokerages

    If we do not support your brokerage reach out to let us and we can attempt to add them to the roadmap. With enough community requests we can build and open-source the brokerage integration.

     

    20.2 Brokerages

    Introduction

    Brokerages provide you with a connection to the market so you can fill trades. To avoid placing invalid orders for execution in live trading, LEAN validates your orders before sending them to the real brokerage. To view all of the integrated brokerages, see Brokerages .

    Portfolio

    In live trading, LEAN populates the Portfolio object with your account holdings and the Transactions object with your open positions. If you don't manually subscribe to the assets in your account, LEAN subscribes to them with the lowest resolution of the subscriptions in your algorithm. For example, say you hold AAPL shares in your account and create the following subscriptions in your algorithm:

    AddEquity("SPY", Resolution.Hour);
    AddEquity("MSFT", Resolution.Second);
    self.AddEquity("SPY", Resolution.Hour)
    self.AddEquity("MSFT", Resolution.Second)

    In this case, LEAN subscribes to second-resolution data for AAPL since the lowest resolution in your algorithm is Resolution.Second .

    Deposits and Withdraws

    You can deposit and withdraw cash from your brokerage account while you run an algorithm that's connected to the account. We sync the algorithm's cash holdings with the cash holdings in your brokerage account every day at 7:45 AM Eastern Time (ET).

    Monitor the Brokerage Connection

    We notify your algorithm when your brokerage connection disconnects and reconnects.

    Lost Connections

    If the brokerage connection breaks, we notify your algorithm through the OnBrokerageDisconnect event handler.

    public override void OnBrokerageDisconnect() 
    {
        Debug("Brokerage connection lost");
    }
    def OnBrokerageDisconnect(self) -> None:
        self.Debug("Brokerage connection lost")

    Restored Connections

    When the brokerage connection restores after it disconnects, we notify your algorithm through the OnBrokerageReconnect event handler.

    public override void OnBrokerageReconnect() 
    {
        Debug("Brokerage connection restored");
    }
    def OnBrokerageReconnect(self) -> None:
        self.Debug("Brokerage connection restored")

    Example Algorithm

    For a full example algorithm that implements the OnBrokerageDisconnect and OnBrokerageReconnect methods, see the BrokerageActivityEventHandlingAlgorithm BrokerageActivityEventHandlingAlgorithm in the LEAN GitHub repository.

    Monitor Brokerage Messages

    When your brokerage sends you a message, we notify your algorithm through the OnBrokerageMessage event handler.

    public override void OnBrokerageMessage(BrokerageMessageEvent messageEvent) 
    {
        Debug(f"Brokerage message received: {messageEvent.Message}");
    }
    def OnBrokerageMessage(self, message_event: BrokerageMessageEvent) -> None:
        self.Debug(f"Brokerage message received: {message_event.Message}")

    BrokerageMessageEvent objects have the following attributes:

    For a full example algorithm that implements the OnBrokerageMessage method, see the BrokerageActivityEventHandlingAlgorithm BrokerageActivityEventHandlingAlgorithm in the LEAN GitHub repository.

    To handle brokerage messages outside of your algorithm class, create and set a BrokerageMessageHandler . For a full example, see the CustomBrokerageMessageHandlerAlgorithm in the LEAN GitHub repository.

     

    20.3 Data Feeds

    Introduction

    Data feeds are a stream of asset prices and quotes delivered to your trading algorithm during live execution. You need live data feeds to inject data into your algorithm so that you can make real-time trading decisions and so that the values of the securities in your portfolio update in real-time. You can source data from QuantConnect or your brokerage. To view the available data feeds, see Data Feeds .

    Bar Building

    We aggregate ticks to build bars.

    In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.

    Latency

    Live data takes time to travel from the source to your algorithm. The data feed has a latency of 20-50 milliseconds. QuantConnect is not designed for high-frequency trading.

    History Requests

    In live trading, if you make a history request for minute data at noon and the history period covers the start of the previous day to the present moment, the data from the previous day will be backtest data. The data of the current day will be live data that we collected throughout the morning. If you make this history request in a backtest, you might get slightly different data for the current day because of post-processing from the data vendor.

    Warm Up Periods

    LEAN supports an automated fast-forward system called "Warm Up". It simulates winding back the clock from the time you deploy the algorithm. In a backest, this is the StartDate of your algorithm. In live trading, it's the current date. Warm Up is a great way to prepare your algorithm and its indicators for trading.

    US Fundamental Data by Morningstar is limited to the last 30 days.

     

    20.4 Trading and Orders

    Introduction

    LEAN has dozens of methods to create, update, and cancel orders. You can place orders automatically with helper methods or manually through methods on the algorithm API. You can fetch, update, and cancel manual orders with order tickets . As the state of your orders change, LEAN creates events that notify your algorithm.

    In backtesting, LEAN simulates order fills with historical data, but you can create your own fill, fee, slippage, and margin models via plugin points. You control how optimistic or pessimistic order fills are with transaction model classes. For more information about these types of models, see Reality Modeling .

    In live trading, orders fill asynchronously. We send your order to the API of your brokerage and wait for their response to update the state of your algorithm and portfolio. The timing of live order fills doesn't depend on the resolution of your security subscriptions. When your order fills, the fill price and fee is set by your brokerage. You can add event handlers to your algorithm to monitor the brokerage connection and brokerage messages .

    In backtesting, the trade fill timing depends on the resolution of your security subscription. For example, if you subscribe to a security with minute resolution data, the algorithm only receives data in one-minute time slices . As a result, the fill model can only evaluate if the order should fill on a minute-by-minute frequency.

    Order Life Cycle

    When you create an order with one of the order methods, LEAN creates Order and OrderTicket objects. The order ticket is sent to your brokerage. As the brokerage processes your order, it returns another order ticket and it's compared against the order to see if the order is satisfied. Orders are asynchronous in live trading, so if you want to change an order, you must request it with the order ticket. Order changes are not guaranteed since your order may fill by the time brokerage receives the request.

    Flow of ordering and filling between algorithm and brokerage

    When you create an order ticket, LEAN validates it to avoid sending orders that will be rejected by your brokerage. If the order is invalid, it's status is set to OrderStatus.Invalid . Otherwise, LEAN sets the order status to OrderStatus.New , sends the order to your brokerage, and waits for the brokerage message. If your brokerage accepts the order, the order status becomes OrderStatus.Submitted . Otherwise, it becomes OrderStatus.Canceled .

    You can update orders until they fill or the brokerage prevents modifications. If you place an order update request, LEAN validates it to avoid sending orders that will be rejected by you brokerage. If the order update is valid, LEAN sends the update request and waits for the brokerage message. If your brokerage accepts the update, the order status becomes OrderStatus.UpdateSubmitted . Otherwise, it becomes OrderStatus.Canceled .

    The brokerage notifies LEAN when you order fills ( OrderStatus.Filled ), partially fills ( OrderStatus.PartiallyFilled ) or is canceled ( OrderStatus.Canceled ). The brokerage can cancel your order before it completely fills. For example, if you place a market on open and the asset price moves before the market open to where you can't afford the quantity of the order, the brokerage rejects your order. The brokerage can also cancel your market on open order after partial fills if there is no shares left to trade.

    Disable Buying Power

    In live trading, orders can pass the validations associated with buying power in LEAN and let your brokerage decide to accept or reject them. To disable the validations of the default buying power model , use the NullBuyingPowerModel .

    To set the NullBuyingPowerModel for a security subscription, call the SetBuyingPowerModel method with the BuyingPowerModel.Null argument.

    // In Initialize
    var equity = AddEquity("SPY");
    equity.SetBuyingPowerModel(BuyingPowerModel.Null);
    # In Initialize
    equity = self.AddEquity("SPY")
    equity.SetBuyingPowerModel(BuyingPowerModel.Null)

    You can call the SetMarginModel method with the SecurityMarginModel.Null argument to achive the same result.

    You can also set the asset NullBuyingPowerModel in a security initializer. In order to set the buying power of securities in the security initializer, call SetSecurityInitializer before you create security subscriptions and after you call SetBrokerageModel .

    // In Initialize
    SetSecurityInitializer(new MySecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices)));
    
    // Outside of the algorithm class
    class MySecurityInitializer : BrokerageModelSecurityInitializer
    {
        public MySecurityInitializer(IBrokerageModel brokerageModel, ISecuritySeeder securitySeeder)
            : base(brokerageModel, securitySeeder) {}    
        
        public override void Initialize(Security security)
        {
            // First, call the superclass definition
            // This method sets the reality models of each security using the default reality models of the brokerage model
            base.Initialize(security);
    
            // Next, overwrite the security buying power        
            security.SetBuyingPowerModel(BuyingPowerModel.Null);    
        }
    }
    # In Initialize
    self.SetSecurityInitializer(MySecurityInitializer(self.BrokerageModel, FuncSecuritySeeder(self.GetLastKnownPrices)))
    
    # Outside of the algorithm class
    class MySecurityInitializer(BrokerageModelSecurityInitializer):
    
        def __init__(self, brokerage_model: IBrokerageModel, security_seeder: ISecuritySeeder) -> None:
            super().__init__(brokerage_model, security_seeder)
    
        def Initialize(self, security: Security) -> None:
            # First, call the superclass definition
            # This method sets the reality models of each security using the default reality models of the brokerage model
            super().Initialize(security)
    
            # Next, overwrite the security buying power        
            security.SetBuyingPowerModel(BuyingPowerModel.Null)

     

    20.4.1 Financial Advisors

    Introduction

    Financial Advisor accounts enable certified professionals to use a single trading algorithm to manage several client accounts. Our Interactive Brokers integration enables you to place FA group orders.

    Group Routing

    To place trades using a subset of client accounts, create Account Groups in Trader Workstation and then define the InteractiveBrokersOrderProperties when you create orders.

    DefaultOrderProperties = new InteractiveBrokersOrderProperties
    {
        FaGroup = "TestGroupEQ",
        FaMethod = "EqualQuantity",
        FaProfile = "TestProfileP",
        Account = "DU123456"
    };
    self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
    self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
    self.DefaultOrderProperties.FaMethod = "EqualQuantity"
    self.DefaultOrderProperties.FaProfile = "TestProfileP"
    self.DefaultOrderProperties.Account = "DU123456"

    SecurityHolding objects aggregate your positions across all the account groups. If you have two groups where group A has 10 shares of SPY and group B has -10 shares of SPY, then self.Portfolio["SPY"].Quantity Portfolio["SPY"].Quantity is zero.

    Allocation Methods

    The following table shows the supported allocation methods for FA group orders:

    FaMethod Description
    "EqualQuantity" Distributes shares equally between all accounts in the group. If you use this method, specify an order quantity.
    "NetLiq" Distributes shares based on the net liquidation value of each account. The system calculates ratios based on the net liquidation value in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "AvailableEquity" Distributes shares based on the amount of available equity in each account. The system calculates ratios based on the available equity in each account and allocates shares based on these ratios. If you use this method, specify an order quantity.
    "PctChange" Increases or decreases an already existing position. Positive percents increase positions and negative percents decrease positions. If you use this method, specify a percent instead of an order quantity.
    public override void Initialize()
    {
        // Set the default order properties
        DefaultOrderProperties = new InteractiveBrokersOrderProperties()
        {
            FaGroup = "TestGroupEQ",
            FaMethod = "EqualQuantity",
            FaProfile = "TestProfileP",
            Account = "DU123456"
        };
    }
    
    public override void OnData(Slice slice)
    {
        // Use default order order properties
        LimitOrder(_symbol, quantity, limitPrice);
    
        // Override the default order properties
        // "NetLiq" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "NetLiq" 
                   });
    
        // "AvailableEquity" requires a order size input
        LimitOrder(_symbol, quantity, limitPrice, 
                   orderProperties: new InteractiveBrokersOrderProperties
                   { 
                       FaMethod = "AvailableEquity" 
                   });
        
        // "PctChange" requires a percentage of portfolio input
        SetHoldings(_symbol, pctPortfolio,
                    orderProperties: new InteractiveBrokersOrderProperties
                    { 
                        FaMethod = "PctChange" 
                    });
    }
    def Initialize(self) -> None:
        # Set the default order properties
        self.DefaultOrderProperties = InteractiveBrokersOrderProperties()
        self.DefaultOrderProperties.FaGroup = "TestGroupEQ"
        self.DefaultOrderProperties.FaMethod = "EqualQuantity"
        self.DefaultOrderProperties.FaProfile = "TestProfileP"
        self.DefaultOrderProperties.Account = "DU123456"
    
    def OnData(self, slice: Slice) -> None:
        # Override the default order properties
        # "NetLiq" requires a order size input
        order_properties = InteractiveBrokersOrderProperties()
        order_properties.FaMethod = "NetLiq"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "AvailableEquity" requires a order size input
        order_properties.FaMethod = "AvailableEquity"
        self.LimitOrder(self.symbol, quantity, limit_price, orderProperties=order_properties)
    
        # "PctChange" requires a percentage of portfolio input
        order_properties.FaMethod = "PctChange"
        self.SetHoldings(self.symbol, pct_portfolio, orderProperties=order_properties)

    Subscription Requirements

    To use FA group orders through our Interactive Brokers integration, you need to connect as a member of a Trading Firm and Institution organization. If you aren't currently on either of these tiers, upgrade your organization .

     

    20.5 Reconciliation

    Introduction

    Algorithms usually perform differently between backtesting and live trading over the same time period. Backtests are simulations where we model reality as close as possible, but the modeling isn't always perfect. To measure the performance differences, we run an out-of-sample (OSS) backtest in parallel to all of your live trading deployments. The live results page displays the live equity curve and the OOS backtest equity curve of your algorithms.

    The live and OSS backtest equity curves of an Alpha

    If your algorithm is perfectly reconciled, it has an exact overlap between its live and OOS backtest equity curves. Deviations mean that the performance of your algorithm has differed between the two execution modes. Several factors can contribute to the deviations.

    Differences From Data

    The data that your algorithm uses can cause differences between backtesting and live trading performance.

    Look-Ahead Bias

    The Time Frontier minimizes the risk of look-ahead bias in backtests, but it does not completely eliminate the risk of look-ahead bias. For instance, if you use a custom dataset that contains look-ahead bias, your algorithm's live and backtest equity curves may deviate. To avoid look-ahead bias with custom datasets, set a Period on your custom data points so that your algorithm receives the data points after the Time + Period .

    Discrete Time Steps

    In backtests, we inject data into your algorithm at predictable times, according to the data resolution. In live trading, we inject data into your algorithm when new data is available. Therefore, if your algorithm has a condition with a specific time (i.e. time is 9:30:15), the condition may work in backtests but it will always fail in live trading since live data has microsecond precision. To avoid issues, either use a time range in your condition (i.e. 9:30:10 < time < 9:30:20), use a rounded time, or use a Scheduled Event.

    Custom Data Emission Times

    Custom data is often timestamped to midnight, but the data point may not be available in reality until several days after that point. If your custom dataset is prone to this delay, your backtest may not fetch the same data at the same time or frequency that your live trading algorithm receives the data, leading to deviations between backtesting and live trading. To avoid issues, ensure the timestamps of your custom dataset are the times when the data points would be available in reality.

    In backtesting, LEAN and custom data are perfectly synchonized. In live trading, daily and hourly data from a custom data source are not because of the frequency that LEAN checks the data source depends on the resolution argument. The following table shows the polling frequency of each resolution:

    Resolution Update Frequency
    Daily Every 30 minutes
    Hour Every 30 minutes
    Minute Every minute
    Second Every second
    Tick Constantly checks for new data

    Split Adjustment of Indicators

    Backtests use adjusted price data by default. Therefore, if you don't change the data normalization mode , the indicators in your backtests are updated with adjusted price data. In contrast, if a split or dividend occurs in live trading, your indicators will temporarily contain price data from before the corporate event and price data from after the corporate event. If this occurs, your indicators will produce different signals in your backtests compared to your live trading deployment. To avoid issues, reset and warm up your indicators when your algorithm receives a corporate event.

    Tick Slice Sizes

    In backtesting, we collect ticks into slices that span 1 millisecond before injecting them into your algorithm. In live trading, we collect ticks into slices that span up to 70 milliseconds before injecting them into your algorithm. This difference in slice sizes can cause deviations between your algorithm's live and OOS backtest equity curves. To avoid issues, ensure your strategy logic is compatible with both slice sizes.

    Differences From Modeling

    The modeling that your algorithm uses can cause differences between backtesting and live trading performance.

    Reality Modeling Error

    We provide brokerage models to model fees, slippage, and order fills in backtests. However, these model predictions may not always match the fees that your live algorithm incurs, leading to deviations between backtesting and live trading. You can adjust the reality models that your algorithm uses to more accurately reflect the specific assets that you're trading. For more information about reality models, see Reality Modeling .

    Market Impact

    We don't currently model market impact. So, if you are trading large orders, your fill prices can be better during backtesting than live trading, causing deviations between backtesting and live trading. To avoid issues, implement a custom fill model in your backtests that incorporates market impact.

    Fills

    In backtests, orders fill immediately. In live trading, they are sent to your brokerage and take about half a second to execute. If you fill an order in a backtest with stale data, deviations between backtesting and live trading can occur because the order is filled at a price that is likely different from the real market price. Stale order fills commonly occur in backtests when you create a Scheduled Event with an incompatible data resolution. For instance, if you subscribe to hourly data, place a Scheduled Event for 11:15 AM, and fill an order during the Scheduled Event, the order will fill at a stale price because the data between 11:00 AM and 11:15 AM is missing. To avoid stale fills, only place orders when your algorithm receives price data.

    In live trading, your brokerage provides the fill price of your orders. Since the backtesting brokerage models do not know the price at which live orders are filled, the fill price of backtest orders is based on the best price available in the current backtesting data. Similarly, limit orders can fill at different prices between backtesting and live trading. In backtesting, limit orders fill as soon as the limit price is hit. In live trading, your brokerage may fill the same limit order at a different price or fail to fill the order, depending on the position of your order in their order book.

    Borrowing Costs

    We do not currently simulate the cost of borrowing shorts in backtests. Therefore, if your algorithm takes short positions, deviations can occur between backtesting and live trading. We are working on adding the functionality to model borrowing fees. Subscribe to GitHub Issue #4563 to track the feature progress.

    Differences From Brokerage

    The brokerage that your algorithm uses can cause differences between backtesting and live trading performance.

    Portfolio Allocations on Small Accounts

    If you trade a small portfolio, it's difficult to achieve accurate portfolio allocations because shares are usually sold in whole numbers. For instance, you likely can't allocate exactly 10% of your portfolio to a security. You can use fractional shares to achieve accurate portfolio allocations, but not all brokerages support fractional shares. To get the closest results when backtesting and live trading over the same period, ensure both algorithms have the same starting cash balance.

    Different Backtest Parameters

    If you don't start your backtest and live deployment on the same date with the same holdings, deviations can occur between backtesting and live trading. To avoid issues, ensure your backtest parameters are the same as your live deployment.

    Non-deterministic State From Algorithm Restarts

    If you stop and redeploy your live trading algorithm, it needs to restart in a stateful way or else deviations can occur between backtesting and live trading. To avoid issues, redeploy your algorithm in a stateful way using the SetWarmUp and History methods. Furthermore, use the ObjectStore to save state information between your live trading deployments.

    Existing Portfolio Securities

    If you deploy your algorithm to live trading with a brokerage account that has existing holdings, your live trading equity curve reflects your existing positions, but the backtesting curve won't. Therefore, if you have existing positions in your brokerage account when you deploy your algorithm to live trading, deviations will occur between backtesting and live trading. To avoid issues, deploy your algorithm to live trading using a separate brokerage account or subaccount that does not have existing positions.

    Brokerage Limitations

    We provide brokerage models that support specific order types and model your buying power. In backtesting, we simulate your orders  with the brokerage model you select. In live trading, we send your orders to your brokerage for execution. If the brokerage model that you use in backtesting is not the same brokerage that you use in live trading, deviations may occur between backtesting and live trading. The deviations can occur if your live brokerage doesn't support the order types that you use or if the backtesting brokerage models your buying power with a different methodology than the real brokerage. To avoid brokerage model issues, set the brokerage model in your backtest to the same brokerage that you use in live trading.

    Differences From Third-Party Indicators

    The values of our indicators can sometimes produce different results than the indicators on other platforms. These discrepancies can be a result of differences in the input data, timestamps, or implementation.

    Price Differences

    If you find differences in indicator values, compare the prices that are fed into the indicator on each platform. If the input data is slightly different, the indicator values will be different. To test if it's a difference in price data, feed in the data from the third-party platform into our indicators. We validate the indicators against third-party sources and when the values are the same, the indicator values are similar too.

    Timestamp Differences

    We timestamp our data to the time when the period ends. Many other platforms timestamp to the beginning of the candle.

    Implementation Differences

    Some indicators can have slightly different default arguments for their implementation. A common difference across platforms is to use a different MovingAverageType for the indicators. To view the default arguments for all our indicators, see Supported Indicators . To view the full implementation of our indicators, see the LEAN GitHub repository .

    Warm Up Period Differences

    Some platforms use all of the historical data to warm up their indicators while LEAN indicators have a fixed number of bars they need to warm up. As a result, indicators with long memory like the Exponential Moving Average can have slightly different values across platforms.

    Differences From Real-time Scheduled Events

    In live trading, Scheduled Events execute in a parallel thread based on a real-time clock. If you set a Scheduled Event to fire at 10:00 AM, it executes at exactly 10:00 AM. In backtesting, Scheduled Events are part of the main algorithm manager loop, so they may not execute exactly when you set them. For example, if your algorithm subscribes to minute resolution US Equity data with regular trading hours and you set a Scheduled Event to occur at 2:00 AM, your Scheduled Event will execute at 9:31 AM when the next bar is fed into your algorithm.

    The difference between live trading and backtesting is important to note because it can affect your algorithm's behavior. There are two common scenarios to consider.

    Execution Timing and Backtest Timeouts

    Take the following scenario:

    In this scenario, the Scheduled Events each fire at the correct time and execute without error in live trading. In backtesting, all of the Scheduled Events execute at 9:31 AM when your algorithm receives the first bar of the trading day. Since all the Scheduled Events take eight minutes to execute, the algorithm tries to execute all the Scheduled Events but reaches the 10-minute timeout and the backtest stops execution.

    Live Data Delays

    In backtests, your algorithm receives data at perfect timing. If you request minute resolution data, your algorithm receives the bars at the top of each minute. In live trading, bars have a slight delay, so you may receive them milliseconds after the top of each minute. Take the following scenario:

    In live trading, the Scheduled Event executes at exactly 10:00 AM but your algorithm may receive the 9:59-10:00 AM bar at 10:00:00.01 AM. Therefore, when you check the price in the Scheduled Event, the price from the 9:58-9:59 AM bar is the latest price. In backtesting, the Scheduled Event gets the price from the 9:59-10:00 AM bar since your algorithm receives the bar at perfect timing.

     

    20.6 Notifications

    Introduction

    Set up some live trading notifications so that you are notified of market events and your algorithm's performance. QuantConnect Cloud supports email, SMS, webhooks, and Telegram notifications for live trading algorithms. If you run local algorithm with LEAN or the LEAN CLI, the notification services aren't available. To view the number of notification you can send for free in QuantConnect Cloud, see the Live Trading Notification Quotas .

    Email

    Email notifications can include up to 10KB of text content in the message body. These notifications can be slow since they go through your email provider. If you don't receive an email notification that you're expecting, check your junk folders.

    To send email notifications in your code files, run:

    Notify.Email(emailAddress, subject, body, attachment, headers);
    self.Notify.Email(email_address, subject, body, attachment, headers)

    SMS

    SMS notifications are the only type of notification that you don't need an internet connection to receive.

    To send SMS notifications in your code files, run:

    Notify.Sms(phoneNumber, message);
    self.Notify.Sms(phone_number, message)

    Webhooks

    Webhook notifications are an HTTP-POST request to a URL you provide. The request is sent with a timeout of 300s. You can process these notifications on your web server however you want. For instance, you can inject the content of the notifications into your server's database or use it to create other notifications on your own server.

    To send webhook notifications in your code files, run:

    Notify.Web(url, data, headers);
    self.Notify.Web(url, data, headers)

    Telegram

    Telegram notifications are automated messages to a Telegram group.

    To send Telegram notifications in your code files, run:

    Notify.Telegram(id, message, token);
    self.Notify.Telegram(id, message, token)

    The id argument is your Telegram group Id. Your group Id is in the URL when you open your group chat in the Telegram web interface. For example, the group Id of web.telegram.org/z/#-503016366 is -503016366.

    The token optional argument is a token of a bot you must add to your Telegram group. To create a bot, chat with @BotFather and follow its instructions. If you want to use our bot, the username is @quantconnect_notifications_bot.

    To add emoticons to your message , convert the emoticon character to UTF-32 with the Unicode Converter on the Branah website. For example, the rocket emoji is 0001f680 in UTF-32 format, so use \U001f680 in your message.

    Terms of Use

    The notification system can't be used for data distribution.

     

    20.7 Charting and Logging

    Introduction

    The live results page shows your algorithm's live trading performance. You can add custom charts and logs to the results page.

    Charting

    Custom charts are limited to 4,000 data points. Intensive charting requires hundreds of megabytes of data, which is too much to stream online or display in a web browser. If you exceed the quota, the following message displays:

    Exceeded maximum points per chart, data skipped

    You can create up to 10 custom chart series per algorithm. If you exceed the quota, your algorithm stops executing and the following message displays:

    Exceeded maximum series count: Each backtest can have up to 10 series in total.

    In live trading, charts are sampled every one and ten minutes. If you create 1-minute resolution custom charts, the IDE charting will downgrade the granularity and display the 10-minutes sampling after a certain amount of samples.

    Logging

    Algorithms can record string messages ('log statements') to a file for analysis after a backtest is complete, or as a live algorithm is running. These records can assist in debugging logical flow errors in the project code. Consider adding them in the code block of an if statement to signify an error has been caught.

    It's good practice to add logging statements to live algorithms so you can understand its behavior and keep records to compare against backtest results. If you don't add logging statements to a live algorithm and the algorithm doesn't trade as you expect, it's difficult to evaluate the underlying problem.

    If you run algorithms on QuantConnect, you must stay within the log quota . To only log when your algorithm is live, use the LiveMode property.

    if (LiveMode)
    {
        Log("My log message");
    }
    if self.LiveMode:
        self.Log("My log message")

     

    20.8 Signal Exports

    Our Signal Export integrations let you send live trading signals to third-party services.

    See Also

    Datasets

     

    20.8.1 CrunchDAO

    Introduction

    CrunchDAO is a service that connects strategy developers and capital allocators. With our CrunchDAO integration, you can send trading signals from your live algorithms to the CrunchDAO .

    Add Providers

    To export signals to CrunchDAO from your algorithm, during initialization , add a CrunchDAO signal export provider.

    SignalExport.AddSignalExportProviders(new CrunchDAOSignalExport(apiKey, model, submissionName, comment));
    
    self.SignalExport.AddSignalExportProviders(CrunchDAOSignalExport(apiKey, model, submissionName, comment))
    

    The CrunchDAOSignalExport constructor accepts the following arguments:

    Argument: apiKey

    Your CrunchDAO API key. To get your API key, see the Profile > Settings page on the CrunchDAO website.

    Data Type: string str | Default Value: None

    Argument: model

    The Id of your CrunchDAO model. To create a new model or to get the Id of an existing model, see the Profile > Alpha page on the CrunchDAO website.

    Data Type: string str | Default Value: None

    Argument: submissionName

    A name for the submission to distinguish it from your other submissions.

    Data Type: string str | Default Value: ""

    Argument: comment

    A comment for the submission.

    Data Type: string str | Default Value: ""

    You can add multiple signal export providers to a single algorithm.

    Asset Classes

    Our CrunchDAO integration supports signals for US Equities .

    Send Portfolio Targets

    To send your current portfolio holdings, call the SetTargetPortfolioFromPortfolio method. The method returns a boolean that represents if the targets were successfully sent to CrunchDAO.

    var success = SignalExport.SetTargetPortfolioFromPortfolio();
    
    success = self.SignalExport.SetTargetPortfolioFromPortfolio()
    

    To send targets that aren't based on your current portfolio holdings, pass a PortfolioTarget object or an array a list of PortfolioTarget objects to the SetTargetPortfolio method. In this situation, the number you pass to the PortfolioTarget constructor represents the portfolio weight. Don't use the PortfolioTarget.Percent method.

    var target = new PortfolioTarget(_symbol, weight);
    var success = SignalExport.SetTargetPortfolio(target);
    target = PortfolioTarget(self.symbol, weight)
    success = self.SignalExport.SetTargetPortfolio(target)

    Signal Requirements

    When you submit signals to CrunchDAO, abide by the following rules:

    Examples

    Demonstration Algorithms
    CrunchDAOSignalExportDemonstrationAlgorithm.py Python CrunchDAOPortfolioSignalExportDemonstrationAlgorithm.py Python CrunchDAOSignalExportDemonstrationAlgorithm.cs C# CrunchDAOPortfolioSignalExportDemonstrationAlgorithm.cs C#

     

    20.8.2 Numerai

    Introduction

    Numerai is a platform where you can earn rewards by uploading unique live trading signals for a universe of US Equities. The regular Numerai Tournament is built around a free dataset they provide , but with Numerai Signals , you can now use any dataset to generate your trading signals. Through our Numerai integration, you can use our rich library of alternative datasets or your own custom datasets to create and automate your Numerai Signal submissions.

    Add Providers

    To export signals to Numerai from your algorithm, during initialization , add a Numerai signal export provider.

    SignalExport.AddSignalExportProviders(new NumeraiSignalExport(publicId, secretId, modelId, fileName));
    
    self.SignalExport.AddSignalExportProviders(NumeraiSignalExport(publicId, secretId, modelId, fileName))
    

    The NumeraiSignalExport constructor accepts the following arguments:

    Argument: publicId

    Your Numerai API key. To create and view your API keys, see the Automation section of your Account page on the Numerai website.

    Data Type: string str | Default Value: None

    Argument: secretId

    Your Numerai API secret. You get your API secret when you create a new API key.

    Data Type: string str | Default Value: None

    Argument: modelId

    The Id of the Numerai model. Follow these steps to get the model Id:

    1. Open the Models page on the Numerai website.
    2. In the Models section, click the three dots next to a model.
    3. Click Copy Model ID .

    Data Type: string str | Default Value: ""

    Argument: fileName

    The name for the signal file. If you use a file name that already exists, the new file overwrites the old one.

    Data Type: string str | Default Value: "predictions.csv"

    You can add multiple signal export providers to a single algorithm.

    Asset Classes

    Our Numerai integration supports signals for US Equities .

    Universe Selection

    The Numerai Signals stock market universe covers roughly the top 5,000 largest stocks in the world. The universe available on QuantConnect that's the closest match to the Numerai Signals universe is the CRSP US Total Market Index, which represents approximately 100% of the investable US Equity market regularly traded on the New York Stock Exchange and Nasdaq. This Index doesn't contain all of the stocks in the Numerai Signals universe, but you don't need to submit signals for all the stocks in the Numerai Signals universe.

    To get the constituents of the CRSP US Total Market Index, add an ETF constituents universe for the Vanguard Total Stock Market ETF, VTI.

    _etfSymbol = AddEquity("VTI").Symbol;
    AddUniverse(Universe.ETF(_etfSymbol));
    self.etf_symbol = self.AddEquity("VTI").Symbol 
    self.AddUniverse(self.Universe.ETF(self.etf_symbol))

    Schedule Submissions

    Every Tuesday, Wednesday, Thursday, Friday, and Saturday of the week, a new round is open for you to submit signals. Saturday rounds open at 18:00 UTC, and the submission window is open until Monday 14:30 UTC. Weekday rounds open at 13:00 UTC, and the submission window is open for 1 hour. For more information about the competition rounds, see Rounds in the Numerai documentation.

    To schedule your submissions, you can set a Scheduled Event during initialization.

    Schedule.On(
        DateRules.EveryDay(_etfSymbol),
        TimeRules.At(13, 0, TimeZones.Utc), 
        SubmitSignals);
    self.Schedule.On(
        self.DateRules.EveryDay(self.etf_symbol),
        self.TimeRules.At(13, 0, TimeZones.Utc), 
        self.submit_signals)

    Send Portfolio Targets

    To send targets, pass a list of PortfolioTarget objects to the SetTargetPortfolio method. The method returns a boolean that represents if the targets were successfully sent to Numerai Signals. In this situation, the number you pass to the PortfolioTarget constructor represents the portfolio weight. Don't use the PortfolioTarget.Percent method.

    var success = SignalExport.SetTargetPortfolio(targets);
    success = self.SignalExport.SetTargetPortfolio(targets)

    Signal Requirements

    When you submit signals to Numerai, abide by the following rules:

    Examples

    Demonstration Algorithms
    NumeraiSignalExportDemonstrationAlgorithm.py Python NumeraiSignalExportDemonstrationAlgorithm.cs C#

     

    21 Strategy Library

    Introduction

    The Strategy Library is a collection of tutorials written by the QuantConnect team and community members. Review these tutorials to learn about trading strategies found in the academic literature and how to implement them with QuantConnect/LEAN.

    Tutorials


    Strategy Name
    CAPM Alpha Ranking Strategy on Dow 30 Companies

    Applies CAPM model to rank Dow Jones 30 companies.

    Combining Mean Reversion and Momentum in Forex Market

    Combines momentum and mean reversion techniques in the forex markets.

    Pairs Trading-Copula vs Cointegration

    Applies Copula and Cointergration method to pairs trading.

    The Dynamic Breakout II Strategy

    A demonstration of dynamic breakout II strategy.

    Dual Thrust Trading Algorithm

    A demontration of Dual Thrust Intraday strategy.

    Can Crude Oil Predict Equity Returns

    Applies regression method to predict the return from the stock market and compare it to the short-term U.S. T-bill rate.

    Intraday Dynamic Pairs Trading using Correlation and Cointegration Approach

    A high frequency pairs trading algorithm based on cointegration.

    The Momentum Strategy Based on the Low Frequency Component of Forex Market

    Applies high frequency filter to the momentum strategy.

    Stock Selection Strategy Based on Fundamental Factors

    MorningStar Fundamental factors universe selection algorithm.

    Short-Term Reversal Strategy in Stocks

    A short term reversal algorithm which gives the opposite signal by analyzing recent period price action.

    Fundamental Factor Long Short Strategy

    A basic monthly rebalance long short algorithm based on fundamental factors.

    Asset Class Trend Following

    Selects ETFs over ten-month moving average and assigns an equally weighted allocation.

    Source: Quantpedia

    Asset Class Momentum

    Selects ETFs in different asset classes with the highest momentum and assigns an equally weighted allocation.

    Source: Quantpedia

    Residual Momentum

    Constructs a long/short portfolio based on trailing residual momentum normalized by its standard deviation

    Source: Quantpedia

    Sector Momentum

    Selects ETFs in different sectors with the highest momentum and assigns an equally weighted allocation.

    Source: Quantpedia

    Overnight Anomaly

    Buy SPY ETF at its closing price and sell it at the opening each day.

    Source: Quantpedia

    Forex Carry Trade

    Goes long the currency with the highest central bank interest rate and goes short the currency with the lowest interest rate.

    Source: Quantpedia

    Volatility Effect in Stocks

    Constructs equally weighted portfolios by selecting stocks with the lowest volatility in the past one year.

    Source: Quantpedia

    Forex Momentum

    Goes long currencies with strongest 12 month momentum against USD and goes short currencies with the lowest 12 month momentum against USD.

    Source: Quantpedia

    Pairs Trading with Stocks

    Looks for the security that minimizes the sum of squared deviations and long-short position is opened when pair prices have diverged by multiple of standard deviations.

    Source: Quantpedia

    Short Term Reversal

    Goes long stocks with the lowest return in the previous month and goes short stocks with the greatest return from the previous month.

    Source: Quantpedia

    Momentum Effect in Stocks

    Goes long stocks with the best 12-month momentum in the large-cap universe.

    Source: Quantpedia

    Momentum Effect in Country Equity Indexes

    Goes long stocks with the best 12-month momentum in the country equity indexes ETFs.

    Source: Quantpedia

    Mean Reversion Effect in Country Equity Indexes

    Goes long country equity indexes ETFs with the worst 36-month return and short ETFs with the best 36-month return.

    Source: Quantpedia

    Liquidity Effect in Stocks

    Goes long stocks with the lowest turnover and short on stocks with the highest turnover from the lowest market-cap quartile.

    Source: Quantpedia

    Volatility Risk Premium Effect

    Sells at-the-money straddle with one month until maturity and buys an offsetting 15% out-of-the-money puts each month.

    Source: Quantpedia

    Momentum Effect in Commodities Futures

    Goes long commodity futures with the highest momentum and short on futures with the lowest momentum.

    Source: Quantpedia

    Small Capitalization Stocks Premium Anomaly

    Goes long stocks with the lowest market capitalization and rebalances the portfolio once a year.

    Source: Quantpedia

    Paired Switching

    Goes long asset with better performance over the last period and rebalances portfolio every quarter.

    Source: Quantpedia

    Term Structure Effect in Commodities

    Buys each month the 20% of commodities with the highest roll-returns and shorts the 20% of commodities with the lowest roll-returns and holds the long-short positions for one month.

    Source: Quantpedia

    Momentum Effect Combined with Term Structure in Commodities

    Portfolios are formed based on roll returns and the algorithm goes long and short contracts with the highest and lowest one-month performance.

    Source: Quantpedia

    Book-to-Market Value Anomaly

    Quintile portfolios are formed based on the Book-to-Market ratio and the highest quintile is held for one year.

    Source: Quantpedia

    Gold Market Timing

    Goes long gold when the Fed model shows that the market is undervalued (the earnings yield is higher than the bond yield and their ratio is at least 2).

    Source: Quantpedia

    Turn of the Month in Equity Indexes

    Buys SPY the day before the end of the month and liquidates position on 3rd trading day of new month.

    Source: Quantpedia

    Momentum - Short Term Reversal Strategy

    Goes long stocks with the decreasing return from the winner group and short stocks with the increasing return from the loser group.

    Source: Quantpedia

    Pairs Trading with Country ETFs

    Identifies the price divergence from two highly correlated country ETFs and takes a market neutral position.

    Source: Quantpedia

    Sentiment and Style Rotation Effect in Stocks

    Creates long-short positions of growth and value stocks based on the investment sentiment.

    Source: Quantpedia

    Asset Growth Effect

    Creates long-short positions of stocks based on the annual change of their total assets.

    Source: Quantpedia

    Momentum and State of Market Filters

    Goes long and short stocks with the highest and lowest six-month momentum respectively if the previous 12 months return on the broad market index was positive.

    Source: Quantpedia

    Accrual Anomaly

    Decile portfolios are formed based on balance sheet based accruals and highest decile is shorted while lowest decile is bought for a year.

    Source: Quantpedia

    Momentum in Mutual Fund Returns

    Forms a long-short portfolio of asset management firms based on trailing rate of change and nearness to trailing high.

    Source: Quantpedia

    Momentum and Style Rotation Effect

    Goes long style index ETF with the highest 12-month momentum and short ETF with the lowest 12-month momentum.

    Source: Quantpedia

    Trading with WTI BRENT Spread

    Goes long the spread if the spread is below 20-day moving average and short if the spread is above 20-day moving average.

    Source: Quantpedia

    Momentum Effect in REITs

    Tercile portfolios are formed based on momentum and the best performing portfolio is held.

    Source: Quantpedia

    Option Expiration Week Effect

    Goes long S&P 100 index ETF during option expiration week and stays in cash during other days.

    Source: Quantpedia

    Earnings Quality Factor

    Goes long stocks with high earnings quality and short stocks with low earnings quality based on composite factor score.

    Source: Quantpedia

    January Effect in Stocks

    Invests into small cap stocks at the beginning of each January and stays invested in large cap stocks for rest of the year.

    Source: Quantpedia

    Momentum and Reversal Combined with Volatility Effect in Stocks

    Goes long on stocks from the highest performing quintile from the highest volatility group and short on stocks from the lowest performing quintile from the highest volatility group.

    Source: Quantpedia

    ROA Effect within Stocks

    Goes long on stocks with highest ROA and short stocks with the lowest ROA from each market capitalization group.

    Source: Quantpedia

    January Barometer

    Invested in equity market with ETF only if January return is positive otherwise switch investments to T-Bills.

    Source: Quantpedia

    Lunar Cycle in Equity Market

    Goes long in emerging market index ETF 7 days before the new moon and switch to a short position on emerging market index ETF 7 days before the full moon.

    Source: Quantpedia

    VIX Predicts Stock Index Returns

    Goes long on equity index ETF if the VIX is in the highest percentile short if VIX is in the lowest percentile in the last two-year history.

    Source: Quantpedia

    Combining Momentum Effect with Volume

    Goes long stocks with the highest volume from the top momentum decile and short stocks with the highest volume from the bottom momentum decile.

    Source: Quantpedia

    Short Term Reversal with Futures

    Goes long (short) on futures from the high-volume, low-open interest group with the lowest (greatest) returns in the previous week.

    Source: Quantpedia

    Pre-holiday Effect

    Invests in equity market 2 days preceding holiday days and stays in cash during the other trading days.

    Source: Quantpedia

    Beta Factors in Stocks

    Goes long stocks with the bottom beta and short stocks with the top beta, securities are weighted by the ranked betas.

    Source: Quantpedia

    Exploiting Term Structure of VIX Futures

    Buys or sells the nearest VIX futures based on the daily roll and hedge against the open positions with E-mini S&P500 futures.

    Source: Quantpedia

    12 Month Cycle in Cross-Section of Stocks Returns

    Reviews the returns from last January, going long on the top 10% winners and short the bottom 10%.

    Source: Quantpedia

    Momentum Effect in Stocks in Small Portfolios

    Goes long in the 10 stocks with the highest performance and goes short in the 10 stocks with the lowest performance in the previous one year.

    Source: Quantpedia

    Value Effect within Countries

    Invests in the cheapest 33% of country ETFs according to CAPE ratios.

    Source: Quantpedia

    Beta Factor in Country Equity Indexes

    Goes long on the low-beta portfolio and short on the high-beta portfolio in country indexes ETFs.

    Source: Quantpedia

    Price to Earnings Anomaly

    Invests in stocks with low P/E ratio.

    Fama French Five Factors

    Stock selecting strategy based on Fama-French Five Factors Model.

    Source: NYU

    Mean-Reversion Statistical Arbitrage Strategy in Stocks

    Apply statistical arbitrage to take advantage of pricing inefficiencies in stocks.

    Source: NYU

    Expected Idiosyncratic Skewness

    Stock selection strategy that calculates expected idiosyncratic skewness using Fama-French three-factor model, sorts stocks based on the calculated skewness, and longs the bottom 5%.

    Source: NYU

    Risk Premia in Forex Markets

    A strategy based on asymmetric tail risks and excess returns in forex markets.

    Source: NYU

    Seasonality Effect based on Same-Calendar Month Returns

    A strategy that takes long and short positions based on historical same-calendar month returns

    Source: NYU

    Standardized Unexpected Earnings

    Stock selection strategy that calculates the unexpected earnings, standardizes the unexpected earnings, goes long on the top 5%, and rebalances the portfolio monthly.

    Source: NYU

    Price and Earnings Momentum

    A momentum strategy based on quarterly returns and earnings growth

    Source: NYU

    Improved Momentum Strategy on Commodities Futures

    An advanced momentum strategy that modifies the basic momentum strategies by introducing Baltas and Kosowski weights and rebalances the portfolio monthly. The new weighing scheme incorporates trend strength into the trading signal, uses an efficient volatility estimator, and adds a dynamic leverage mechanism.

    Source: NYU

    Commodities Futures Trend Following

    A simple trend following strategy on commodities futures.

    Source: NYU

    Forecasting Stock Prices using a Temporal CNN Model

    Applying a Temporal Convolutional Neural Network to forecasting future stock prices.

    Source: Tampere University

    Leveraged ETFs with Systematic Risk Management

    We apply Simple Moving Averages to manage the risk of holding leveraged ETFs in an attempt to beat the S&P500

    Source: The Lead-Lag Report

    Ichimoku Clouds in the Energy Sector

    A techincal indicator crossover strategy trading the largest energy companies.

    Source: SSRN

    Intraday ETF Momentum

    A momentum strategy based on returns of the market open

    Source: NYU

    Intraday Arbitrage Between Index ETFs

    A strategy that tracks the price paths of two correlated ETFs and takes advantage of mis-pricings that arise when the price paths diverge

    Source: SSRN

    Optimal Pairs Trading

    Mathematically Deriving the Optimal Entry and Liquidation Values of a Pairs Trading Process

    Source: arXiv

    G-Score Investing

    Applying G-Score Investing to Invest in a Portfolio of Technology Stocks

    Source: SSRN

    SVM Wavelet Forecasting

    Forecasting EURJPY prices with an SVM Wavelet model

    Source: Academia

    Gradient Boosting Model

    Forecasts future intraday returns with a gradient boosting model trained on technical indicators

    Source: arXiv

    Using News Sentiment to Predict Price Direction of Drug Manufacturers

    Analyzes the news releases of drug manufacturers and places intraday trades for the stocks with positive news.

    Source: arXiv

    Gaussian Naive Bayes Model

    Forecasts the next day's return of technology stocks by fitting a gaussian naive bayes model to the historical returns of the technology sector constituents.

    Source: Academia

     

    22 API Reference

    Available QCAlgorithm Methods

    ABANDS() Creates a new Acceleration Bands indicator.
    AD() Creates a new AccumulationDistribution indicator.
    AddAlpha() Adds a new alpha model.
    AddCfd() Creates and adds a new Cfd security to the algorithm.
    AddChart() Add a Chart object to algorithm collection.
    AddCrypto() Creates and adds a new Crypto security to the algorithm.
    AddCryptoFuture() Creates and adds a new CryptoFuture security to the algorithm.
    AddData() AddData a new user defined data source, requiring only the minimum config options. The data is added with a default time zone of NewYork (Eastern Daylight Savings Time). This method is meant for custom data types that require a ticker, but have no underlying Symbol. Examples of data sources that meet this criteria are U.S. Treasury Yield Curve Rates and Trading Economics data.
    AddEquity() Creates and adds a new Equity security to the algorithm.
    AddForex() Creates and adds a new Forex security to the algorithm.
    AddFuture() Creates and adds a new Future security to the algorithm.
    AddFutureContract() Creates and adds a new single Future contract to the algorithm.
    AddFutureOption() Creates and adds a new Future Option contract to the algorithm.
    AddFutureOptionContract() Adds a future option contract to the algorithm.
    AddIndex() Creates and adds a new Index security to the algorithm.
    AddIndexOption() Creates and adds index options to the algorithm.
    AddIndexOptionContract() Adds an index option contract to the algorithm.
    AddOption() Creates and adds a new equity Option security to the algorithm.
    AddOptionContract() Creates and adds a new single Option contract to the algorithm.
    AddRiskManagement() Adds a new risk management model.
    AddSecurity() Add specified data to our data subscriptions. QuantConnect will funnel this data to the handle data routine.
    AddSeries() Add a series object for charting. This is useful when initializing charts with series other than type = line. If a series exists in the chart with the same name, then it is replaced.
    AddUniverse() Adds the universe to the algorithm.
    AddUniverseOptions() Adds a new universe that creates options of the security by monitoring any changes in the Universe the provided security is in. Additionally, a filter can be applied to the options generated when the universe of the security changes.
    AddUniverseSelection() Adds a new universe selection model.
    ADDIFF()
    ADOSC() Creates a new AccumulationDistributionOscillator indicator.
    ADR()
    ADVR()
    ADX() Creates a new Average Directional Index indicator. The indicator will be automatically updated on the given resolution.
    ADXR() Creates a new AverageDirectionalMovementIndexRating indicator.
    ALMA() Creates a new ArnaudLegouxMovingAverage indicator.
    AO() Creates a new Awesome Oscillator from the specified periods.
    APO() Creates a new AbsolutePriceOscillator indicator.
    APS() Creates an AugenPriceSpike indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ARIMA() Creates a new ARIMA indicator.
    AROON() Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).
    ASI() Creates a Wilder Accumulative Swing Index (ASI) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ATR() Creates a new AverageTrueRange indicator for the symbol. The indicator will be automatically updated on the given resolution.
    B() Creates a Beta indicator for the given target symbol in relation with the reference used. The indicator will be automatically updated on the given resolution.
    BB() Creates a new BollingerBands indicator which will compute the MiddleBand, UpperBand, LowerBand, and StandardDeviation.
    BOP() Creates a new Balance Of Power indicator. The indicator will be automatically updated on the given resolution.
    Buy() Buy Stock (Alias of Order).
    CalculateOrderQuantity() Calculate the order quantity to achieve target-percent holdings.
    CC() Initializes a new instance of the CoppockCurve" indicator.
    CCI() Creates a new CommodityChannelIndex indicator. The indicator will be automatically updated on the given resolution.
    CMF() Creates a new ChaikinMoneyFlow indicator.
    CMO() Creates a new ChandeMomentumOscillator indicator.
    ComboLegLimitOrder() Issue a combo leg limit order/trade for multiple assets, each having its own limit price.
    ComboLimitOrder() Issue a combo limit order/trade for multiple assets. A single limit price is defined for the combo order and will fill only if the sum of the assets price compares properly to the limit price, depending on the direction.
    ComboMarketOrder() Issue a combo market order/trade for multiple assets.
    CompositeFIGI() Converts a composite FIGI identifier into a Symbol .
    Consolidate() Registers the handler to receive consolidated data for the specified symbol.
    CreateConsolidator() Creates a new consolidator for the specified period, generating the requested output type.
    CUSIP() Converts a CUSIP identifier into a Symbol .
    DCH() Creates a new Donchian Channel indicator which will compute the Upper Band and Lower Band. The indicator will be automatically updated on the given resolution.
    Debug() Send a debug message to the web console:.
    DEM() Creates a new DeMarker Indicator (DEM), an oscillator-type indicator measuring changes in terms of an asset's High and Low tradebar values.
    DEMA() Creates a new DoubleExponentialMovingAverage indicator.
    Download() Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.
    DPO() Creates a new DetrendedPriceOscillator" indicator.
    EMA() Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    EmitInsights() Manually emit insights from an algorithm. This is typically invoked before calls to submit orders in algorithms written against QCAlgorithm that have been ported into the algorithm framework.
    EMV() Creates an EaseOfMovementValue indicator for the symbol. The indicator will be automatically updated on the given resolution.
    Error() Send a string error message to the Console.
    ExerciseOption() Send an exercise order to the transaction handler.
    FilteredIdentity() Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.
    FISH() Creates an FisherTransform indicator for the symbol. The indicator will be automatically updated on the given resolution.
    FRAMA() Creates an FractalAdaptiveMovingAverage (FRAMA) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    FrameworkPostInitialize() Called by setup handlers after Initialize and allows the algorithm a chance to organize the data gather in the Initialize method.
    GetLastKnownPrices() Yields data to warmup a security for all it's subscribed data types.
    GetParameters() Gets a read-only dictionary with all current parameters.
    HeikinAshi() Creates a new Heikin-Ashi indicator.
    History() Gets the historical data for the specified symbol. The exact number of bars will be returned. The symbol must exist in the Securities collection.
    HMA() Creates a new HullMovingAverage indicator. The Hull moving average is a series of nested weighted moving averages, is fast and smooth.
    HT() Creates a new Hilbert Transform indicator.
    ICHIMOKU() Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically updated on the given resolution.
    Identity() Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.
    Initialize() Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
    IsMarketOpen() Determines if the exchange for the specified symbol is open at the current time.
    ISIN() Converts an ISIN identifier into a Symbol .
    KAMA() Creates a new KaufmanAdaptiveMovingAverage indicator.
    KCH() Creates a new Keltner Channels indicator. The indicator will be automatically updated on the given resolution.
    KER() Creates an KaufmanEfficiencyRatio indicator for the symbol. The indicator will be automatically updated on the given resolution.
    LimitIfTouchedOrder() Send a limit if touched order to the transaction handler:.
    LimitOrder() Send a limit order to the transaction handler:.
    Liquidate() Liquidate all holdings and cancel open orders. Called at the end of day for tick-strategies.
    Log() Added another method for logging if user guessed.
    LOGR() Creates a new LogReturn indicator.
    LSMA() Creates and registers a new Least Squares Moving Average instance.
    LWMA() Creates a new LinearWeightedMovingAverage indicator. This indicator will linearly distribute the weights across the periods.
    MACD() Creates a MACD indicator for the symbol. The indicator will be automatically updated on the given resolution.
    MAD() Creates a new MeanAbsoluteDeviation indicator.
    MarketOnCloseOrder() Market on close order implementation: Send a market order when the exchange closes.
    MarketOnOpenOrder() Market on open order implementation: Send a market order when the exchange opens.
    MarketOrder() Market order implementation: Send a market order and wait for it to be filled.
    MASS() Creates a new Mass Index indicator. The indicator will be automatically updated on the given resolution.
    MAX() Creates a new Maximum indicator to compute the maximum value.
    MFI() Creates a new MoneyFlowIndex indicator. The indicator will be automatically updated on the given resolution.
    MIDPOINT() Creates a new MidPoint indicator.
    MIDPRICE() Creates a new MidPrice indicator.
    MIN() Creates a new Minimum indicator to compute the minimum value.
    MOM() Creates a new Momentum indicator. This will compute the absolute n-period change in the security. The indicator will be automatically updated on the given resolution.
    MOMERSION() Creates a new Momersion indicator.
    MOMP() Creates a new MomentumPercent indicator. This will compute the n-period percent change in the security. The indicator will be automatically updated on the given resolution.
    MOSC() Creates a new McClellan Oscillator indicator.
    MSI() Creates a new McClellan Summation Index indicator.
    NATR() Creates a new NormalizedAverageTrueRange indicator.
    OBV() Creates a new On Balance Volume indicator. This will compute the cumulative total volume based on whether the close price being higher or lower than the previous period. The indicator will be automatically updated on the given resolution.
    OnAssignmentOrderEvent() Option assignment event handler. On an option assignment event for short legs the resulting information is passed to this method.
    OnData() Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event.
    OnEndOfAlgorithm() End of algorithm run event handler. This method is called at the end of a backtest or live trading operation. Intended for closing out logs.
    OnEndOfDay() End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).
    OnEndOfTimeStep() Invoked at the end of every time step. This allows the algorithm to process events before advancing to the next time step.
    OnFrameworkData() Used to send data updates to algorithm framework models.
    OnFrameworkSecuritiesChanged() Used to send security changes to algorithm framework models.
    OnMarginCall() Margin call event handler. This method is called right before the margin call orders are placed in the market.
    OnMarginCallWarning() Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue.
    OnOrderEvent() Order fill event handler. On an order fill update the resulting information is passed to this method.
    OnWarmupFinished() Called when the algorithm has completed initialization and warm up.
    Order() Issue an order/trade for asset: Alias wrapper for Order(string, int);.
    Plot() Plot a chart to string chart name, using string series name, with int value.
    PlotIndicator() Automatically plots each indicator when a new value is available.
    PPHL() Creates a new PivotPointsHighLow indicator.
    PPO() Creates a new PercentagePriceOscillator indicator.
    PSAR() Creates a new Parabolic SAR indicator.
    Quit() Terminate the algorithm after processing the current event handler.
    RC() Creates a new RegressionChannel indicator which will compute the LinearRegression, UpperChannel and LowerChannel lines, the intercept and slope.
    RDV() Creates an RelativeDailyVolume indicator for the symbol. The indicator will be automatically updated on the given resolution.
    Record() Plot a chart using string series name, with int value. Alias of Plot();.
    RegisterIndicator() Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.
    RemoveOptionContract() Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.
    RemoveSecurity() Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.
    ResolveConsolidator() Gets the default consolidator for the specified symbol and resolution.
    RMA() Creates a new Relative Moving Average indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ROC() Creates a new RateOfChange indicator. This will compute the n-period rate of change in the security. The indicator will be automatically updated on the given resolution.
    ROCP() Creates a new RateOfChangePercent indicator. This will compute the n-period percentage rate of change in the security. The indicator will be automatically updated on the given resolution.
    ROCR() Creates a new RateOfChangeRatio indicator.
    RSI() Creates a new RelativeStrengthIndex indicator. This will produce an oscillator that ranges from 0 to 100 based on the ratio of average gains to average losses over the specified period.
    RVI() Creates a new RelativeVigorIndex indicator.
    SEDOL() Converts a SEDOL identifier into a Symbol .
    Sell() Sell stock (alias of Order).
    SetAccountCurrency() Sets the account currency cash symbol this algorithm is to manage.
    SetAlpha() Sets the alpha model.
    SetApi() Provide the API for the algorithm.
    SetBenchmark() Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.
    SetBrokerageMessageHandler() Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a Error occurs, the algorithm is stopped.
    SetBrokerageModel() Sets the brokerage to emulate in backtesting or paper trading. This can be used to set a custom brokerage model.
    SetCash() Set initial cash for the strategy while backtesting. During live mode this value is ignored and replaced with the actual cash of your brokerage account.
    SetCurrentSlice() Sets the current slice.
    SetEndDate() Set the end date for a backtest run.
    SetExecution() Sets the execution model.
    SetFutureChainProvider() Sets the future chain provider, used to get the list of future contracts for an underlying symbol.
    SetHoldings() Sets holdings for a collection of targets. The implementation will order the provided targets executing first those that reduce a position, freeing margin.
    SetObjectStore() Sets the object store.
    SetOptionChainProvider() Sets the option chain provider, used to get the list of option contracts for an underlying symbol.
    SetPandasConverter() Sets pandas converter.
    SetParameters()
    SetPortfolioConstruction() Sets the portfolio construction model.
    SetQuit() Set the Quit flag property of the algorithm.
    SetRiskManagement() Sets the risk management model.
    SetRunTimeError() Set the runtime error.
    SetRuntimeStatistic() Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.
    SetSecurityInitializer() Sets the security initializer function, used to initialize/configure securities after creation.
    SetStartDate() Set the start date for backtest.
    SetTimeZone() Sets the time zone of the Time property in the algorithm.
    SetTradeBuilder() Set the ITradeBuilder implementation to generate trades from executions and market price updates.
    SetUniverseSelection() Sets the universe selection model.
    SetWarmUp() Sets the warm up period to the specified value.
    Shortable() Determines if the Symbol is shortable at the brokerage.
    ShortableQuantity() Gets the quantity shortable for the given asset.
    SI() Creates a Wilder Swing Index (SI) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    SMA() Creates an SimpleMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    SORTINO() Creates a new Sortino indicator.
    SR() Creates a new RollingSharpeRatio indicator.
    STC() Creates a new Schaff Trend Cycle indicator.
    STD() Creates a new StandardDeviation indicator. This will return the population standard deviation of samples over the specified period.
    STO() Creates a new Stochastic indicator.
    StopLimitOrder() Send a stop limit order to the transaction handler:.
    StopMarketOrder() Create a stop market order and return the newly created order id; or negative if the order is invalid.
    STR() Creates a new SuperTrend indicator.
    SubmitOrderRequest() Will submit an order request to the algorithm.
    SUM() Creates a new Sum indicator.
    SWISS() Creates Swiss Army Knife transformation for the symbol. The indicator will be automatically updated on the given resolution.
    Symbol() Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm.
    T3() Creates a new T3MovingAverage indicator.
    TDD() Creates a new TargetDownsideDeviation indicator. The target downside deviation is defined as the root-mean-square, or RMS, of the deviations of the realized return’s underperformance from the target return where all returns above the target return are treated as underperformance of 0.
    TEMA() Creates a new TripleExponentialMovingAverage indicator.
    TP() Creates an Market Profile indicator for the symbol with Time Price Opportunity (TPO) mode. The indicator will be automatically updated on the given resolution.
    TR() Creates a new TrueRange indicator.
    Train() Schedules the provided training code to execute immediately.
    TRIMA() Creates a new TriangularMovingAverage indicator.
    TRIN() Creates a new Arms Index indicator.
    TRIX() Creates a new Trix indicator.
    TSI() Creates a TrueStrengthIndex indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ULTOSC() Creates a new UltimateOscillator indicator.
    VAR() Creates a new Variance indicator. This will return the population variance of samples over the specified period.
    VP() Creates an Market Profile indicator for the symbol with Volume Profile (VOL) mode. The indicator will be automatically updated on the given resolution.
    VWAP() Creates an VolumeWeightedAveragePrice (VWAP) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    WarmUpIndicator() Warms up a given indicator with historical data.
    WILR() Creates a new Williams %R indicator. This will compute the percentage change of the current closing price in relation to the high and low of the past N periods. The indicator will be automatically updated on the given resolution.
    WWMA() Creates a WilderMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    AddCfd() Creates and adds a new Cfd security to the algorithm.
    AddCrypto() Creates and adds a new Crypto security to the algorithm.
    AddCryptoFuture() Creates and adds a new CryptoFuture security to the algorithm.
    AddData() AddData a new user defined data source, requiring only the minimum config options. The data is added with a default time zone of NewYork (Eastern Daylight Savings Time). This method is meant for custom data types that require a ticker, but have no underlying Symbol. Examples of data sources that meet this criteria are U.S. Treasury Yield Curve Rates and Trading Economics data.
    AddEquity() Creates and adds a new Equity security to the algorithm.
    AddForex() Creates and adds a new Forex security to the algorithm.
    AddFuture() Creates and adds a new Future security to the algorithm.
    AddFutureContract() Creates and adds a new single Future contract to the algorithm.
    AddFutureOption() Creates and adds a new Future Option contract to the algorithm.
    AddFutureOptionContract() Adds a future option contract to the algorithm.
    AddIndex() Creates and adds a new Index security to the algorithm.
    AddIndexOption() Creates and adds index options to the algorithm.
    AddIndexOptionContract() Adds an index option contract to the algorithm.
    AddOption() Creates and adds a new equity Option security to the algorithm.
    AddOptionContract() Creates and adds a new single Option contract to the algorithm.
    AddSecurity() Add specified data to our data subscriptions. QuantConnect will funnel this data to the handle data routine.
    Download() Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.
    GetLastKnownPrices() Yields data to warmup a security for all it's subscribed data types.
    RemoveOptionContract() Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.
    RemoveSecurity() Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.
    SetFutureChainProvider() Sets the future chain provider, used to get the list of future contracts for an underlying symbol.
    SetOptionChainProvider() Sets the option chain provider, used to get the list of option contracts for an underlying symbol.
    SetSecurityInitializer() Sets the security initializer function, used to initialize/configure securities after creation.
    Symbol() Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm.
    AddAlpha() Adds a new alpha model.
    AddRiskManagement() Adds a new risk management model.
    AddUniverseSelection() Adds a new universe selection model.
    EmitInsights() Manually emit insights from an algorithm. This is typically invoked before calls to submit orders in algorithms written against QCAlgorithm that have been ported into the algorithm framework.
    FrameworkPostInitialize() Called by setup handlers after Initialize and allows the algorithm a chance to organize the data gather in the Initialize method.
    Initialize() Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
    OnFrameworkData() Used to send data updates to algorithm framework models.
    OnFrameworkSecuritiesChanged() Used to send security changes to algorithm framework models.
    SetAlpha() Sets the alpha model.
    SetExecution() Sets the execution model.
    SetPortfolioConstruction() Sets the portfolio construction model.
    SetRiskManagement() Sets the risk management model.
    SetUniverseSelection() Sets the universe selection model.
    AddChart() Add a Chart object to algorithm collection.
    AddSeries() Add a series object for charting. This is useful when initializing charts with series other than type = line. If a series exists in the chart with the same name, then it is replaced.
    Plot() Plot a chart to string chart name, using string series name, with int value.
    PlotIndicator() Automatically plots each indicator when a new value is available.
    Record() Plot a chart using string series name, with int value. Alias of Plot();.
    SetRuntimeStatistic() Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.
    Consolidate() Registers the handler to receive consolidated data for the specified symbol.
    CreateConsolidator() Creates a new consolidator for the specified period, generating the requested output type.
    RegisterIndicator() Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.
    ResolveConsolidator() Gets the default consolidator for the specified symbol and resolution.
    CompositeFIGI() Converts a composite FIGI identifier into a Symbol .
    CUSIP() Converts a CUSIP identifier into a Symbol .
    Initialize() Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
    ISIN() Converts an ISIN identifier into a Symbol .
    OnData() Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event.
    OnEndOfAlgorithm() End of algorithm run event handler. This method is called at the end of a backtest or live trading operation. Intended for closing out logs.
    OnEndOfDay() End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).
    OnEndOfTimeStep() Invoked at the end of every time step. This allows the algorithm to process events before advancing to the next time step.
    OnFrameworkData() Used to send data updates to algorithm framework models.
    OnWarmupFinished() Called when the algorithm has completed initialization and warm up.
    SEDOL() Converts a SEDOL identifier into a Symbol .
    SetApi() Provide the API for the algorithm.
    SetCurrentSlice() Sets the current slice.
    SetEndDate() Set the end date for a backtest run.
    SetObjectStore() Sets the object store.
    SetRunTimeError() Set the runtime error.
    SetStartDate() Set the start date for backtest.
    SetTimeZone() Sets the time zone of the Time property in the algorithm.
    Symbol() Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm.
    GetLastKnownPrices() Yields data to warmup a security for all it's subscribed data types.
    History() Gets the historical data for the specified symbol. The exact number of bars will be returned. The symbol must exist in the Securities collection.
    SetWarmUp() Sets the warm up period to the specified value.
    WarmUpIndicator() Warms up a given indicator with historical data.
    ABANDS() Creates a new Acceleration Bands indicator.
    AD() Creates a new AccumulationDistribution indicator.
    ADDIFF()
    ADOSC() Creates a new AccumulationDistributionOscillator indicator.
    ADR()
    ADVR()
    ADX() Creates a new Average Directional Index indicator. The indicator will be automatically updated on the given resolution.
    ADXR() Creates a new AverageDirectionalMovementIndexRating indicator.
    ALMA() Creates a new ArnaudLegouxMovingAverage indicator.
    AO() Creates a new Awesome Oscillator from the specified periods.
    APO() Creates a new AbsolutePriceOscillator indicator.
    APS() Creates an AugenPriceSpike indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ARIMA() Creates a new ARIMA indicator.
    AROON() Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).
    ASI() Creates a Wilder Accumulative Swing Index (ASI) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ATR() Creates a new AverageTrueRange indicator for the symbol. The indicator will be automatically updated on the given resolution.
    B() Creates a Beta indicator for the given target symbol in relation with the reference used. The indicator will be automatically updated on the given resolution.
    BB() Creates a new BollingerBands indicator which will compute the MiddleBand, UpperBand, LowerBand, and StandardDeviation.
    BOP() Creates a new Balance Of Power indicator. The indicator will be automatically updated on the given resolution.
    CC() Initializes a new instance of the CoppockCurve" indicator.
    CCI() Creates a new CommodityChannelIndex indicator. The indicator will be automatically updated on the given resolution.
    CMF() Creates a new ChaikinMoneyFlow indicator.
    CMO() Creates a new ChandeMomentumOscillator indicator.
    DCH() Creates a new Donchian Channel indicator which will compute the Upper Band and Lower Band. The indicator will be automatically updated on the given resolution.
    DEM() Creates a new DeMarker Indicator (DEM), an oscillator-type indicator measuring changes in terms of an asset's High and Low tradebar values.
    DEMA() Creates a new DoubleExponentialMovingAverage indicator.
    DPO() Creates a new DetrendedPriceOscillator" indicator.
    EMA() Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    EMV() Creates an EaseOfMovementValue indicator for the symbol. The indicator will be automatically updated on the given resolution.
    FilteredIdentity() Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.
    FISH() Creates an FisherTransform indicator for the symbol. The indicator will be automatically updated on the given resolution.
    FRAMA() Creates an FractalAdaptiveMovingAverage (FRAMA) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    HeikinAshi() Creates a new Heikin-Ashi indicator.
    HMA() Creates a new HullMovingAverage indicator. The Hull moving average is a series of nested weighted moving averages, is fast and smooth.
    HT() Creates a new Hilbert Transform indicator.
    ICHIMOKU() Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically updated on the given resolution.
    Identity() Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.
    KAMA() Creates a new KaufmanAdaptiveMovingAverage indicator.
    KCH() Creates a new Keltner Channels indicator. The indicator will be automatically updated on the given resolution.
    KER() Creates an KaufmanEfficiencyRatio indicator for the symbol. The indicator will be automatically updated on the given resolution.
    LOGR() Creates a new LogReturn indicator.
    LSMA() Creates and registers a new Least Squares Moving Average instance.
    LWMA() Creates a new LinearWeightedMovingAverage indicator. This indicator will linearly distribute the weights across the periods.
    MACD() Creates a MACD indicator for the symbol. The indicator will be automatically updated on the given resolution.
    MAD() Creates a new MeanAbsoluteDeviation indicator.
    MASS() Creates a new Mass Index indicator. The indicator will be automatically updated on the given resolution.
    MAX() Creates a new Maximum indicator to compute the maximum value.
    MFI() Creates a new MoneyFlowIndex indicator. The indicator will be automatically updated on the given resolution.
    MIDPOINT() Creates a new MidPoint indicator.
    MIDPRICE() Creates a new MidPrice indicator.
    MIN() Creates a new Minimum indicator to compute the minimum value.
    MOM() Creates a new Momentum indicator. This will compute the absolute n-period change in the security. The indicator will be automatically updated on the given resolution.
    MOMERSION() Creates a new Momersion indicator.
    MOMP() Creates a new MomentumPercent indicator. This will compute the n-period percent change in the security. The indicator will be automatically updated on the given resolution.
    MOSC() Creates a new McClellan Oscillator indicator.
    MSI() Creates a new McClellan Summation Index indicator.
    NATR() Creates a new NormalizedAverageTrueRange indicator.
    OBV() Creates a new On Balance Volume indicator. This will compute the cumulative total volume based on whether the close price being higher or lower than the previous period. The indicator will be automatically updated on the given resolution.
    PlotIndicator() Automatically plots each indicator when a new value is available.
    PPHL() Creates a new PivotPointsHighLow indicator.
    PPO() Creates a new PercentagePriceOscillator indicator.
    PSAR() Creates a new Parabolic SAR indicator.
    RC() Creates a new RegressionChannel indicator which will compute the LinearRegression, UpperChannel and LowerChannel lines, the intercept and slope.
    RDV() Creates an RelativeDailyVolume indicator for the symbol. The indicator will be automatically updated on the given resolution.
    RegisterIndicator() Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.
    ResolveConsolidator() Gets the default consolidator for the specified symbol and resolution.
    RMA() Creates a new Relative Moving Average indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ROC() Creates a new RateOfChange indicator. This will compute the n-period rate of change in the security. The indicator will be automatically updated on the given resolution.
    ROCP() Creates a new RateOfChangePercent indicator. This will compute the n-period percentage rate of change in the security. The indicator will be automatically updated on the given resolution.
    ROCR() Creates a new RateOfChangeRatio indicator.
    RSI() Creates a new RelativeStrengthIndex indicator. This will produce an oscillator that ranges from 0 to 100 based on the ratio of average gains to average losses over the specified period.
    RVI() Creates a new RelativeVigorIndex indicator.
    SetBenchmark() Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.
    SI() Creates a Wilder Swing Index (SI) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    SMA() Creates an SimpleMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    SORTINO() Creates a new Sortino indicator.
    SR() Creates a new RollingSharpeRatio indicator.
    STC() Creates a new Schaff Trend Cycle indicator.
    STD() Creates a new StandardDeviation indicator. This will return the population standard deviation of samples over the specified period.
    STO() Creates a new Stochastic indicator.
    STR() Creates a new SuperTrend indicator.
    SUM() Creates a new Sum indicator.
    SWISS() Creates Swiss Army Knife transformation for the symbol. The indicator will be automatically updated on the given resolution.
    T3() Creates a new T3MovingAverage indicator.
    TDD() Creates a new TargetDownsideDeviation indicator. The target downside deviation is defined as the root-mean-square, or RMS, of the deviations of the realized return’s underperformance from the target return where all returns above the target return are treated as underperformance of 0.
    TEMA() Creates a new TripleExponentialMovingAverage indicator.
    TP() Creates an Market Profile indicator for the symbol with Time Price Opportunity (TPO) mode. The indicator will be automatically updated on the given resolution.
    TR() Creates a new TrueRange indicator.
    TRIMA() Creates a new TriangularMovingAverage indicator.
    TRIN() Creates a new Arms Index indicator.
    TRIX() Creates a new Trix indicator.
    TSI() Creates a TrueStrengthIndex indicator for the symbol. The indicator will be automatically updated on the given resolution.
    ULTOSC() Creates a new UltimateOscillator indicator.
    VAR() Creates a new Variance indicator. This will return the population variance of samples over the specified period.
    VP() Creates an Market Profile indicator for the symbol with Volume Profile (VOL) mode. The indicator will be automatically updated on the given resolution.
    VWAP() Creates an VolumeWeightedAveragePrice (VWAP) indicator for the symbol. The indicator will be automatically updated on the given resolution.
    WarmUpIndicator() Warms up a given indicator with historical data.
    WILR() Creates a new Williams %R indicator. This will compute the percentage change of the current closing price in relation to the high and low of the past N periods. The indicator will be automatically updated on the given resolution.
    WWMA() Creates a WilderMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.
    SetRunTimeError() Set the runtime error.
    Debug() Send a debug message to the web console:.
    Error() Send a string error message to the Console.
    Log() Added another method for logging if user guessed.
    Quit() Terminate the algorithm after processing the current event handler.
    SetBrokerageMessageHandler() Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a Error occurs, the algorithm is stopped.
    SetQuit() Set the Quit flag property of the algorithm.
    Download() Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.
    SetObjectStore() Sets the object store.
    Train() Schedules the provided training code to execute immediately.
    OnMarginCall() Margin call event handler. This method is called right before the margin call orders are placed in the market.
    OnMarginCallWarning() Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue.
    SetBrokerageMessageHandler() Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a Error occurs, the algorithm is stopped.
    SetBrokerageModel() Sets the brokerage to emulate in backtesting or paper trading. This can be used to set a custom brokerage model.
    SetSecurityInitializer() Sets the security initializer function, used to initialize/configure securities after creation.
    GetParameters() Gets a read-only dictionary with all current parameters.
    SetParameters()
    Train() Schedules the provided training code to execute immediately.
    CompositeFIGI() Converts a composite FIGI identifier into a Symbol .
    CUSIP() Converts a CUSIP identifier into a Symbol .
    IsMarketOpen() Determines if the exchange for the specified symbol is open at the current time.
    ISIN() Converts an ISIN identifier into a Symbol .
    SEDOL() Converts a SEDOL identifier into a Symbol .
    SetAccountCurrency() Sets the account currency cash symbol this algorithm is to manage.
    SetBenchmark() Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.
    SetCash() Set initial cash for the strategy while backtesting. During live mode this value is ignored and replaced with the actual cash of your brokerage account.
    AddRiskManagement() Adds a new risk management model.
    Buy() Buy Stock (Alias of Order).
    CalculateOrderQuantity() Calculate the order quantity to achieve target-percent holdings.
    ExerciseOption() Send an exercise order to the transaction handler.
    IsMarketOpen() Determines if the exchange for the specified symbol is open at the current time.
    LimitIfTouchedOrder() Send a limit if touched order to the transaction handler:.
    LimitOrder() Send a limit order to the transaction handler:.
    Liquidate() Liquidate all holdings and cancel open orders. Called at the end of day for tick-strategies.
    MarketOnCloseOrder() Market on close order implementation: Send a market order when the exchange closes.
    MarketOnOpenOrder() Market on open order implementation: Send a market order when the exchange opens.
    MarketOrder() Market order implementation: Send a market order and wait for it to be filled.
    OnAssignmentOrderEvent() Option assignment event handler. On an option assignment event for short legs the resulting information is passed to this method.
    OnMarginCall() Margin call event handler. This method is called right before the margin call orders are placed in the market.
    OnMarginCallWarning() Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue.
    OnOrderEvent() Order fill event handler. On an order fill update the resulting information is passed to this method.
    Order() Issue an order/trade for asset: Alias wrapper for Order(string, int);.
    Sell() Sell stock (alias of Order).
    SetBenchmark() Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.
    SetExecution() Sets the execution model.
    SetHoldings() Sets holdings for a collection of targets. The implementation will order the provided targets executing first those that reduce a position, freeing margin.
    SetPortfolioConstruction() Sets the portfolio construction model.
    SetRiskManagement() Sets the risk management model.
    SetTradeBuilder() Set the ITradeBuilder implementation to generate trades from executions and market price updates.
    Shortable() Determines if the Symbol is shortable at the brokerage.
    ShortableQuantity() Gets the quantity shortable for the given asset.
    StopLimitOrder() Send a stop limit order to the transaction handler:.
    StopMarketOrder() Create a stop market order and return the newly created order id; or negative if the order is invalid.
    AddUniverse() Adds the universe to the algorithm.
    AddUniverseOptions() Adds a new universe that creates options of the security by monitoring any changes in the Universe the provided security is in. Additionally, a filter can be applied to the options generated when the universe of the security changes.
    AddUniverseSelection() Adds a new universe selection model.
    OnFrameworkSecuritiesChanged() Used to send security changes to algorithm framework models.
    SetUniverseSelection() Sets the universe selection model.

    ABANDS() 1/1

                AccelerationBands QuantConnect.Algorithm.QCAlgorithm.ABANDS (
        Symbol                            symbol,
        Int32                             period,
        *Decimal                          width,
        *MovingAverageType                movingAverageType,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Acceleration Bands indicator.

    AD() 1/1

                AccumulationDistribution QuantConnect.Algorithm.QCAlgorithm.AD (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AccumulationDistribution indicator.

    AddAlpha() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddAlpha (
        IAlphaModel  alpha
       )
            

    Adds a new alpha model.

    AddAlpha() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddAlpha (
        PyObject  alpha
       )
            

    Adds a new alpha model.

    AddCfd() 1/1

                Cfd QuantConnect.Algorithm.QCAlgorithm.AddCfd (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new Cfd security to the algorithm.

    AddChart() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.AddChart (
        Chart  chart
       )
            

    Add a Chart object to algorithm collection.

    AddCrypto() 1/1

                Crypto QuantConnect.Algorithm.QCAlgorithm.AddCrypto (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new Crypto security to the algorithm.

    AddCryptoFuture() 1/1

                CryptoFuture QuantConnect.Algorithm.QCAlgorithm.AddCryptoFuture (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new CryptoFuture security to the algorithm.

    AddData() 1/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        PyObject                     type,
        String                       ticker,
        *Nullable<Resolution>  resolution
       )
            

    AddData a new user defined data source, requiring only the minimum config options. The data is added with a default time zone of NewYork (Eastern Daylight Savings Time). This method is meant for custom data types that require a ticker, but have no underlying Symbol. Examples of data sources that meet this criteria are U.S. Treasury Yield Curve Rates and Trading Economics data.

    AddData() 2/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        PyObject                     type,
        Symbol                       underlying,
        *Nullable<Resolution>  resolution
       )
            

    AddData a new user defined data source, requiring only the minimum config options. The data is added with a default time zone of NewYork (Eastern Daylight Savings Time). This adds a Symbol to the `Underlying` property in the custom data Symbol object. Use this method when adding custom data with a ticker from the past, such as "AOL" before it became "TWX", or if you need to filter using custom data and place trades on the Symbol associated with the custom data.

    AddData() 3/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        PyObject                    type,
        String                      ticker,
        Nullable<Resolution>  resolution,
        DateTimeZone                timeZone,
        *Boolean                    fillForward,
        *Decimal                    leverage
       )
            

    AddData a new user defined data source, requiring only the minimum config options. This method is meant for custom data types that require a ticker, but have no underlying Symbol. Examples of data sources that meet this criteria are U.S. Treasury Yield Curve Rates and Trading Economics data.

    AddData() 4/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        PyObject                    type,
        Symbol                      underlying,
        Nullable<Resolution>  resolution,
        DateTimeZone                timeZone,
        *Boolean                    fillForward,
        *Decimal                    leverage
       )
            

    AddData a new user defined data source, requiring only the minimum config options. This adds a Symbol to the `Underlying` property in the custom data Symbol object. Use this method when adding custom data with a ticker from the past, such as "AOL" before it became "TWX", or if you need to filter using custom data and place trades on the Symbol associated with the custom data.

    AddData() 5/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        Type                        dataType,
        String                      ticker,
        Nullable<Resolution>  resolution,
        DateTimeZone                timeZone,
        *Boolean                    fillForward,
        *Decimal                    leverage
       )
            

    AddData a new user defined data source, requiring only the minimum config options. This method is meant for custom data types that require a ticker, but have no underlying Symbol. Examples of data sources that meet this criteria are U.S. Treasury Yield Curve Rates and Trading Economics data.

    AddData() 6/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        Type                         dataType,
        Symbol                       underlying,
        *Nullable<Resolution>  resolution,
        *DateTimeZone                timeZone,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    AddData a new user defined data source, requiring only the minimum config options. This adds a Symbol to the `Underlying` property in the custom data Symbol object. Use this method when adding custom data with a ticker from the past, such as "AOL" before it became "TWX", or if you need to filter using custom data and place trades on the Symbol associated with the custom data.

    AddData() 7/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        PyObject                     type,
        String                       ticker,
        SymbolProperties             properties,
        SecurityExchangeHours        exchangeHours,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    AddData a new user defined data source including symbol properties and exchange hours, all other vars are not required and will use defaults. This overload reflects the C# equivalent for custom properties and market hours.

    AddData() 8/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        String                       ticker,
        *Nullable<Resolution>  resolution
       )
            

    AddData() 9/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        Symbol                       underlying,
        *Nullable<Resolution>  resolution
       )
            

    AddData() 10/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        String                      ticker,
        Nullable<Resolution>  resolution,
        Boolean                     fillForward,
        *Decimal                    leverage
       )
            

    AddData() 11/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        Symbol                      underlying,
        Nullable<Resolution>  resolution,
        Boolean                     fillForward,
        *Decimal                    leverage
       )
            

    AddData() 12/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        String                      ticker,
        Nullable<Resolution>  resolution,
        DateTimeZone                timeZone,
        *Boolean                    fillForward,
        *Decimal                    leverage
       )
            

    AddData() 13/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        Symbol                      underlying,
        Nullable<Resolution>  resolution,
        DateTimeZone                timeZone,
        *Boolean                    fillForward,
        *Decimal                    leverage
       )
            

    AddData() 14/14

                Security QuantConnect.Algorithm.QCAlgorithm.AddData (
        String                       ticker,
        SymbolProperties             properties,
        SecurityExchangeHours        exchangeHours,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    AddEquity() 1/1

                Equity QuantConnect.Algorithm.QCAlgorithm.AddEquity (
        String                                  ticker,
        *Nullable<Resolution>             resolution,
        *String                                 market,
        *Boolean                                fillForward,
        *Decimal                                leverage,
        *Boolean                                extendedMarketHours,
        *Nullable<DataNormalizationMode>  dataNormalizationMode
       )
            

    Creates and adds a new Equity security to the algorithm.

    AddForex() 1/1

                Forex QuantConnect.Algorithm.QCAlgorithm.AddForex (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new Forex security to the algorithm.

    AddFuture() 1/1

                Future QuantConnect.Algorithm.QCAlgorithm.AddFuture (
        String                                  ticker,
        *Nullable<Resolution>             resolution,
        *String                                 market,
        *Boolean                                fillForward,
        *Decimal                                leverage,
        *Boolean                                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Int32                                  contractDepthOffset
       )
            

    Creates and adds a new Future security to the algorithm.

    AddFutureContract() 1/1

                Future QuantConnect.Algorithm.QCAlgorithm.AddFutureContract (
        Symbol                       symbol,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward,
        *Decimal                     leverage,
        *Boolean                     extendedMarketHours
       )
            

    Creates and adds a new single Future contract to the algorithm.

    AddFutureOption() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddFutureOption (
        Symbol    futureSymbol,
        PyObject  optionFilter
       )
            

    Creates and adds a new Future Option contract to the algorithm.

    AddFutureOption() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddFutureOption (
        Symbol                                                   symbol,
        *Func<OptionFilterUniverse, OptionFilterUniverse>  optionFilter
       )
            

    Creates and adds a new Future Option contract to the algorithm.

    AddFutureOptionContract() 1/1

                Option QuantConnect.Algorithm.QCAlgorithm.AddFutureOptionContract (
        Symbol                       symbol,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward,
        *Decimal                     leverage,
        *Boolean                     extendedMarketHours
       )
            

    Adds a future option contract to the algorithm.

    AddIndex() 1/1

                Index QuantConnect.Algorithm.QCAlgorithm.AddIndex (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward
       )
            

    Creates and adds a new Index security to the algorithm.

    AddIndexOption() 1/3

                Option QuantConnect.Algorithm.QCAlgorithm.AddIndexOption (
        String                       ticker,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward
       )
            

    Creates and adds index options to the algorithm.

    AddIndexOption() 2/3

                Option QuantConnect.Algorithm.QCAlgorithm.AddIndexOption (
        Symbol                       symbol,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward
       )
            

    Creates and adds index options to the algorithm.

    AddIndexOption() 3/3

                Option QuantConnect.Algorithm.QCAlgorithm.AddIndexOption (
        Symbol                       symbol,
        String                       targetOption,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward
       )
            

    Creates and adds index options to the algorithm.

    AddIndexOptionContract() 1/1

                Option QuantConnect.Algorithm.QCAlgorithm.AddIndexOptionContract (
        Symbol                       symbol,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward
       )
            

    Adds an index option contract to the algorithm.

    AddOption() 1/3

                Option QuantConnect.Algorithm.QCAlgorithm.AddOption (
        String                       underlying,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new equity Option security to the algorithm.

    AddOption() 2/3

                Option QuantConnect.Algorithm.QCAlgorithm.AddOption (
        Symbol                       underlying,
        *Nullable<Resolution>  resolution,
        *String                      market,
        *Boolean                     fillForward,
        *Decimal                     leverage
       )
            

    Creates and adds a new Option security to the algorithm. This method can be used to add options with non-equity asset classes to the algorithm (e.g. Future Options).

    <-- Missing documentation attribute for AddOption -->

    AddOptionContract() 1/1

                Option QuantConnect.Algorithm.QCAlgorithm.AddOptionContract (
        Symbol                       symbol,
        *Nullable<Resolution>  resolution,
        *Boolean                     fillForward,
        *Decimal                     leverage,
        *Boolean                     extendedMarketHours
       )
            

    Creates and adds a new single Option contract to the algorithm.

    AddRiskManagement() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddRiskManagement (
        IRiskManagementModel  riskManagement
       )
            

    Adds a new risk management model.

    AddRiskManagement() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddRiskManagement (
        PyObject  riskManagement
       )
            

    Adds a new risk management model.

    AddSecurity() 1/4

                Security QuantConnect.Algorithm.QCAlgorithm.AddSecurity (
        SecurityType                            securityType,
        String                                  ticker,
        *Nullable<Resolution>             resolution,
        *Boolean                                fillForward,
        *Boolean                                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode
       )
            

    Add specified data to our data subscriptions. QuantConnect will funnel this data to the handle data routine.

    AddSecurity() 2/4

                Security QuantConnect.Algorithm.QCAlgorithm.AddSecurity (
        SecurityType                            securityType,
        String                                  ticker,
        Nullable<Resolution>              resolution,
        Boolean                                 fillForward,
        Decimal                                 leverage,
        Boolean                                 extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode
       )
            

    Add specified data to required list. QC will funnel this data to the handle data routine.

    AddSecurity() 3/4

                Security QuantConnect.Algorithm.QCAlgorithm.AddSecurity (
        SecurityType                            securityType,
        String                                  ticker,
        Nullable<Resolution>              resolution,
        String                                  market,
        Boolean                                 fillForward,
        Decimal                                 leverage,
        Boolean                                 extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode
       )
            

    Set a required SecurityType-symbol and resolution for algorithm.

    AddSecurity() 4/4

                Security QuantConnect.Algorithm.QCAlgorithm.AddSecurity (
        Symbol                                  symbol,
        *Nullable<Resolution>             resolution,
        *Boolean                                fillForward,
        *Decimal                                leverage,
        *Boolean                                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Int32                                  contractDepthOffset
       )
            

    Set a required SecurityType-symbol and resolution for algorithm.

    AddSeries() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.AddSeries (
        String      chart,
        String      series,
        SeriesType  seriesType,
        *String     unit
       )
            

    Add a series object for charting. This is useful when initializing charts with series other than type = line. If a series exists in the chart with the same name, then it is replaced.

    AddUniverse() 1/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType                                                 securityType,
        String                                                       name,
        Resolution                                                   resolution,
        String                                                       market,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 2/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType                                                 securityType,
        String                                                       name,
        Resolution                                                   resolution,
        String                                                       market,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 3/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 4/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>>  coarseSelector,
        Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>>    fineSelector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 5/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        Universe                                                                   universe,
        Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>>  fineSelector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 6/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                           name,
        Func<DateTime, IEnumerable<String>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 7/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                           name,
        Resolution                                       resolution,
        Func<DateTime, IEnumerable<String>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 8/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType                                     securityType,
        String                                           name,
        Resolution                                       resolution,
        String                                           market,
        UniverseSettings                                 universeSettings,
        Func<DateTime, IEnumerable<String>>  selector
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 9/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        Universe  universe
       )
            

    Adds the universe to the algorithm.

    AddUniverse() 10/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 11/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 12/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 13/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 14/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Resolution                                                   resolution,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 15/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Resolution                                                   resolution,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 16/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Resolution                                                   resolution,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 17/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String                                                       name,
        Resolution                                                   resolution,
        UniverseSettings                                             universeSettings,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 18/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType                                                 securityType,
        String                                                       name,
        Resolution                                                   resolution,
        String                                                       market,
        Func<IEnumerable<T>, IEnumerable<Symbol>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 19/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType                                                 securityType,
        String                                                       name,
        Resolution                                                   resolution,
        String                                                       market,
        Func<IEnumerable<T>, IEnumerable<String>>  selector
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 20/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject  pyObject
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 21/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject  pyObject,
        PyObject  pyfine
       )
            

    Creates a new universe and adds it to the algorithm. This is for coarse and fine fundamental US Equity data and will be executed on day changes in the NewYork time zone ( NewYork .

    AddUniverse() 22/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String      name,
        Resolution  resolution,
        PyObject    pySelector
       )
            

    Creates a new universe and adds it to the algorithm. This can be used to return a list of string symbols retrieved from anywhere and will loads those symbols under the US Equity market.

    AddUniverse() 23/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        String    name,
        PyObject  pySelector
       )
            

    Creates a new universe and adds it to the algorithm. This can be used to return a list of string symbols retrieved from anywhere and will loads those symbols under the US Equity market.

    AddUniverse() 24/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        SecurityType      securityType,
        String            name,
        Resolution        resolution,
        String            market,
        UniverseSettings  universeSettings,
        PyObject          pySelector
       )
            

    Creates a new user defined universe that will fire on the requested resolution during market hours.

    AddUniverse() 25/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject  T,
        String    name,
        PyObject  selector
       )
            

    Creates a new universe and adds it to the algorithm. This will use the default universe settings specified via the UniverseSettings property. This universe will use the defaults of SecurityType.Equity, Resolution.Daily, Market.USA, and UniverseSettings.

    AddUniverse() 26/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject    T,
        String      name,
        Resolution  resolution,
        PyObject    selector
       )
            

    Creates a new universe and adds it to the algorithm. This will use the default universe settings specified via the UniverseSettings property. This universe will use the defaults of SecurityType.Equity, Market.USA and UniverseSettings.

    AddUniverse() 27/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject          T,
        String            name,
        Resolution        resolution,
        UniverseSettings  universeSettings,
        PyObject          selector
       )
            

    Creates a new universe and adds it to the algorithm. This will use the default universe settings specified via the UniverseSettings property. This universe will use the defaults of SecurityType.Equity, and Market.USA.

    AddUniverse() 28/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject          T,
        String            name,
        UniverseSettings  universeSettings,
        PyObject          selector
       )
            

    Creates a new universe and adds it to the algorithm. This will use the default universe settings specified via the UniverseSettings property. This universe will use the defaults of SecurityType.Equity, Resolution.Daily, and Market.USA.

    AddUniverse() 29/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject      T,
        SecurityType  securityType,
        String        name,
        Resolution    resolution,
        String        market,
        PyObject      selector
       )
            

    Creates a new universe and adds it to the algorithm. This will use the default universe settings specified via the UniverseSettings property.

    AddUniverse() 30/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        PyObject          T,
        SecurityType      securityType,
        String            name,
        Resolution        resolution,
        String            market,
        UniverseSettings  universeSettings,
        PyObject          selector
       )
            

    Creates a new universe and adds it to the algorithm.

    AddUniverse() 31/31

                Universe QuantConnect.Algorithm.QCAlgorithm.AddUniverse (
        Type              dataType,
        SecurityType      securityType,
        String            name,
        Resolution        resolution,
        String            market,
        UniverseSettings  universeSettings,
        PyObject          pySelector
       )
            

    Creates a new universe and adds it to the algorithm.

    AddUniverseOptions() 1/3

                Void QuantConnect.Algorithm.QCAlgorithm.AddUniverseOptions (
        Symbol                                                  underlyingSymbol,
        Func<OptionFilterUniverse, OptionFilterUniverse>  optionFilter
       )
            

    Adds a new universe that creates options of the security by monitoring any changes in the Universe the provided security is in. Additionally, a filter can be applied to the options generated when the universe of the security changes.

    AddUniverseOptions() 2/3

                Void QuantConnect.Algorithm.QCAlgorithm.AddUniverseOptions (
        Universe                                                universe,
        Func<OptionFilterUniverse, OptionFilterUniverse>  optionFilter
       )
            

    Creates a new universe selection model and adds it to the algorithm. This universe selection model will chain to the security changes of a given Universe selection output and create a new OptionChainUniverse for each of them.

    AddUniverseOptions() 3/3

                Void QuantConnect.Algorithm.QCAlgorithm.AddUniverseOptions (
        PyObject  universe,
        PyObject  optionFilter
       )
            

    Creates a new universe selection model and adds it to the algorithm. This universe selection model will chain to the security changes of a given Universe selection output and create a new OptionChainUniverse for each of them.

    AddUniverseSelection() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddUniverseSelection (
        IUniverseSelectionModel  universeSelection
       )
            

    Adds a new universe selection model.

    AddUniverseSelection() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.AddUniverseSelection (
        PyObject  universeSelection
       )
            

    Adds a new universe selection model.

    ADDIFF() 1/1

                AdvanceDeclineDifference QuantConnect.Algorithm.QCAlgorithm.ADDIFF (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    ADOSC() 1/1

                AccumulationDistributionOscillator QuantConnect.Algorithm.QCAlgorithm.ADOSC (
        Symbol                            symbol,
        Int32                             fastPeriod,
        Int32                             slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new AccumulationDistributionOscillator indicator.

    ADR() 1/1

                AdvanceDeclineRatio QuantConnect.Algorithm.QCAlgorithm.ADR (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    ADVR() 1/1

                AdvanceDeclineVolumeRatio QuantConnect.Algorithm.QCAlgorithm.ADVR (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    ADX() 1/1

                AverageDirectionalIndex QuantConnect.Algorithm.QCAlgorithm.ADX (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Average Directional Index indicator. The indicator will be automatically updated on the given resolution.

    ADXR() 1/1

                AverageDirectionalMovementIndexRating QuantConnect.Algorithm.QCAlgorithm.ADXR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AverageDirectionalMovementIndexRating indicator.

    ALMA() 1/1

                ArnaudLegouxMovingAverage QuantConnect.Algorithm.QCAlgorithm.ALMA (
        Symbol                           symbol,
        Int32                            period,
        *Int32                           sigma,
        *Decimal                         offset,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ArnaudLegouxMovingAverage indicator.

    AO() 1/1

                AwesomeOscillator QuantConnect.Algorithm.QCAlgorithm.AO (
        Symbol                                symbol,
        Int32                                 slowPeriod,
        Int32                                 fastPeriod,
        MovingAverageType                     type,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Awesome Oscillator from the specified periods.

    APO() 1/1

                AbsolutePriceOscillator QuantConnect.Algorithm.QCAlgorithm.APO (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        MovingAverageType                movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new AbsolutePriceOscillator indicator.

    APS() 1/1

                AugenPriceSpike QuantConnect.Algorithm.QCAlgorithm.APS (
        Symbol                           symbol,
        *Int32                           period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an AugenPriceSpike indicator for the symbol. The indicator will be automatically updated on the given resolution.

    ARIMA() 1/1

                AutoRegressiveIntegratedMovingAverage QuantConnect.Algorithm.QCAlgorithm.ARIMA (
        Symbol                           symbol,
        Int32                            arOrder,
        Int32                            diffOrder,
        Int32                            maOrder,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ARIMA indicator.

    AROON() 1/2

                AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).

    AROON() 2/2

                AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
        Symbol                                symbol,
        Int32                                 upPeriod,
        Int32                                 downPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta).

    ASI() 1/1

                WilderAccumulativeSwingIndex QuantConnect.Algorithm.QCAlgorithm.ASI (
        Symbol                            symbol,
        Decimal                           limitMove,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Wilder Accumulative Swing Index (ASI) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    ATR() 1/1

                AverageTrueRange QuantConnect.Algorithm.QCAlgorithm.ATR (
        Symbol                                symbol,
        Int32                                 period,
        *MovingAverageType                    type,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new AverageTrueRange indicator for the symbol. The indicator will be automatically updated on the given resolution.

    B() 1/1

                Beta QuantConnect.Algorithm.QCAlgorithm.B (
        Symbol                            target,
        Symbol                            reference,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Beta indicator for the given target symbol in relation with the reference used. The indicator will be automatically updated on the given resolution.

    BB() 1/1

                BollingerBands QuantConnect.Algorithm.QCAlgorithm.BB (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          k,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new BollingerBands indicator which will compute the MiddleBand, UpperBand, LowerBand, and StandardDeviation.

    BOP() 1/1

                BalanceOfPower QuantConnect.Algorithm.QCAlgorithm.BOP (
        Symbol                                symbol,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Balance Of Power indicator. The indicator will be automatically updated on the given resolution.

    Buy() 1/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Buy (
        Symbol   symbol,
        Decimal  quantity
       )
            

    Buy Stock (Alias of Order).

    Buy() 2/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Buy (
        Symbol  symbol,
        Single  quantity
       )
            

    Buy Stock (Alias of Order).

    Buy() 3/5

                IEnumerable<OrderTicket> QuantConnect.Algorithm.QCAlgorithm.Buy (
        OptionStrategy     strategy,
        Int32              quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Buy Option Strategy (Alias of Order).

    Buy() 4/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Buy (
        Symbol  symbol,
        Int32   quantity
       )
            

    Buy Stock (Alias of Order).

    Buy() 5/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Buy (
        Symbol  symbol,
        Double  quantity
       )
            

    Buy Stock (Alias of Order).

    CalculateOrderQuantity() 1/2

                Decimal QuantConnect.Algorithm.QCAlgorithm.CalculateOrderQuantity (
        Symbol  symbol,
        Double  target
       )
            

    Calculate the order quantity to achieve target-percent holdings.

    CalculateOrderQuantity() 2/2

                Decimal QuantConnect.Algorithm.QCAlgorithm.CalculateOrderQuantity (
        Symbol   symbol,
        Decimal  target
       )
            

    Calculate the order quantity to achieve target-percent holdings.

    CC() 1/1

                CoppockCurve QuantConnect.Algorithm.QCAlgorithm.CC (
        Symbol                           symbol,
        *Int32                           shortRocPeriod,
        *Int32                           longRocPeriod,
        *Int32                           lwmaPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Initializes a new instance of the CoppockCurve" indicator.

    CCI() 1/1

                CommodityChannelIndex QuantConnect.Algorithm.QCAlgorithm.CCI (
        Symbol                                symbol,
        Int32                                 period,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new CommodityChannelIndex indicator. The indicator will be automatically updated on the given resolution.

    CMF() 1/1

                ChaikinMoneyFlow QuantConnect.Algorithm.QCAlgorithm.CMF (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new ChaikinMoneyFlow indicator.

    CMO() 1/1

                ChandeMomentumOscillator QuantConnect.Algorithm.QCAlgorithm.CMO (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new ChandeMomentumOscillator indicator.

    <-- Missing documentation attribute for ComboLegLimitOrder -->
    <-- Missing documentation attribute for ComboLimitOrder -->
    <-- Missing documentation attribute for ComboMarketOrder -->

    CompositeFIGI() 1/2

                Symbol QuantConnect.Algorithm.QCAlgorithm.CompositeFIGI (
        String                     compositeFigi,
        *Nullable<DateTime>  tradingDate
       )
            

    Converts a composite FIGI identifier into a Symbol .

    CompositeFIGI() 2/2

                String QuantConnect.Algorithm.QCAlgorithm.CompositeFIGI (
        Symbol  symbol
       )
            

    Converts a Symbol into a composite FIGI identifier.

    Consolidate() 1/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol      symbol,
        Resolution  period,
        PyObject    handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 2/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                    symbol,
        Resolution                period,
        Nullable<TickType>  tickType,
        PyObject                  handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 3/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol    symbol,
        TimeSpan  period,
        PyObject  handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 4/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                    symbol,
        TimeSpan                  period,
        Nullable<TickType>  tickType,
        PyObject                  handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 5/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        PyObject                            handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 6/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        Nullable<TickType>            tickType,
        PyObject                            handler
       )
            

    Registers the handler to receive consolidated data for the specified symbol.

    Consolidate() 7/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                  symbol,
        Resolution              period,
        Action<TradeBar>  handler
       )
            

    Consolidate() 8/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                  symbol,
        TimeSpan                period,
        Action<TradeBar>  handler
       )
            

    Consolidate() 9/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                  symbol,
        Resolution              period,
        Action<QuoteBar>  handler
       )
            

    Consolidate() 10/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                  symbol,
        TimeSpan                period,
        Action<QuoteBar>  handler
       )
            

    Consolidate() 11/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol           symbol,
        TimeSpan         period,
        Action<T>  handler
       )
            

    Consolidate() 12/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                    symbol,
        Resolution                period,
        Nullable<TickType>  tickType,
        Action<T>           handler
       )
            

    Consolidate() 13/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                    symbol,
        TimeSpan                  period,
        Nullable<TickType>  tickType,
        Action<T>           handler
       )
            

    Consolidate() 14/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        Action<QuoteBar>              handler
       )
            

    Consolidate() 15/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        Action<TradeBar>              handler
       )
            

    Consolidate() 16/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        Action<T>                     handler
       )
            

    Consolidate() 17/17

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.Consolidate (
        Symbol                              symbol,
        Func<DateTime, CalendarInfo>  calendar,
        Nullable<TickType>            tickType,
        Action<T>                     handler
       )
            

    CreateConsolidator() 1/1

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.CreateConsolidator (
        TimeSpan                   period,
        Type                       consolidatorInputType,
        *Nullable<TickType>  tickType
       )
            

    Creates a new consolidator for the specified period, generating the requested output type.

    CUSIP() 1/2

                Symbol QuantConnect.Algorithm.QCAlgorithm.CUSIP (
        String                     cusip,
        *Nullable<DateTime>  tradingDate
       )
            

    Converts a CUSIP identifier into a Symbol .

    CUSIP() 2/2

                String QuantConnect.Algorithm.QCAlgorithm.CUSIP (
        Symbol  symbol
       )
            

    Converts a Symbol into a CUSIP identifier.

    DCH() 1/2

                DonchianChannel QuantConnect.Algorithm.QCAlgorithm.DCH (
        Symbol                                symbol,
        Int32                                 upperPeriod,
        Int32                                 lowerPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Donchian Channel indicator which will compute the Upper Band and Lower Band. The indicator will be automatically updated on the given resolution.

    DCH() 2/2

                DonchianChannel QuantConnect.Algorithm.QCAlgorithm.DCH (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Overload shorthand to create a new symmetric Donchian Channel indicator which has the upper and lower channels set to the same period length.

    Debug() 1/5

                Void QuantConnect.Algorithm.QCAlgorithm.Debug (
        PyObject  message
       )
            

    Send a debug message to the web console:.

    Debug() 2/5

                Void QuantConnect.Algorithm.QCAlgorithm.Debug (
        String  message
       )
            

    Send a debug message to the web console:.

    Debug() 3/5

                Void QuantConnect.Algorithm.QCAlgorithm.Debug (
        Int32  message
       )
            

    Send a debug message to the web console:.

    Debug() 4/5

                Void QuantConnect.Algorithm.QCAlgorithm.Debug (
        Double  message
       )
            

    Send a debug message to the web console:.

    Debug() 5/5

                Void QuantConnect.Algorithm.QCAlgorithm.Debug (
        Decimal  message
       )
            

    Send a debug message to the web console:.

    DEM() 1/1

                DeMarkerIndicator QuantConnect.Algorithm.QCAlgorithm.DEM (
        Symbol                            symbol,
        Int32                             period,
        MovingAverageType                 type,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new DeMarker Indicator (DEM), an oscillator-type indicator measuring changes in terms of an asset's High and Low tradebar values.

    DEMA() 1/1

                DoubleExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.DEMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new DoubleExponentialMovingAverage indicator.

    Download() 1/5

                String QuantConnect.Algorithm.QCAlgorithm.Download (
        String    address,
        PyObject  headers
       )
            

    Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.

    Download() 2/5

                String QuantConnect.Algorithm.QCAlgorithm.Download (
        String    address,
        PyObject  headers,
        String    userName,
        String    password
       )
            

    Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.

    Download() 3/5

                String QuantConnect.Algorithm.QCAlgorithm.Download (
        String  address
       )
            

    Downloads the requested resource as a String . The resource to download is specified as a String containing the URI.

    Download() 4/5

                String QuantConnect.Algorithm.QCAlgorithm.Download (
        String                                                 address,
        IEnumerable<KeyValuePair<String, String>>  headers
       )
            

    Download() 5/5

                String QuantConnect.Algorithm.QCAlgorithm.Download (
        String                                                 address,
        IEnumerable<KeyValuePair<String, String>>  headers,
        String                                                 userName,
        String                                                 password
       )
            

    DPO() 1/1

                DetrendedPriceOscillator QuantConnect.Algorithm.QCAlgorithm.DPO (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new DetrendedPriceOscillator" indicator.

    EMA() 1/2

                ExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.EMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    EMA() 2/2

                ExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.EMA (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          smoothingFactor,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an ExponentialMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    EmitInsights() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.EmitInsights (
        Insight>  insights
       )
            

    Manually emit insights from an algorithm. This is typically invoked before calls to submit orders in algorithms written against QCAlgorithm that have been ported into the algorithm framework.

    EmitInsights() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.EmitInsights (
        Insight  insight
       )
            

    Manually emit insights from an algorithm. This is typically invoked before calls to submit orders in algorithms written against QCAlgorithm that have been ported into the algorithm framework.

    EMV() 1/1

                EaseOfMovementValue QuantConnect.Algorithm.QCAlgorithm.EMV (
        Symbol                            symbol,
        *Int32                            period,
        *Int32                            scale,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an EaseOfMovementValue indicator for the symbol. The indicator will be automatically updated on the given resolution.

    Error() 1/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        PyObject  message
       )
            

    Send a string error message to the Console.

    Error() 2/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        String  message
       )
            

    Send a string error message to the Console.

    Error() 3/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        Int32  message
       )
            

    Send a int error message to the Console.

    Error() 4/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        Double  message
       )
            

    Send a double error message to the Console.

    Error() 5/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        Decimal  message
       )
            

    Send a decimal error message to the Console.

    Error() 6/6

                Void QuantConnect.Algorithm.QCAlgorithm.Error (
        Exception  error
       )
            

    Send a string error message to the Console.

    ExerciseOption() 1/1

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.ExerciseOption (
        Symbol             optionSymbol,
        Int32              quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send an exercise order to the transaction handler.

    FilteredIdentity() 1/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol     symbol,
        *PyObject  selector,
        *PyObject  filter,
        *String    fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FilteredIdentity() 2/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol      symbol,
        Resolution  resolution,
        *PyObject   selector,
        *PyObject   filter,
        *String     fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FilteredIdentity() 3/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol     symbol,
        TimeSpan   resolution,
        *PyObject  selector,
        *PyObject  filter,
        *String    fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FilteredIdentity() 4/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol                                symbol,
        *Func<IBaseData, IBaseDataBar>  selector,
        *Func<IBaseData, Boolean>       filter,
        *String                               fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FilteredIdentity() 5/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol                                symbol,
        Resolution                            resolution,
        *Func<IBaseData, IBaseDataBar>  selector,
        *Func<IBaseData, Boolean>       filter,
        *String                               fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FilteredIdentity() 6/6

                FilteredIdentity QuantConnect.Algorithm.QCAlgorithm.FilteredIdentity (
        Symbol                                symbol,
        TimeSpan                              resolution,
        *Func<IBaseData, IBaseDataBar>  selector,
        *Func<IBaseData, Boolean>       filter,
        *String                               fieldName
       )
            

    Creates a new FilteredIdentity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    FISH() 1/1

                FisherTransform QuantConnect.Algorithm.QCAlgorithm.FISH (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an FisherTransform indicator for the symbol. The indicator will be automatically updated on the given resolution.

    FRAMA() 1/1

                FractalAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.FRAMA (
        Symbol                                symbol,
        Int32                                 period,
        *Int32                                longPeriod,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates an FractalAdaptiveMovingAverage (FRAMA) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    FrameworkPostInitialize() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.FrameworkPostInitialize (
        
       )
            

    Called by setup handlers after Initialize and allows the algorithm a chance to organize the data gather in the Initialize method.

    GetLastKnownPrices() 1/2

                IEnumerable<BaseData> QuantConnect.Algorithm.QCAlgorithm.GetLastKnownPrices (
        Security  security
       )
            

    Yields data to warmup a security for all it's subscribed data types.

    GetLastKnownPrices() 2/2

                IEnumerable<BaseData> QuantConnect.Algorithm.QCAlgorithm.GetLastKnownPrices (
        Symbol  symbol
       )
            

    Yields data to warmup a security for all it's subscribed data types.

    GetParameters() 1/1

                IReadOnlyDictionary<String, String> QuantConnect.Algorithm.QCAlgorithm.GetParameters (
        
       )
            

    Gets a read-only dictionary with all current parameters.

    HeikinAshi() 1/1

                HeikinAshi QuantConnect.Algorithm.QCAlgorithm.HeikinAshi (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Heikin-Ashi indicator.

    History() 1/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                tickers,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol. The exact number of bars will be returned. The symbol must exist in the Securities collection.

    History() 2/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                tickers,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols over the requested span. The symbols must exist in the Securities collection.

    History() 3/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                tickers,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols between the specified dates. The symbols must exist in the Securities collection.

    History() 4/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                     tickers,
        DateTime                     start,
        DateTime                     end,
        *Nullable<Resolution>  resolution
       )
            

    Gets the historical data for the specified symbol between the specified dates. The symbol must exist in the Securities collection.

    History() 5/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        PyObject                                tickers,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols between the specified dates. The symbols must exist in the Securities collection.

    History() 6/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        PyObject                                tickers,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols. The exact number of bars will be returned for each symbol. This may result in some data start earlier/later than others due to when various exchanges are open. The symbols must exist in the Securities collection.

    History() 7/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        PyObject                                tickers,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols over the requested span. The symbols must exist in the Securities collection.

    History() 8/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        Symbol                                  symbol,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols between the specified dates. The symbols must exist in the Securities collection.

    History() 9/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        Symbol                                  symbol,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols. The exact number of bars will be returned for each symbol. This may result in some data start earlier/later than others due to when various exchanges are open. The symbols must exist in the Securities collection.

    History() 10/27

                PyObject QuantConnect.Algorithm.QCAlgorithm.History (
        PyObject                                type,
        Symbol                                  symbol,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbols over the requested span. The symbols must exist in the Securities collection.

    History() 11/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Get the history for all configured securities over the requested span. This will use the resolution and other subscription settings for each security. The symbols must exist in the Securities collection.

    History() 12/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Get the history for all configured securities over the requested span. This will use the resolution and other subscription settings for each security. The symbols must exist in the Securities collection.

    History() 13/27

                IEnumerable<DataDictionary<T>> QuantConnect.Algorithm.QCAlgorithm.History (
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Get the history for all configured securities over the requested span. This will use the resolution and other subscription settings for each security. The symbols must exist in the Securities collection.

    History() 14/27

                IEnumerable<DataDictionary<T>> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 15/27

                IEnumerable<DataDictionary<T>> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 16/27

                IEnumerable<DataDictionary<T>> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 17/27

                IEnumerable<T> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 18/27

                IEnumerable<TradeBar> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol. The exact number of bars will be returned. The symbol must exist in the Securities collection.

    History() 19/27

                IEnumerable<T> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol. The exact number of bars will be returned. The symbol must exist in the Securities collection.

    History() 20/27

                IEnumerable<T> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 21/27

                IEnumerable<TradeBar> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 22/27

                IEnumerable<TradeBar> QuantConnect.Algorithm.QCAlgorithm.History (
        Symbol                                  symbol,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Gets the historical data for the specified symbol over the request span. The symbol must exist in the Securities collection.

    History() 23/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        TimeSpan                                span,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Executes the specified history request.

    History() 24/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        Int32                                   periods,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Executes the specified history request.

    History() 25/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<Symbol>               symbols,
        DateTime                                start,
        DateTime                                end,
        *Nullable<Resolution>             resolution,
        *Nullable<Boolean>                fillForward,
        *Nullable<Boolean>                extendedMarketHours,
        *Nullable<DataMappingMode>        dataMappingMode,
        *Nullable<DataNormalizationMode>  dataNormalizationMode,
        *Nullable<Int32>                  contractDepthOffset
       )
            

    Executes the specified history request.

    History() 26/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        HistoryRequest  request
       )
            

    Executes the specified history request.

    History() 27/27

                IEnumerable<Slice> QuantConnect.Algorithm.QCAlgorithm.History (
        IEnumerable<HistoryRequest>  requests
       )
            

    HMA() 1/1

                HullMovingAverage QuantConnect.Algorithm.QCAlgorithm.HMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new HullMovingAverage indicator. The Hull moving average is a series of nested weighted moving averages, is fast and smooth.

    HT() 1/1

                HilbertTransform QuantConnect.Algorithm.QCAlgorithm.HT (
        Symbol                           symbol,
        Int32                            length,
        Decimal                          inPhaseMultiplicationFactor,
        Decimal                          quadratureMultiplicationFactor,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Hilbert Transform indicator.

    ICHIMOKU() 1/1

                IchimokuKinkoHyo QuantConnect.Algorithm.QCAlgorithm.ICHIMOKU (
        Symbol                            symbol,
        Int32                             tenkanPeriod,
        Int32                             kijunPeriod,
        Int32                             senkouAPeriod,
        Int32                             senkouBPeriod,
        Int32                             senkouADelayPeriod,
        Int32                             senkouBDelayPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new IchimokuKinkoHyo indicator for the symbol. The indicator will be automatically updated on the given resolution.

    Identity() 1/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    Identity() 2/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        Resolution                       resolution,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    Identity() 3/3

                Identity QuantConnect.Algorithm.QCAlgorithm.Identity (
        Symbol                           symbol,
        TimeSpan                         resolution,
        *Func<IBaseData, Decimal>  selector,
        *String                          fieldName
       )
            

    Creates a new Identity indicator for the symbol The indicator will be automatically updated on the symbol's subscription resolution.

    Initialize() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.Initialize (
        
       )
            

    Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.

    IsMarketOpen() 1/1

                Boolean QuantConnect.Algorithm.QCAlgorithm.IsMarketOpen (
        Symbol  symbol
       )
            

    Determines if the exchange for the specified symbol is open at the current time.

    ISIN() 1/2

                Symbol QuantConnect.Algorithm.QCAlgorithm.ISIN (
        String                     isin,
        *Nullable<DateTime>  tradingDate
       )
            

    Converts an ISIN identifier into a Symbol .

    ISIN() 2/2

                String QuantConnect.Algorithm.QCAlgorithm.ISIN (
        Symbol  symbol
       )
            

    Converts a Symbol into an ISIN identifier.

    KAMA() 1/2

                KaufmanAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.KAMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new KaufmanAdaptiveMovingAverage indicator.

    KAMA() 2/2

                KaufmanAdaptiveMovingAverage QuantConnect.Algorithm.QCAlgorithm.KAMA (
        Symbol                           symbol,
        Int32                            period,
        Int32                            fastEmaPeriod,
        Int32                            slowEmaPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new KaufmanAdaptiveMovingAverage indicator.

    KCH() 1/1

                KeltnerChannels QuantConnect.Algorithm.QCAlgorithm.KCH (
        Symbol                                symbol,
        Int32                                 period,
        Decimal                               k,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Keltner Channels indicator. The indicator will be automatically updated on the given resolution.

    KER() 1/1

                KaufmanEfficiencyRatio QuantConnect.Algorithm.QCAlgorithm.KER (
        Symbol                           symbol,
        *Int32                           period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an KaufmanEfficiencyRatio indicator for the symbol. The indicator will be automatically updated on the given resolution.

    LimitIfTouchedOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitIfTouchedOrder (
        Symbol             symbol,
        Int32              quantity,
        Decimal            triggerPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit if touched order to the transaction handler:.

    LimitIfTouchedOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitIfTouchedOrder (
        Symbol             symbol,
        Double             quantity,
        Decimal            triggerPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit if touched order to the transaction handler:.

    LimitIfTouchedOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitIfTouchedOrder (
        Symbol             symbol,
        Decimal            quantity,
        Decimal            triggerPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit if touched order to the transaction handler:.

    LimitOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitOrder (
        Symbol             symbol,
        Int32              quantity,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit order to the transaction handler:.

    LimitOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitOrder (
        Symbol             symbol,
        Double             quantity,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit order to the transaction handler:.

    LimitOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.LimitOrder (
        Symbol             symbol,
        Decimal            quantity,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a limit order to the transaction handler:.

    Liquidate() 1/1

                List<Int32> QuantConnect.Algorithm.QCAlgorithm.Liquidate (
        *Symbol  symbolToLiquidate,
        *String  tag
       )
            

    Liquidate all holdings and cancel open orders. Called at the end of day for tick-strategies.

    Log() 1/5

                Void QuantConnect.Algorithm.QCAlgorithm.Log (
        PyObject  message
       )
            

    Added another method for logging if user guessed.

    Log() 2/5

                Void QuantConnect.Algorithm.QCAlgorithm.Log (
        String  message
       )
            

    Added another method for logging if user guessed.

    Log() 3/5

                Void QuantConnect.Algorithm.QCAlgorithm.Log (
        Int32  message
       )
            

    Added another method for logging if user guessed.

    Log() 4/5

                Void QuantConnect.Algorithm.QCAlgorithm.Log (
        Double  message
       )
            

    Added another method for logging if user guessed.

    Log() 5/5

                Void QuantConnect.Algorithm.QCAlgorithm.Log (
        Decimal  message
       )
            

    Added another method for logging if user guessed.

    LOGR() 1/1

                LogReturn QuantConnect.Algorithm.QCAlgorithm.LOGR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new LogReturn indicator.

    LSMA() 1/1

                LeastSquaresMovingAverage QuantConnect.Algorithm.QCAlgorithm.LSMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates and registers a new Least Squares Moving Average instance.

    LWMA() 1/1

                LinearWeightedMovingAverage QuantConnect.Algorithm.QCAlgorithm.LWMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new LinearWeightedMovingAverage indicator. This indicator will linearly distribute the weights across the periods.

    MACD() 1/1

                MovingAverageConvergenceDivergence QuantConnect.Algorithm.QCAlgorithm.MACD (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        Int32                            signalPeriod,
        *MovingAverageType               type,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a MACD indicator for the symbol. The indicator will be automatically updated on the given resolution.

    MAD() 1/1

                MeanAbsoluteDeviation QuantConnect.Algorithm.QCAlgorithm.MAD (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MeanAbsoluteDeviation indicator.

    MarketOnCloseOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnCloseOrder (
        Symbol             symbol,
        Int32              quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on close order implementation: Send a market order when the exchange closes.

    MarketOnCloseOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnCloseOrder (
        Symbol             symbol,
        Double             quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on close order implementation: Send a market order when the exchange closes.

    MarketOnCloseOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnCloseOrder (
        Symbol             symbol,
        Decimal            quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on close order implementation: Send a market order when the exchange closes.

    MarketOnOpenOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnOpenOrder (
        Symbol             symbol,
        Double             quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on open order implementation: Send a market order when the exchange opens.

    MarketOnOpenOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnOpenOrder (
        Symbol             symbol,
        Int32              quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on open order implementation: Send a market order when the exchange opens.

    MarketOnOpenOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOnOpenOrder (
        Symbol             symbol,
        Decimal            quantity,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market on open order implementation: Send a market order when the exchange opens.

    MarketOrder() 1/4

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOrder (
        Symbol             symbol,
        Int32              quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market order implementation: Send a market order and wait for it to be filled.

    MarketOrder() 2/4

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOrder (
        Symbol             symbol,
        Double             quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market order implementation: Send a market order and wait for it to be filled.

    MarketOrder() 3/4

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOrder (
        Symbol             symbol,
        Decimal            quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market order implementation: Send a market order and wait for it to be filled.

    MarketOrder() 4/4

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.MarketOrder (
        Security           security,
        Decimal            quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Market order implementation: Send a market order and wait for it to be filled.

    MASS() 1/1

                MassIndex QuantConnect.Algorithm.QCAlgorithm.MASS (
        Symbol                            symbol,
        *Int32                            emaPeriod,
        *Int32                            sumPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Mass Index indicator. The indicator will be automatically updated on the given resolution.

    MAX() 1/1

                Maximum QuantConnect.Algorithm.QCAlgorithm.MAX (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Maximum indicator to compute the maximum value.

    MFI() 1/1

                MoneyFlowIndex QuantConnect.Algorithm.QCAlgorithm.MFI (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new MoneyFlowIndex indicator. The indicator will be automatically updated on the given resolution.

    MIDPOINT() 1/1

                MidPoint QuantConnect.Algorithm.QCAlgorithm.MIDPOINT (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MidPoint indicator.

    MIDPRICE() 1/1

                MidPrice QuantConnect.Algorithm.QCAlgorithm.MIDPRICE (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new MidPrice indicator.

    MIN() 1/1

                Minimum QuantConnect.Algorithm.QCAlgorithm.MIN (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Minimum indicator to compute the minimum value.

    MOM() 1/1

                Momentum QuantConnect.Algorithm.QCAlgorithm.MOM (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Momentum indicator. This will compute the absolute n-period change in the security. The indicator will be automatically updated on the given resolution.

    MOMERSION() 1/1

                MomersionIndicator QuantConnect.Algorithm.QCAlgorithm.MOMERSION (
        Symbol                           symbol,
        Nullable<Int32>            minPeriod,
        Int32                            fullPeriod,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Momersion indicator.

    MOMP() 1/1

                MomentumPercent QuantConnect.Algorithm.QCAlgorithm.MOMP (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new MomentumPercent indicator. This will compute the n-period percent change in the security. The indicator will be automatically updated on the given resolution.

    MOSC() 1/2

                McClellanOscillator QuantConnect.Algorithm.QCAlgorithm.MOSC (
        IEnumerable<Symbol>         symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Oscillator indicator.

    MOSC() 2/2

                McClellanOscillator QuantConnect.Algorithm.QCAlgorithm.MOSC (
        Symbol>                        symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Oscillator indicator.

    MSI() 1/2

                McClellanSummationIndex QuantConnect.Algorithm.QCAlgorithm.MSI (
        IEnumerable<Symbol>         symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Summation Index indicator.

    MSI() 2/2

                McClellanSummationIndex QuantConnect.Algorithm.QCAlgorithm.MSI (
        Symbol>                        symbols,
        *Int32                            fastPeriod,
        *Int32                            slowPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new McClellan Summation Index indicator.

    NATR() 1/1

                NormalizedAverageTrueRange QuantConnect.Algorithm.QCAlgorithm.NATR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new NormalizedAverageTrueRange indicator.

    OBV() 1/1

                OnBalanceVolume QuantConnect.Algorithm.QCAlgorithm.OBV (
        Symbol                            symbol,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new On Balance Volume indicator. This will compute the cumulative total volume based on whether the close price being higher or lower than the previous period. The indicator will be automatically updated on the given resolution.

    OnAssignmentOrderEvent() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnAssignmentOrderEvent (
        OrderEvent  assignmentEvent
       )
            

    Option assignment event handler. On an option assignment event for short legs the resulting information is passed to this method.

    OnData() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnData (
        Slice  slice
       )
            

    Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event.

    OnEndOfAlgorithm() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnEndOfAlgorithm (
        
       )
            

    End of algorithm run event handler. This method is called at the end of a backtest or live trading operation. Intended for closing out logs.

    OnEndOfDay() 1/3

                Void QuantConnect.Algorithm.QCAlgorithm.OnEndOfDay (
        
       )
            

    End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).

    OnEndOfDay() 2/3

                Void QuantConnect.Algorithm.QCAlgorithm.OnEndOfDay (
        String  symbol
       )
            

    End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).

    OnEndOfDay() 3/3

                Void QuantConnect.Algorithm.QCAlgorithm.OnEndOfDay (
        Symbol  symbol
       )
            

    End of a trading day event handler. This method is called at the end of the algorithm day (or multiple times if trading multiple assets).

    OnEndOfTimeStep() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnEndOfTimeStep (
        
       )
            

    Invoked at the end of every time step. This allows the algorithm to process events before advancing to the next time step.

    OnFrameworkData() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnFrameworkData (
        Slice  slice
       )
            

    Used to send data updates to algorithm framework models.

    OnFrameworkSecuritiesChanged() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnFrameworkSecuritiesChanged (
        SecurityChanges  changes
       )
            

    Used to send security changes to algorithm framework models.

    OnMarginCall() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnMarginCall (
        List<SubmitOrderRequest>  requests
       )
            

    Margin call event handler. This method is called right before the margin call orders are placed in the market.

    OnMarginCallWarning() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnMarginCallWarning (
        
       )
            

    Margin call warning event handler. This method is called when Portfolio.MarginRemaining is under 5% of your Portfolio.TotalPortfolioValue.

    OnOrderEvent() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnOrderEvent (
        OrderEvent  orderEvent
       )
            

    Order fill event handler. On an order fill update the resulting information is passed to this method.

    OnWarmupFinished() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.OnWarmupFinished (
        
       )
            

    Called when the algorithm has completed initialization and warm up.

    Order() 1/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol  symbol,
        Double  quantity
       )
            

    Issue an order/trade for asset: Alias wrapper for Order(string, int);.

    Order() 2/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol  symbol,
        Int32   quantity
       )
            

    Issue an order/trade for asset.

    Order() 3/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol   symbol,
        Decimal  quantity
       )
            

    Issue an order/trade for asset.

    Order() 4/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol             symbol,
        Decimal            quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Wrapper for market order method: submit a new order for quantity of symbol using type order.

    Order() 5/8

                IEnumerable<OrderTicket> QuantConnect.Algorithm.QCAlgorithm.Order (
        OptionStrategy     strategy,
        Int32              quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Issue an order/trade for buying/selling an option strategy.

    Order() 6/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol             symbol,
        Int32              quantity,
        OrderType          type,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Obsolete implementation of Order method accepting a OrderType. This was deprecated since it was impossible to generate other orders via this method. Any calls to this method will always default to a Market Order.

    Order() 7/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol     symbol,
        Decimal    quantity,
        OrderType  type
       )
            

    Obsolete method for placing orders.

    Order() 8/8

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Order (
        Symbol     symbol,
        Int32      quantity,
        OrderType  type
       )
            

    Obsolete method for placing orders.

    Plot() 1/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  chart,
        String  series,
        Int32   value
       )
            

    Plot a chart to string chart name, using string series name, with int value.

    Plot() 2/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  chart,
        String  series,
        Single  value
       )
            

    Plot a chart to string chart name, using string series name, with float value.

    Plot() 3/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String   chart,
        String   series,
        Decimal  value
       )
            

    Plot a value to a chart of string-chart name, with string series name, and decimal value. If chart does not exist, create it.

    Plot() 4/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String             chart,
        IndicatorBase>  indicators
       )
            

    Plots the value of each indicator on the chart.

    Plot() 5/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String    series,
        PyObject  pyObject
       )
            

    Plot a chart using string series name, with value.

    Plot() 6/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String      chart,
        Indicator   first,
        *Indicator  second,
        *Indicator  third,
        *Indicator  fourth
       )
            

    Plots the value of each indicator on the chart.

    Plot() 7/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String         chart,
        BarIndicator   first,
        *BarIndicator  second,
        *BarIndicator  third,
        *BarIndicator  fourth
       )
            

    Plots the value of each indicator on the chart.

    Plot() 8/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String              chart,
        TradeBarIndicator   first,
        *TradeBarIndicator  second,
        *TradeBarIndicator  third,
        *TradeBarIndicator  fourth
       )
            

    Plots the value of each indicator on the chart.

    Plot() 9/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String   series,
        Decimal  value
       )
            

    Plot a chart using string series name, with value.

    Plot() 10/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  series,
        Double  value
       )
            

    Plot a chart using string series name, with double value.

    Plot() 11/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  series,
        Int32   value
       )
            

    Plot a chart using string series name, with int value.

    Plot() 12/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  series,
        Single  value
       )
            

    Plot a chart using string series name, with float value.

    Plot() 13/13

                Void QuantConnect.Algorithm.QCAlgorithm.Plot (
        String  chart,
        String  series,
        Double  value
       )
            

    Plot a chart to string chart name, using string series name, with double value.

    PlotIndicator() 1/4

                Void QuantConnect.Algorithm.QCAlgorithm.PlotIndicator (
        String             chart,
        IndicatorBase>  indicators
       )
            

    Automatically plots each indicator when a new value is available.

    PlotIndicator() 2/4

                Void QuantConnect.Algorithm.QCAlgorithm.PlotIndicator (
        String             chart,
        Boolean            waitForReady,
        IndicatorBase>  indicators
       )
            

    Automatically plots each indicator when a new value is available, optionally waiting for indicator.IsReady to return True.

    PlotIndicator() 3/4

                Void QuantConnect.Algorithm.QCAlgorithm.PlotIndicator (
        String     chart,
        PyObject   first,
        *PyObject  second,
        *PyObject  third,
        *PyObject  fourth
       )
            

    Automatically plots each indicator when a new value is available.

    PlotIndicator() 4/4

                Void QuantConnect.Algorithm.QCAlgorithm.PlotIndicator (
        String     chart,
        Boolean    waitForReady,
        PyObject   first,
        *PyObject  second,
        *PyObject  third,
        *PyObject  fourth
       )
            

    Automatically plots each indicator when a new value is available.

    PPHL() 1/1

                PivotPointsHighLow QuantConnect.Algorithm.QCAlgorithm.PPHL (
        Symbol                                symbol,
        Int32                                 lengthHigh,
        Int32                                 lengthLow,
        *Int32                                lastStoredValues,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new PivotPointsHighLow indicator.

    PPO() 1/1

                PercentagePriceOscillator QuantConnect.Algorithm.QCAlgorithm.PPO (
        Symbol                           symbol,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        MovingAverageType                movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new PercentagePriceOscillator indicator.

    PSAR() 1/1

                ParabolicStopAndReverse QuantConnect.Algorithm.QCAlgorithm.PSAR (
        Symbol                                symbol,
        *Decimal                              afStart,
        *Decimal                              afIncrement,
        *Decimal                              afMax,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Parabolic SAR indicator.

    Quit() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.Quit (
        PyObject  message
       )
            

    Terminate the algorithm after processing the current event handler.

    Quit() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.Quit (
        *String  message
       )
            

    Terminate the algorithm after processing the current event handler.

    RC() 1/1

                RegressionChannel QuantConnect.Algorithm.QCAlgorithm.RC (
        Symbol                           symbol,
        Int32                            period,
        Decimal                          k,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RegressionChannel indicator which will compute the LinearRegression, UpperChannel and LowerChannel lines, the intercept and slope.

    RDV() 1/1

                RelativeDailyVolume QuantConnect.Algorithm.QCAlgorithm.RDV (
        Symbol                            symbol,
        *Int32                            period,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an RelativeDailyVolume indicator for the symbol. The indicator will be automatically updated on the given resolution.

    Record() 1/3

                Void QuantConnect.Algorithm.QCAlgorithm.Record (
        String  series,
        Int32   value
       )
            

    Plot a chart using string series name, with int value. Alias of Plot();.

    Record() 2/3

                Void QuantConnect.Algorithm.QCAlgorithm.Record (
        String  series,
        Double  value
       )
            

    Plot a chart using string series name, with double value. Alias of Plot();.

    Record() 3/3

                Void QuantConnect.Algorithm.QCAlgorithm.Record (
        String   series,
        Decimal  value
       )
            

    Plot a chart using string series name, with decimal value. Alias of Plot();.

    RegisterIndicator() 1/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                       symbol,
        PyObject                     indicator,
        *Nullable<Resolution>  resolution,
        *PyObject                    selector
       )
            

    Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.

    RegisterIndicator() 2/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                     symbol,
        PyObject                   indicator,
        *Nullable<TimeSpan>  resolution,
        *PyObject                  selector
       )
            

    Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.

    RegisterIndicator() 3/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol     symbol,
        PyObject   indicator,
        PyObject   pyObject,
        *PyObject  selector
       )
            

    Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.

    RegisterIndicator() 4/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol             symbol,
        PyObject           indicator,
        IDataConsolidator  consolidator,
        *PyObject          selector
       )
            

    Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates from the consolidator.

    RegisterIndicator() 5/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                                   symbol,
        IndicatorBase<IndicatorDataPoint>  indicator,
        *Nullable<Resolution>              resolution,
        *Func<IBaseData, Decimal>          selector
       )
            

    RegisterIndicator() 6/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                                   symbol,
        IndicatorBase<IndicatorDataPoint>  indicator,
        *Nullable<TimeSpan>                resolution,
        *Func<IBaseData, Decimal>          selector
       )
            

    RegisterIndicator() 7/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                                   symbol,
        IndicatorBase<IndicatorDataPoint>  indicator,
        IDataConsolidator                        consolidator,
        *Func<IBaseData, Decimal>          selector
       )
            

    RegisterIndicator() 8/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                       symbol,
        IndicatorBase<T>       indicator,
        *Nullable<Resolution>  resolution
       )
            

    RegisterIndicator() 9/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                      symbol,
        IndicatorBase<T>      indicator,
        Nullable<Resolution>  resolution,
        Func<IBaseData, T>    selector
       )
            

    RegisterIndicator() 10/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                     symbol,
        IndicatorBase<T>     indicator,
        Nullable<TimeSpan>   resolution,
        *Func<IBaseData, T>  selector
       )
            

    RegisterIndicator() 11/11

                Void QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator (
        Symbol                     symbol,
        IndicatorBase<T>     indicator,
        IDataConsolidator          consolidator,
        *Func<IBaseData, T>  selector
       )
            

    RemoveOptionContract() 1/1

                Boolean QuantConnect.Algorithm.QCAlgorithm.RemoveOptionContract (
        Symbol  symbol
       )
            

    Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.

    RemoveSecurity() 1/1

                Boolean QuantConnect.Algorithm.QCAlgorithm.RemoveSecurity (
        Symbol  symbol
       )
            

    Removes the security with the specified symbol. This will cancel all open orders and then liquidate any existing holdings.

    ResolveConsolidator() 1/2

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.ResolveConsolidator (
        Symbol                      symbol,
        Nullable<Resolution>  resolution,
        *Type                       dataType
       )
            

    Gets the default consolidator for the specified symbol and resolution.

    ResolveConsolidator() 2/2

                IDataConsolidator QuantConnect.Algorithm.QCAlgorithm.ResolveConsolidator (
        Symbol                    symbol,
        Nullable<TimeSpan>  timeSpan,
        *Type                     dataType
       )
            

    Gets the default consolidator for the specified symbol and resolution.

    RMA() 1/1

                RelativeMovingAverage QuantConnect.Algorithm.QCAlgorithm.RMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Relative Moving Average indicator for the symbol. The indicator will be automatically updated on the given resolution.

    ROC() 1/1

                RateOfChange QuantConnect.Algorithm.QCAlgorithm.ROC (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChange indicator. This will compute the n-period rate of change in the security. The indicator will be automatically updated on the given resolution.

    ROCP() 1/1

                RateOfChangePercent QuantConnect.Algorithm.QCAlgorithm.ROCP (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChangePercent indicator. This will compute the n-period percentage rate of change in the security. The indicator will be automatically updated on the given resolution.

    ROCR() 1/1

                RateOfChangeRatio QuantConnect.Algorithm.QCAlgorithm.ROCR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RateOfChangeRatio indicator.

    RSI() 1/1

                RelativeStrengthIndex QuantConnect.Algorithm.QCAlgorithm.RSI (
        Symbol                           symbol,
        Int32                            period,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RelativeStrengthIndex indicator. This will produce an oscillator that ranges from 0 to 100 based on the ratio of average gains to average losses over the specified period.

    RVI() 1/1

                RelativeVigorIndex QuantConnect.Algorithm.QCAlgorithm.RVI (
        Symbol                            symbol,
        Int32                             period,
        *MovingAverageType                movingAverageType,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new RelativeVigorIndex indicator.

    SEDOL() 1/2

                Symbol QuantConnect.Algorithm.QCAlgorithm.SEDOL (
        String                     sedol,
        *Nullable<DateTime>  tradingDate
       )
            

    Converts a SEDOL identifier into a Symbol .

    SEDOL() 2/2

                String QuantConnect.Algorithm.QCAlgorithm.SEDOL (
        Symbol  symbol
       )
            

    Converts a Symbol into a SEDOL identifier.

    Sell() 1/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Sell (
        Symbol  symbol,
        Int32   quantity
       )
            

    Sell stock (alias of Order).

    Sell() 2/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Sell (
        Symbol  symbol,
        Double  quantity
       )
            

    Sell stock (alias of Order).

    Sell() 3/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Sell (
        Symbol  symbol,
        Single  quantity
       )
            

    Sell stock (alias of Order).

    Sell() 4/5

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.Sell (
        Symbol   symbol,
        Decimal  quantity
       )
            

    Sell stock (alias of Order).

    Sell() 5/5

                IEnumerable<OrderTicket> QuantConnect.Algorithm.QCAlgorithm.Sell (
        OptionStrategy     strategy,
        Int32              quantity,
        *Boolean           asynchronous,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Sell Option Strategy (alias of Order).

    SetAccountCurrency() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetAccountCurrency (
        String  accountCurrency
       )
            

    Sets the account currency cash symbol this algorithm is to manage.

    SetAlpha() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetAlpha (
        IAlphaModel  alpha
       )
            

    Sets the alpha model.

    SetAlpha() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetAlpha (
        PyObject  alpha
       )
            

    Sets the alpha model.

    SetApi() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetApi (
        IApi  api
       )
            

    Provide the API for the algorithm.

    SetBenchmark() 1/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetBenchmark (
        PyObject  benchmark
       )
            

    Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.

    SetBenchmark() 2/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetBenchmark (
        SecurityType  securityType,
        String        symbol
       )
            

    Sets the benchmark used for computing statistics of the algorithm to the specified symbol.

    SetBenchmark() 3/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetBenchmark (
        String  ticker
       )
            

    Sets the benchmark used for computing statistics of the algorithm to the specified ticker, defaulting to SecurityType.Equity if the ticker doesn't exist in the algorithm.

    SetBenchmark() 4/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetBenchmark (
        Symbol  symbol
       )
            

    Sets the benchmark used for computing statistics of the algorithm to the specified symbol.

    SetBenchmark() 5/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetBenchmark (
        Func<DateTime, Decimal>  benchmark
       )
            

    Sets the specified function as the benchmark, this function provides the value of the benchmark at each date/time requested.

    SetBrokerageMessageHandler() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetBrokerageMessageHandler (
        IBrokerageMessageHandler  handler
       )
            

    Sets the implementation used to handle messages from the brokerage. The default implementation will forward messages to debug or error and when a Error occurs, the algorithm is stopped.

    SetBrokerageModel() 1/3

                Void QuantConnect.Algorithm.QCAlgorithm.SetBrokerageModel (
        PyObject  model
       )
            

    Sets the brokerage to emulate in backtesting or paper trading. This can be used to set a custom brokerage model.

    SetBrokerageModel() 2/3

                Void QuantConnect.Algorithm.QCAlgorithm.SetBrokerageModel (
        BrokerageName  brokerage,
        *AccountType   accountType
       )
            

    Sets the brokerage to emulate in backtesting or paper trading. This can be used for brokerages that have been implemented in LEAN.

    SetBrokerageModel() 3/3

                Void QuantConnect.Algorithm.QCAlgorithm.SetBrokerageModel (
        IBrokerageModel  model
       )
            

    Sets the brokerage to emulate in backtesting or paper trading. This can be used to set a custom brokerage model.

    SetCash() 1/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetCash (
        Int32  startingCash
       )
            

    Set initial cash for the strategy while backtesting. During live mode this value is ignored and replaced with the actual cash of your brokerage account.

    SetCash() 2/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetCash (
        Decimal  startingCash
       )
            

    Set initial cash for the strategy while backtesting. During live mode this value is ignored and replaced with the actual cash of your brokerage account.

    SetCash() 3/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetCash (
        String    symbol,
        Decimal   startingCash,
        *Decimal  conversionRate
       )
            

    Set the cash for the specified symbol.

    SetCash() 4/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetCash (
        Double  startingCash
       )
            

    Set initial cash for the strategy while backtesting. During live mode this value is ignored and replaced with the actual cash of your brokerage account.

    SetCurrentSlice() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetCurrentSlice (
        Slice  slice
       )
            

    Sets the current slice.

    SetEndDate() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetEndDate (
        Int32  year,
        Int32  month,
        Int32  day
       )
            

    Set the end date for a backtest run.

    SetEndDate() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetEndDate (
        DateTime  end
       )
            

    Set the end date for a backtest.

    SetExecution() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetExecution (
        IExecutionModel  execution
       )
            

    Sets the execution model.

    SetExecution() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetExecution (
        PyObject  execution
       )
            

    Sets the execution model.

    SetFutureChainProvider() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetFutureChainProvider (
        IFutureChainProvider  futureChainProvider
       )
            

    Sets the future chain provider, used to get the list of future contracts for an underlying symbol.

    SetHoldings() 1/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetHoldings (
        List<PortfolioTarget>  targets,
        *Boolean                     liquidateExistingHoldings,
        *String                      tag,
        *IOrderProperties            orderProperties
       )
            

    Sets holdings for a collection of targets. The implementation will order the provided targets executing first those that reduce a position, freeing margin.

    SetHoldings() 2/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetHoldings (
        Symbol             symbol,
        Double             percentage,
        *Boolean           liquidateExistingHoldings,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Alias for SetHoldings to avoid the M-decimal errors.

    SetHoldings() 3/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetHoldings (
        Symbol             symbol,
        Single             percentage,
        *Boolean           liquidateExistingHoldings,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Alias for SetHoldings to avoid the M-decimal errors.

    SetHoldings() 4/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetHoldings (
        Symbol             symbol,
        Int32              percentage,
        *Boolean           liquidateExistingHoldings,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Alias for SetHoldings to avoid the M-decimal errors.

    SetHoldings() 5/5

                Void QuantConnect.Algorithm.QCAlgorithm.SetHoldings (
        Symbol             symbol,
        Decimal            percentage,
        *Boolean           liquidateExistingHoldings,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Automatically place a market order which will set the holdings to between 100% or -100% of *PORTFOLIO VALUE*. E.g. SetHoldings("AAPL", 0.1); SetHoldings("IBM", -0.2); -> Sets portfolio as long 10% APPL and short 20% IBM E.g. SetHoldings("AAPL", 2); -> Sets apple to 2x leveraged with all our cash. If the market is closed, place a market on open order.

    SetObjectStore() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetObjectStore (
        IObjectStore  objectStore
       )
            

    Sets the object store.

    SetOptionChainProvider() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetOptionChainProvider (
        IOptionChainProvider  optionChainProvider
       )
            

    Sets the option chain provider, used to get the list of option contracts for an underlying symbol.

    <-- Missing documentation attribute for SetPandasConverter -->

    SetParameters() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetParameters (
        Dictionary<String, String>  parameters
       )
            

    SetPortfolioConstruction() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetPortfolioConstruction (
        IPortfolioConstructionModel  portfolioConstruction
       )
            

    Sets the portfolio construction model.

    SetPortfolioConstruction() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetPortfolioConstruction (
        PyObject  portfolioConstruction
       )
            

    Sets the portfolio construction model.

    SetQuit() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetQuit (
        Boolean  quit
       )
            

    Set the Quit flag property of the algorithm.

    SetRiskManagement() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetRiskManagement (
        IRiskManagementModel  riskManagement
       )
            

    Sets the risk management model.

    SetRiskManagement() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetRiskManagement (
        PyObject  riskManagement
       )
            

    Sets the risk management model.

    SetRunTimeError() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetRunTimeError (
        Exception  exception
       )
            

    Set the runtime error.

    SetRuntimeStatistic() 1/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetRuntimeStatistic (
        String  name,
        String  value
       )
            

    Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.

    SetRuntimeStatistic() 2/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetRuntimeStatistic (
        String   name,
        Decimal  value
       )
            

    Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.

    SetRuntimeStatistic() 3/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetRuntimeStatistic (
        String  name,
        Int32   value
       )
            

    Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.

    SetRuntimeStatistic() 4/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetRuntimeStatistic (
        String  name,
        Double  value
       )
            

    Set a runtime statistic for the algorithm. Runtime statistics are shown in the top banner of a live algorithm GUI.

    SetSecurityInitializer() 1/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetSecurityInitializer (
        PyObject  securityInitializer
       )
            

    Sets the security initializer function, used to initialize/configure securities after creation.

    SetSecurityInitializer() 2/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetSecurityInitializer (
        ISecurityInitializer  securityInitializer
       )
            

    Sets the security initializer, used to initialize/configure securities after creation. The initializer will be applied to all universes and manually added securities.

    SetSecurityInitializer() 3/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetSecurityInitializer (
        Action<Security, Boolean>  securityInitializer
       )
            

    SetSecurityInitializer() 4/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetSecurityInitializer (
        Action<Security>  securityInitializer
       )
            

    SetStartDate() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetStartDate (
        Int32  year,
        Int32  month,
        Int32  day
       )
            

    Set the start date for backtest.

    SetStartDate() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetStartDate (
        DateTime  start
       )
            

    Set the start date for the backtest.

    SetTimeZone() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetTimeZone (
        String  timeZone
       )
            

    Sets the time zone of the Time property in the algorithm.

    SetTimeZone() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetTimeZone (
        DateTimeZone  timeZone
       )
            

    Sets the time zone of the Time property in the algorithm.

    SetTradeBuilder() 1/1

                Void QuantConnect.Algorithm.QCAlgorithm.SetTradeBuilder (
        ITradeBuilder  tradeBuilder
       )
            

    Set the ITradeBuilder implementation to generate trades from executions and market price updates.

    SetUniverseSelection() 1/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetUniverseSelection (
        IUniverseSelectionModel  universeSelection
       )
            

    Sets the universe selection model.

    SetUniverseSelection() 2/2

                Void QuantConnect.Algorithm.QCAlgorithm.SetUniverseSelection (
        PyObject  universeSelection
       )
            

    Sets the universe selection model.

    SetWarmUp() 1/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetWarmUp (
        TimeSpan  timeSpan
       )
            

    Sets the warm up period to the specified value.

    SetWarmUp() 2/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetWarmUp (
        TimeSpan                    timeSpan,
        Nullable<Resolution>  resolution
       )
            

    Sets the warm up period to the specified value.

    SetWarmUp() 3/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetWarmUp (
        Int32  barCount
       )
            

    Sets the warm up period by resolving a start date that would send that amount of data into the algorithm. The highest (smallest) resolution in the securities collection will be used. For example, if an algorithm has minute and daily data and 200 bars are requested, that would use 200 minute bars.

    SetWarmUp() 4/4

                Void QuantConnect.Algorithm.QCAlgorithm.SetWarmUp (
        Int32                       barCount,
        Nullable<Resolution>  resolution
       )
            

    Sets the warm up period by resolving a start date that would send that amount of data into the algorithm.

    Shortable() 1/2

                Boolean QuantConnect.Algorithm.QCAlgorithm.Shortable (
        Symbol  symbol
       )
            

    Determines if the Symbol is shortable at the brokerage.

    Shortable() 2/2

                Boolean QuantConnect.Algorithm.QCAlgorithm.Shortable (
        Symbol   symbol,
        Decimal  shortQuantity
       )
            

    Determines if the Symbol is shortable at the brokerage.

    ShortableQuantity() 1/1

                Int64 QuantConnect.Algorithm.QCAlgorithm.ShortableQuantity (
        Symbol  symbol
       )
            

    Gets the quantity shortable for the given asset.

    SI() 1/1

                WilderSwingIndex QuantConnect.Algorithm.QCAlgorithm.SI (
        Symbol                            symbol,
        Decimal                           limitMove,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a Wilder Swing Index (SI) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    SMA() 1/1

                SimpleMovingAverage QuantConnect.Algorithm.QCAlgorithm.SMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates an SimpleMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

    SORTINO() 1/1

                SortinoRatio QuantConnect.Algorithm.QCAlgorithm.SORTINO (
        Symbol                           symbol,
        Int32                            sortinoPeriod,
        *Double                          minimumAcceptableReturn,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Sortino indicator.

    SR() 1/1

                SharpeRatio QuantConnect.Algorithm.QCAlgorithm.SR (
        Symbol                           symbol,
        Int32                            sharpePeriod,
        *Decimal                         riskFreeRate,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new RollingSharpeRatio indicator.

    STC() 1/1

                SchaffTrendCycle QuantConnect.Algorithm.QCAlgorithm.STC (
        Symbol                           symbol,
        Int32                            cyclePeriod,
        Int32                            fastPeriod,
        Int32                            slowPeriod,
        *MovingAverageType               movingAverageType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Schaff Trend Cycle indicator.

    STD() 1/1

                StandardDeviation QuantConnect.Algorithm.QCAlgorithm.STD (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new StandardDeviation indicator. This will return the population standard deviation of samples over the specified period.

    STO() 1/2

                Stochastic QuantConnect.Algorithm.QCAlgorithm.STO (
        Symbol                            symbol,
        Int32                             period,
        Int32                             kPeriod,
        Int32                             dPeriod,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Stochastic indicator.

    STO() 2/2

                Stochastic QuantConnect.Algorithm.QCAlgorithm.STO (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Overload short hand to create a new Stochastic indicator; defaulting to the 3 period for dStoch.

    StopLimitOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopLimitOrder (
        Symbol             symbol,
        Int32              quantity,
        Decimal            stopPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a stop limit order to the transaction handler:.

    StopLimitOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopLimitOrder (
        Symbol             symbol,
        Double             quantity,
        Decimal            stopPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a stop limit order to the transaction handler:.

    StopLimitOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopLimitOrder (
        Symbol             symbol,
        Decimal            quantity,
        Decimal            stopPrice,
        Decimal            limitPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Send a stop limit order to the transaction handler:.

    StopMarketOrder() 1/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopMarketOrder (
        Symbol             symbol,
        Int32              quantity,
        Decimal            stopPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Create a stop market order and return the newly created order id; or negative if the order is invalid.

    StopMarketOrder() 2/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopMarketOrder (
        Symbol             symbol,
        Double             quantity,
        Decimal            stopPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Create a stop market order and return the newly created order id; or negative if the order is invalid.

    StopMarketOrder() 3/3

                OrderTicket QuantConnect.Algorithm.QCAlgorithm.StopMarketOrder (
        Symbol             symbol,
        Decimal            quantity,
        Decimal            stopPrice,
        *String            tag,
        *IOrderProperties  orderProperties
       )
            

    Create a stop market order and return the newly created order id; or negative if the order is invalid.

    STR() 1/1

                SuperTrend QuantConnect.Algorithm.QCAlgorithm.STR (
        Symbol                                symbol,
        Int32                                 period,
        Decimal                               multiplier,
        *MovingAverageType                    movingAverageType,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new SuperTrend indicator.

    <-- Missing documentation attribute for SubmitOrderRequest -->

    SUM() 1/1

                Sum QuantConnect.Algorithm.QCAlgorithm.SUM (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Sum indicator.

    SWISS() 1/1

                SwissArmyKnife QuantConnect.Algorithm.QCAlgorithm.SWISS (
        Symbol                           symbol,
        Int32                            period,
        Double                           delta,
        SwissArmyKnifeTool               tool,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates Swiss Army Knife transformation for the symbol. The indicator will be automatically updated on the given resolution.

    Symbol() 1/1

                Symbol QuantConnect.Algorithm.QCAlgorithm.Symbol (
        String  ticker
       )
            

    Converts the string 'ticker' symbol into a full Symbol object This requires that the string 'ticker' has been added to the algorithm.

    T3() 1/1

                T3MovingAverage QuantConnect.Algorithm.QCAlgorithm.T3 (
        Symbol                           symbol,
        Int32                            period,
        *Decimal                         volumeFactor,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new T3MovingAverage indicator.

    TDD() 1/1

                TargetDownsideDeviation QuantConnect.Algorithm.QCAlgorithm.TDD (
        Symbol                           symbol,
        Int32                            period,
        *Double                          minimumAcceptableReturn,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TargetDownsideDeviation indicator. The target downside deviation is defined as the root-mean-square, or RMS, of the deviations of the realized return’s underperformance from the target return where all returns above the target return are treated as underperformance of 0.

    TEMA() 1/1

                TripleExponentialMovingAverage QuantConnect.Algorithm.QCAlgorithm.TEMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TripleExponentialMovingAverage indicator.

    TP() 1/1

                TimeProfile QuantConnect.Algorithm.QCAlgorithm.TP (
        Symbol                            symbol,
        *Int32                            period,
        *Decimal                          valueAreaVolumePercentage,
        *Decimal                          priceRangeRoundOff,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an Market Profile indicator for the symbol with Time Price Opportunity (TPO) mode. The indicator will be automatically updated on the given resolution.

    TR() 1/1

                TrueRange QuantConnect.Algorithm.QCAlgorithm.TR (
        Symbol                                symbol,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new TrueRange indicator.

    Train() 1/4

                ScheduledEvent QuantConnect.Algorithm.QCAlgorithm.Train (
        PyObject  trainingCode
       )
            

    Schedules the provided training code to execute immediately.

    Train() 2/4

                ScheduledEvent QuantConnect.Algorithm.QCAlgorithm.Train (
        IDateRule  dateRule,
        ITimeRule  timeRule,
        PyObject   trainingCode
       )
            

    Schedules the training code to run using the specified date and time rules.

    Train() 3/4

                ScheduledEvent QuantConnect.Algorithm.QCAlgorithm.Train (
        Action  trainingCode
       )
            

    Schedules the provided training code to execute immediately.

    Train() 4/4

                ScheduledEvent QuantConnect.Algorithm.QCAlgorithm.Train (
        IDateRule  dateRule,
        ITimeRule  timeRule,
        Action     trainingCode
       )
            

    Schedules the training code to run using the specified date and time rules.

    TRIMA() 1/1

                TriangularMovingAverage QuantConnect.Algorithm.QCAlgorithm.TRIMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new TriangularMovingAverage indicator.

    TRIN() 1/2

                ArmsIndex QuantConnect.Algorithm.QCAlgorithm.TRIN (
        IEnumerable<Symbol>         symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Arms Index indicator.

    TRIN() 2/2

                ArmsIndex QuantConnect.Algorithm.QCAlgorithm.TRIN (
        Symbol>                        symbols,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates a new Arms Index indicator.

    TRIX() 1/1

                Trix QuantConnect.Algorithm.QCAlgorithm.TRIX (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Trix indicator.

    TSI() 1/1

                TrueStrengthIndex QuantConnect.Algorithm.QCAlgorithm.TSI (
        Symbol                           symbol,
        *Int32                           longTermPeriod,
        *Int32                           shortTermPeriod,
        *Int32                           signalPeriod,
        *MovingAverageType               signalType,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a TrueStrengthIndex indicator for the symbol. The indicator will be automatically updated on the given resolution.

    ULTOSC() 1/1

                UltimateOscillator QuantConnect.Algorithm.QCAlgorithm.ULTOSC (
        Symbol                                symbol,
        Int32                                 period1,
        Int32                                 period2,
        Int32                                 period3,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new UltimateOscillator indicator.

    VAR() 1/1

                Variance QuantConnect.Algorithm.QCAlgorithm.VAR (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a new Variance indicator. This will return the population variance of samples over the specified period.

    VP() 1/1

                VolumeProfile QuantConnect.Algorithm.QCAlgorithm.VP (
        Symbol                            symbol,
        *Int32                            period,
        *Decimal                          valueAreaVolumePercentage,
        *Decimal                          priceRangeRoundOff,
        *Resolution                       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an Market Profile indicator for the symbol with Volume Profile (VOL) mode. The indicator will be automatically updated on the given resolution.

    VWAP() 1/2

                VolumeWeightedAveragePriceIndicator QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol                            symbol,
        Int32                             period,
        *Nullable<Resolution>       resolution,
        *Func<IBaseData, TradeBar>  selector
       )
            

    Creates an VolumeWeightedAveragePrice (VWAP) indicator for the symbol. The indicator will be automatically updated on the given resolution.

    VWAP() 2/2

                IntradayVwap QuantConnect.Algorithm.QCAlgorithm.VWAP (
        Symbol  symbol
       )
            

    Creates the canonical VWAP indicator that resets each day. The indicator will be automatically updated on the security's configured resolution.

    WarmUpIndicator() 1/5

                Void QuantConnect.Algorithm.QCAlgorithm.WarmUpIndicator (
        Symbol                       symbol,
        PyObject                     indicator,
        *Nullable<Resolution>  resolution,
        *PyObject                    selector
       )
            

    Warms up a given indicator with historical data.

    WarmUpIndicator() 2/5

                Void QuantConnect.Algorithm.QCAlgorithm.WarmUpIndicator (
        Symbol                                   symbol,
        IndicatorBase<IndicatorDataPoint>  indicator,
        *Nullable<Resolution>              resolution,
        *Func<IBaseData, Decimal>          selector
       )
            

    WarmUpIndicator() 3/5

                Void QuantConnect.Algorithm.QCAlgorithm.WarmUpIndicator (
        Symbol                                   symbol,
        IndicatorBase<IndicatorDataPoint>  indicator,
        TimeSpan                                 period,
        *Func<IBaseData, Decimal>          selector
       )
            

    WarmUpIndicator() 4/5

                Void QuantConnect.Algorithm.QCAlgorithm.WarmUpIndicator (
        Symbol                       symbol,
        IndicatorBase<T>       indicator,
        *Nullable<Resolution>  resolution,
        *Func<IBaseData, T>    selector
       )
            

    WarmUpIndicator() 5/5

                Void QuantConnect.Algorithm.QCAlgorithm.WarmUpIndicator (
        Symbol                     symbol,
        IndicatorBase<T>     indicator,
        TimeSpan                   period,
        *Func<IBaseData, T>  selector
       )
            

    WILR() 1/1

                WilliamsPercentR QuantConnect.Algorithm.QCAlgorithm.WILR (
        Symbol                                symbol,
        Int32                                 period,
        *Nullable<Resolution>           resolution,
        *Func<IBaseData, IBaseDataBar>  selector
       )
            

    Creates a new Williams %R indicator. This will compute the percentage change of the current closing price in relation to the high and low of the past N periods. The indicator will be automatically updated on the given resolution.

    WWMA() 1/1

                WilderMovingAverage QuantConnect.Algorithm.QCAlgorithm.WWMA (
        Symbol                           symbol,
        Int32                            period,
        *Nullable<Resolution>      resolution,
        *Func<IBaseData, Decimal>  selector
       )
            

    Creates a WilderMovingAverage indicator for the symbol. The indicator will be automatically updated on the given resolution.

     

    23 Migrations

    23.1 Zipline

    The following pages explain how to migrate trading algorithms from Zipline to LEAN:

     

    23.1.1 Initialization

    Initializing State

    On QuantConnect, algorithm initialization behavior is equivalent to Quantopian's initialize method. Initialize is the method equivalent, and it is only ran once at the start of the algorithm. It is responsible for initially adding data to the algorithm, adding a universe, setting the brokerage, setting the algorithm's start and end date, etc.

    The algorithm structure in QuantConnect differs from Quantopian's as well. On QuantConnect, we create a class that derives from QCAlgorithm and define our overrides/algorithm functionality there. An example of an algorithm with initialization is provided.

    Quantopian

    def initialize(context):
        # Adds AAPL sid to `context` for use later in `handle_data(...)`
        context.aapl = sid(24)

    QuantConnect

    class MyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            # Adds minutely AAPL data to the algorithm
            self.aapl = self.AddEquity("AAPL", Resolution.Minute)

    On QuantConnect, the self parameter is the equivalent of the context parameter in Quantopian algorithms. You can use self to access algorithm resources, such as the Portfolio, Orders, Order Tickets, Securities, place orders in your algorithm, and much more.

    You can read more about algorithm initialization at the Initializion documentation page.

    Attaching Pipelines

    The functional equivalent of Pipelines on QuantConnect are Universes. Universes can be used to dynamically select assets your algorithm wants to trade or request data from. To add a universe to your algorithm, you can call the AddUniverse() method and provide the required Coarse and Fine universe selection functions.

    Coarse Universe selection is the first step of universe selection. It provides a means to filter data in a lightweight fashion before proceeding to Fine Universe selection. Coarse universe will allow you to filter assets based off top-level fundamental factors, such as Dollar Volume for the day, if a company has fundamental data, and market of the asset.

    Fine Universe selection is the second step of universe selection. It provides fundamental data to your user-defined function, and can be used to filter in greater detail based on an asset's fundamental data, such as earnings, EPS, etc.

    An example of coarse and fine universe selection to filter assets in our algorithm is provided. Adding universes can be used as an alternative to using AddEquity if you prefer dynamic asset selection.

    class MyUniverseAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2020, 1, 1)
            self.SetEndDate(2020, 2, 1)
    
            self.UniverseSettings.Resolution = Resolution.Minute
            self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
    
        def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
            return [i.Symbol for i in coarse if i.DollarVolume > 500000 and i.HasFundamentalData]
    
        def FineSelectionFunction(self, fine: List[FineFundamental]) -> List[Symbol]:
            return [i.Symbol for i in fine if i.EarningReports.BasicEPS.OneMonth > 0]

    You can configure universe settings by modifying the existing UniverseSettings attribute of the algorithm.

    class MyUniverseAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.UniverseSettings.Resolution = Resolution.Minute
            self.UniverseSettings.DataNormalizationMode = DataNormalizationMode.Adjusted
            self.UniverseSettings.Leverage = 1.0
            self.UniverseSettings.ExtendedMarketHours = False

    You can read more about universe selection at the Universe documentation page.

    Scheduling Functions

    Scheduled Events on QuantConnect are the equivalent of schedule_function() from Quantopian. Examples are provided comparing the Scheduled Events functionality between QuantConnect and Quantopian.

    Quantopian

    import quantopian.algorithm as algo
    
    def my_scheduled_function(context, data):
        pass
    
    def initialize(context):
        # Runs a function every day 60 minutes before U.S. Equities market close
        algo.schedule_function(
            func=my_scheduled_function,
            date_rule=algo.date_rules.every_day(),
            time_rule=algo.time_rules.market_close(minutes=60),
            calendar=algo.calendars.US_EQUITIES
        )

    QuantConnect

    class MyAlgorithm(QCAlgorithm):
        def my_scheduled_function(self):
            pass
    
        # Runs a function every day 60 minutes before SPY ETF's market close
        def Initialize(self) -> None:
            self.Schedule.On(
                self.DateRules.EveryDay(),
                self.TimeRules.BeforeMarketClose("SPY", 60),
                self.my_scheduled_function
           )

    You can read more about scheduled events at the Scheduled Events documentation page.

    Setting Slippage and Commissions

    QuantConnect supports applying slippage and commissions per individual security.

    To add a slippage model to a security, we must set the SlippageModel property of the Security object to our model. A Security is returned when data is added to the algorithm. Examples of setting slippage in an algorithm is provided below for both Quantopian and QuantConnect.

    Quantopian

    import quantopian.algorithm as algorithm
    from zipline.finance.slippage import FixedSlippage
    
    
        def initialize(context):
            # This will set slippage for all U.S. equities
            algorithm.set_slippage(us_equities=FixedSlippage(0.01))
        

    QuantConnect

    class MyAlgorithm(QCAlgorithm)
        def Initialize(self) -> None:
            spy = self.AddEquity("SPY", Resolution.Minute)
            # `ConstantSlippageModel` is the same as `FixedSlippage` on Quantopian.
            # This will set slippage only for the "SPY" security.
            spy.SlippageModel = ConstantSlippageModel(0.01)

    Commissions

    To add a fee model (otherwise known as Commissions on Quantopian) to a security, we must set the FeeModel property of the Security object to our model. Examples are provided below for Quantopian and QuantConnect.

    Quantopian

    import quantopian.algorithm as algorithm
    from zipline.finance.commission import PerShare
    
    
        def initialize(context):
            # Approximates Interactive Brokers' equities trading commissions.
            algorithm.set_commission(us_equities=Pershare(cost=0.0075))
        

    QuantConnect

    class MyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
           aapl = self.AddEquity("AAPL", Resolution.Minute)
           spy = self.AddEquity("SPY", Resolution.Minute)
    
           # Sets the fee model to the IB fee model, which simulates
           # the fees we would encounter in live trading.
           spy.FeeModel = InteractiveBrokersFeeModel()
    
           # Sets the fee model to a constant fee model
           aapl.FeeModel = ConstantFeeModel(0.01, "USD")

    You can read more about Securities and their attributes at the Securities and Portfolio and Reality Modeling documentation pages.

    Manual Asset Lookup

    On QuantConnect, we provide the Symbol class to reference a security across time with a changing ticker. This is similar to Quantopian's symbol() function, which enables the same functionality.

    When you add data to your algorithm, a Security object is returned. The Symbol is accessible from the Security as shown below.

    class MyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2000, 1, 1)
            self.SetEndDate(2020, 1, 1)
            # TWX will change to AOL when backtesting in the early 2000s, and will
            # change to TWX as the backtest advances past the date it was renamed.
            twx_security = self.AddEquity("TWX", Resolution.Minute)
            twx_symbol = twx_security.Symbol

    To manually create a reference to an old equity, you can use the Symbol.Create() method, or the Symbol.CreateEquity() method.

    You can read more about Symbols and Security Identifiers (SID) at the Security Identifiers documentation page.

     

    23.1.2 Using Data

    Pipeline in Algorithms

    As covered in the Initialization section, Pipelines can be replicated using Universe Selection in QuantConnect, albeit with some additional steps in between and a performance impact.

    In this section, we will construct and define an equivalent pipeline model using universe selection in QuantConnect. We will filter our data set in Coarse and Fine, and apply an additional filter to historical data with a rolling window.

    We first create a skeleton algorithm definition to begin setting up our Pipeline. Note that this algorithm will allow all equities through, which will have a substantial performance impact on our algorithm.

    class MyPipelineAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2020, 1, 1)
            self.SetEndDate(2020, 10, 20)
    
            self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
    
        def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
            # Allows all Symbols through, no filtering applied
            return [coarse_data.Symbol for coarse_data in coarse]
    
        def FineSelectionFunction(self, fine: List[FineFundamental]) -> List[Symbol]:
            # Allows all Symbols through, no filtering applied
            return [fine_data.Symbol for fine_data in fine]

    The skeleton algorithm is the equivalent of the Pipeline call below.

    from quantopian.pipeline import Pipeline
    from quantopian.pipeline.domain import US_EQUITIES
    from quantopian.research import run_pipeline
    
    pipe = Pipeline(columns={}, domain=US_EQUITIES)
    run_pipeline(pipe, '2020-01-01', '2020-10-20')

    The equivalent of Pipeline(screen=...) resolves to the filter applied at the Coarse and Fine stages of universe selection. Let's define a filter of stocks with a dollar volume greater than $50000000 USD, as well as a rolling thirty day return greater than 2%. Once we've initially filtered the Symbols in Coarse Universe Selection, let's define a final filter only allowing stocks with EPS greater than 0. Beware of making History() calls with many Symbols. It could potentially cause your algorithm to run out of system resources (i.e. RAM) and reduce performance of your algorithm on universe selection.

    from datetime import datetime, timedelta
    
    class MyPipelineAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2020, 1, 1)
            self.SetEndDate(2020, 10, 20)
    
            self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
    
        def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:
            # Allows all Symbols through, no filtering applied
            dollar_volume_filter_symbols = [coarse_data.Symbol for coarse_data in coarse if coarse_data.DollarVolume > 50000000]
    
            # Make a history call to calculate the 30 day rolling returns
            df = self.History(dollar_volume_filter_symbols, self.Time - timedelta(days=60), self.Time, Resolution.Daily)
    
            # Compute the rolling 30 day returns
            df = df['close'].groupby(level=0).filter(lambda x: len(x) >= 30).groupby(level=0).apply(lambda x: (x.iloc[-1] - x.iloc[-30]) / x.iloc[-30])
    
            # Finally, apply our filter
            dataframe_screen = df[df > 0.02]
    
            # Filters out any Symbol that is not in the DataFrame
            return [s for s in dollar_volume_filter_symbols if str(s) in dataframe_screen]
    
        def FineSelectionFunction(self, fine: List[FineFundamental]) -> List[Symbol]:
            # We receive the filtered symbols from before, and we filter by EPS > 0 in this step
           return [s.Symbol for s in fine if s.EarningReports.BasicEPS.ThreeMonths > 0]

    This class definition is now roughly equivalent to the following CustomFactor and Pipeline call in Quantopian, excluding the EPS filtering.

    from quantopian.pipeline.filters import QTradableStocksUS
    from quantopian.pipeline.factors import AverageDollarVolume
    
    class PercentageChange(CustomFactor):
        def compute(self, today, assets, out, values):
            out[:] = (values[-1] - values[0]) / values[0]
    
        dollar_volume = AverageDollarVolume(window_length=5)
        dollar_volume_filter = (dollar_volume > 50000000)
    
        pipe = Pipeline(
            columns={
                "percent_change": PercentageChange(inputs=[USEquityPricing.close], window_length=30)
            },
            screen=(QTradableStocksUS() & dollar_volume_filter)
        )
        

    An example of the shape of the DataFrame returned from History is shown below. The DataFrame has a MultiIndex, with level=0 being the Symbol, and level=1 being the Time for that point of data. You can index the Symbol/ level=0 index by using either the SecurityIdentifier string (e.g. df.loc["AAPL R735QTJ8XC9X"] ) or with the ticker of the Symbol (e.g. df.loc["AAPL"] ) Historical data of IBM, & AAPL

    BarData Lookup

    Similar but different, the Quantopian BarData object, and the QuantConnect Slice object both provide data to the user's algorithm as point-in-time data.

    In Quantopian, data is handled via the handle_data(context, data) function. In QuantConnect, data is handled via the OnData(self, slice) method. Both of these functions accept data whenever new data exists for a given point in time. Although these two functions share the same method signature, the handling of the data is different.

    BarData vs. Slice

    BarData is the primary mechanism to retrieve the point-in-time data, as well as requesting history for any given securities in Quantopian. The following code retrieves daily historical data from 30 days into the past, as well as getting the most recent data for AAPL at the current point-in-time.

    Quantopian

    def initialize(context):
        context.aapl = sid(24)
    
    def handle_data(context, data):
        # Gets a DataFrame of AAPL history going back 30 days
        aapl_history = data.history(context.aapl, fields=["open", "high", "low", "close", "volume"], 30, "1d")
        # Gets a pandas Series of the most recent AAPL data
        aapl_current = data.current(context.aapl, fields=["open", "high", "low", "close", "volume"])

    QuantConnect

    from datetime import timedelta
            
    class MyHistoryAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.aapl = self.AddEquity("AAPL", Resolution.Daily)
    
        def OnData(self, slice: Slice) -> None:
            # Gets a DataFrame of AAPL history going back 30 days
            aapl_history = self.History([self.aapl.Symbol], timedelta(days=30), Resolution.Daily)
    
            # Gets the most recent AAPL Trade data (OHLCV)
            aapl_current = slice.Bars[self.aapl.Symbol]
        

    Slice represents a single point in time, and does not provide the functionality to access historical data itself. To access historical data in an algorithm, use the algorithm's self.History() call to request a pandas DataFrame of historical data. In Slice , the data that is accessed is not a pandas DataFrame, but rather a single object containing data for a single point in time.

    The TradeBar class, for example, only contains scalar values of OHLCV, rather than return a DataFrame of OHLCV values. Since the data Slice contains is point-in-time, there will be only a single trade/quote bar per Symbol whenever OnData(self, data) is called.

    QuantConnect provides Quote (NBBO) data for use in your algorithm, otherwise known as a QuoteBar . Quote data is only accessible when an algorithm is set to consume Tick, Second, or Minutely data.

    You can access Trade (OHLCV) data by accessing the Bars attribute of Slice . You can access Quote (Bid(OHLCV), Ask(OHLCV)) data by accessing the QuoteBars attribute of Slice .

    Both of the Bars and QuoteBars attributes are similar to Python dictionaries, and can be used as such. To check to see if there exists a new piece of data for a given security, you can use Python's in operator on Bars and or QuoteBars . You can also choose to iterate on all data received by calling the Values attribute of the Bars or QuoteBars attributes, which will return either a list of TradeBar or QuoteBar objects.

    The TradeBar object contains the Open , High , Low , Close , Volume , Time , EndTime , and Symbol attributes. The QuoteBar object contains the following attributes:

    Note that the Bid and Ask attributes can potentially be None if no bid/ask data exists at a given point-in-time.

    The example below shows the different ways to access TradeBar and QuoteBar data, as well as requesting 30 days of AAPL historical data.

    from datetime import datetime, timedelta
    
    
    class MyDataAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.aapl_security = self.AddEquity("AAPL", Resolution.Daily)
            self.aapl_symbol = self.aapl_security.Symbol
    
        def OnData(self, slice: Slice) -> None:
            # Gets 30 days of AAPL history
            aapl_history = self.History([self.aapl_symbol], timedelta(days=30), Resolution.Daily)
    
            # We must first check to make sure we have AAPL data, since this point-in-time
            # might not have had any trades for AAPL (this is in case you trade a low
            # liquidity asset. The data can potentially be missing for a point-in-time).
            if self.aapl_symbol in slice.Bars:
                aapl_current_trade = slice.Bars[self.aapl_symbol]
                Log(f"{self.Time} :: TRADE :: {self.aapl_symbol} - O: {aapl_current_trade.Open} H: {aapl_current_trade.High} L: {aapl_current_trade.Low} C: {aapl_current_trade.Close} V: {aapl_current_trade.Volume}")
    
            # Check to make sure we have AAPL data first, since there might not have
            # been any quote updates since the previous for AAPL (this is in case you trade
            # a low liquidity asset. The data can potentially be missing for a point-in-time).
            if self.aapl_symbol in data.QuoteBars:
                aapl_current_quote = slice.QuoteBars[self.aapl_symbol]
                if aapl_current_quote.Bid is not None:
                    Log(f"{} :: QUOTE :: {} - Bid O: {} Bid H: {} Bid L: {} Bid C: {} Bid size: {}".format(
                        str(self.Time),
                        str(self.aapl_symbol)
                        str(aapl_current_quote.Bid.Open),
                        str(aapl_current_quote.Bid.High),
                        str(aapl_current_quote.Bid.Low),
                        str(aapl_current_quote.Bid.Close),
                        str(aapl_current_quote.LastBidSize)
                    ))
    
                if aapl_current_quote.Ask is not None:
                    Log(f"{} :: QUOTE :: {} - Ask O: {} Ask H: {} Ask L: {} Ask C: {} Ask size: {}".format(
                        str(self.Time),
                        str(self.aapl_symbol),
                        str(aapl_current_quote.Ask.Open),
                        str(aapl_current_quote.Ask.High),
                        str(aapl_current_quote.Ask.Low),
                        str(aapl_current_quote.Ask.Close),
                        str(aapl_current_quote.LastAskSize)
                    ))
        

     

    23.1.3 Ordering

    Placing Orders

    Both Quantopian and QuantConnect offer several methods for placing orders. Both platforms have MarketOrder , LimitOrder , StopOrder , and StopLimitOrder classes to create specific order types, although the StopOrder order is named StopMarketOrder on our platform. On Quantopian, creating these orders is done by passing a style argument to the order method.

    from zipline.finance.execution import (
        LimitOrder,
        MarketOrder,
        StopLimitOrder,
        StopOrder,
    )
    
    def initialize(context):
        context.stock = sid(8554)
        context.ordered = False
    
    def handle_data(context, data):
        if not context.ordered:
            close = data.current(context.stock, 'close')
            order(context.stock, 10, style=MarketOrder()) 
            order(context.stock, 10, style=LimitOrder(limit_price=close * 0.9)) 
            order(context.stock, -10, style=StopOrder(stop_price=close * 0.85)) 
            order(context.stock, -10, style=StopLimitOrder(limit_price=close * 0.75, stop_price=close * 0.85)) 
            context.ordered = True
    

    On QuantConnect, the same orders can be created with

    class MyAlgorithm(QCAlgorithm):
    
        def Initialize(self) -> None:
            self.SetStartDate(2020, 3, 1)
            self.SetCash(100000)
            self.symbol = self.AddEquity("SPY", Resolution.Minute).Symbol
            self.ordered = False
    
        def OnData(self, slice: Slice) -> None:
            if not self.ordered and slice.ContainsKey(self.symbol):
                close = slice[self.symbol].Close
                self.MarketOrder(self.symbol, 10)
                self.LimitOrder(self.symbol, 10, close * 0.9)
                self.StopMarketOrder(self.symbol, -10, close * 0.85)
                self.StopLimitOrder(self.symbol, -10, close * 0.85, close * 0.75)
                self.ordered = True
    

    In addition to the order types above, QuantConnect has several other order types available. Refer to our Trading and Orders documentation for a comprehensive list.

    Quantopian's order_optimal_portfolio method computes the optimal portfolio weights using an objective and constraints, then places the orders to achieve the desired portfolio. For example, the code below uses the Quantopian API to create an equal-weighted dollar-neutral portfolio.

    import quantopian.algorithm as algo
    import quantopian.optimize as opt
    
    objective = opt.TargetWeights(weights)
    constraints = [
        opt.MaxGrossExposure(1.0),
        opt.DollarNeutral()
    ]
    algo.order_optimal_portfolio(objective, constraints)
    

    To acheive the same functionality with QuantConnect, we utilize portfolio construction models . For instance, to create an equal-weighted dollar-neutral portfolio, we could define the following portfolio construction model and attach it to the algorithm.

    class MyAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.SetStartDate(2020, 5, 1)  
            self.SetCash(100000)  
    
            self.SetPortfolioConstruction(EqualWeightedDollarNeutralPortfolioConstructionModel())
    
    
    class EqualWeightedDollarNeutralPortfolioConstructionModel(PortfolioConstructionModel):
    
        def DetermineTargetPercent(self, activeInsights: List[Insight]) -> Dict[Insight, float]:
            result = {}
            
            longs = 0
            shorts = 0
            for insight in activeInsights:
                if insight.Direction == InsightDirection.Up:
                    longs += 1
                elif insight.Direction == InsightDirection.Down:
                    shorts += 1
                result[insight] = 0
            
            if longs == 0 or shorts == 0:
                return result
            
            for insight in activeInsights:
                if insight.Direction == InsightDirection.Up:
                    result[insight] = 0.5 / longs
                elif insight.Direction == InsightDirection.Down:
                    result[insight] = -0.5 / shorts
            return result
    

    When algorithms require manual control of their orders, both Quantopian and QuantConnect have lower-level ordering methods. Quantopian's order method, which places an order for a fixed number of shares, directly maps to our Order method. Additionally, Quantopian's order_target_percent method places an order to adjust a position to a target percent of the current portfolio value. Here's an example use case of these methods on the Quantopian platform.

    order_target_percent(sid(8554), 10) # Allocate 10% of portfolio
    order(sid(8554), 10) # Order 10 shares
    

    On QuantConnect, these same orders can be placed using the SetHoldings and Order methods.

    self.SetHoldings(symbol, 0.1) # Allocate 10% of portfolio
    self.Order(symbol, 10) # Order 10 shares
    

    Quantopian and QuantConnect don't have equivalents for all the ordering techniques, although we can create a workaround for most situations. For instance, Quantopian's order_percent method places an order in the specified asset corresponding to the given percent of the current portfolio value.

    order_percent(sid(8554), 10) # Allocate 10% more of portfolio
    

    To accomplish this on QuantConnect, we can determine the weight of the asset in the Portfolio , then manually determine the new target percent to pass to SetHoldings .

    current_weight = self.Portfolio[symbol].HoldingsValue / self.Portfolio.TotalPortfolioValue
    self.SetHoldings(symbol, current_weight + 0.1) # Allocate 10% more of portfolio
    

    The Porfolio Object

    Quantopian's Portfolio class provides read-only access to the current portfolio state. The state includes starting cash, current cash, portfolio value, and positions. The Portfolio object is accessed through the context object, as seen below.

      
    context.portfolio.starting_cash     # Amount of cash in the portfolio at the start of the backtest
                     .cash              # Amount of cash currently held in portfolio
                     .portfolio_value   # Current liquidation value of the portfolio's holdings
                     .positions         # Dict-like object for currently-held positions
    

    All of this information, and more, is attainable on QuantConnect by using our Portfolio object. Listed below is an example of doing so. Although there isn't a property for starting cash, this value can be saved during Initialization to be referenced later.

    self.Portfolio.Cash                  # Sum of all currencies in account (only settled cash)
                  .TotalPortfolioValue   # Portfolio equity
                  .Keys                  # Collection of Symbol objects in the portfolio
                  .Values                # Collection of SecurityHolding objects in the portfolio
    

    On Quantopian, by iterating through the positions dictionary, we can access information about currently-held positions. This includes the number of shares held, the last traded price & date of the asset, and the position's cost basis.

      
    for sid, position in context.portfolio.positions.iteritems():
        position.amount            # Number of shares in the position 
                .cost_basis        # Volume weighted average price paid per share
                .last_sale_price   # Price at last sale of the asset on the exchange 
                .last_sale_date    # Date of last sale of the asset on the exchange
    

    Since the Portfolio on QuantConnect is a Dictionary<Symbol, SecurityHolding> , we can get information on current positions by indexing the Portfolio object with a Symbol or ticker. The SecurityHolding object that is returned contains information related to a single security in the portfolio. For instance, we have

    self.Portfolio[symbol].Quantity                 # Number of shares held
                          .AveragePrice             # Average price of shares held (aka cost basis)
                          .Price                    # Last traded price of the security
    

    For more information on our Portfolio object refer to the Securities and Portfolio documentation.

     

    23.1.4 Logging and Plotting

    Logging

    In QuantConnect, the self.Debug() method is the equivalent of the log.info() function in Quantopian. Debug output is viewable via the QuantConnect Terminal Console.

    Output to the console via self.Debug() is rate-limited. If you need long-term storage of your logs and don't want to overflow the console, consider using self.Log() instead. An example comparing logging between Quantopian and QuantConnect is shown below.

    Quantopian

    def initialize(context):
        log.info("Hello, console!")

    QuantConnect

    class MyLoggingAlgorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.Debug("Hello, console!")
            self.Log("Hello, backtesting logs!")

    Logging via self.Log() has daily limits in QuantConnect. On the free tier, users are limited to 10KB of logs per day for your account/organization. To increase this limit, you can upgrade your account to a different tier. Calls to self.Debug() will also count towards the 10KB log limit, but are always outputted to the Terminal Console regardless of your daily log limit.

    To view pricing and upgrade your account, visit the Organization Pricing page.

    You can view the logs generated via self.Log() for a backtest by first accessing a backtest, and clicking the "Logs" tab near the bottom of the page. To download the logs, you can click the "Download Logs" link to download a text file containing your backtest's logs.

    Plotting

    In Quantopian, plotting/charting is done with the record(series1_name=scalar_value, series2_name=scalar_value, ...) function. In QuantConnect, plotting is accessible via the self.Plot("chart name", "series name", scalar_value) method.

    Plotting multiple series in one function call is possible in Quantopian. However, in QuantConnect, a separate call is needed for each series requiring an update. All series with the same chart name will appear on the same window/pane. New charts can be created by calling self.Plot() method with a unique chart name.

    An example of plotting in Quantopian vs. QuantConnect is shown below. The QuantConnect code will create two charts, one named "Chart1" with two series of data, and another named "Chart2" with one series of data. Note that you can also use self.Plot("series name", value) to place the custom series on the same chart as the equity curve.

    Quantopian

    import numpy as np
    from quantopian.algorithm import record
    
        def initialize(context):
            context.i = 0
    
        def handle_data(context, data):
            context.i += 0.25
    
            record(
                Series1=np.sin(context.i),
                Series2=np.cos(context.i),
                Series3=np.tan(context.i)
            )

    QuantConnect

    import numpy as np
            
    class Algorithm(QCAlgorithm):
        def Initialize(self) -> None:
            self.i = 0
    
        def OnData(self, slice: Slice) -> None:
            self.i += 0.25
    
            self.Plot('Chart1', 'Series1', np.sin(self.i))
            self.Plot('Chart1', 'Series2', np.cos(self.i))
            self.Plot('Chart2', 'Chart2 Series1', np.tan(self.i))

    For more information on plotting in QuantConnect, visit the Charting documentation page.

     

    23.1.5 Quick Reference

    User-Implemented Functions

    The following table describes functions that are treated specially when defined in the IDE.

    Algorithms are required to implement one method: Initialize(self).

    An optional scheduled event can be defined to behave like before_trading_start(). OnData() is also optional but is treated especially if defined.

    Quantopian QuantConnect
    initialize (context) Initialize (self)
    Required function called once at the start of a backtest.
    before_trading_start (context, data) self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.AfterMarketOpen(symbol, 10), self.before_trading_start)
    Optional function called prior to market open on every trading day.
    handle_data (context, data) OnData (self, slice)
    Optional function called at the end of each market minute.

    Interface Classes

    The following table describes classes that are passed to initialize() , handle_data() , before_trading_start() and any scheduled with schedule_function() .

    In QuantConnect/Lean, the portfolio state and the positions are class attributes of QCAlgorithm, available via self keyword. The scheduled function is parameterless and can algorithms can self.CurrentSlice.

    Quantopian QuantConnect
    quantopian.algorithm.interface.AlgorithmContext QCAlgorithm
    Shared object for storing custom state.
    quantopian.algorithm.interface.BarData Slice
    Provides methods for accessing minutely and daily price/volume data from Algorithm API functions.
    quantopian.algorithm.interface.Portfolio self.Portfolio
    Object providing read-only access to current portfolio state.
    quantopian.algorithm.interface.Positions self.Transactions
    A dict-like object containing the algorithm's current positions.

    The features from the BarData methods are found in the Slice object (current data), History method (past data) and class attribute Securities.

    Quantopian QuantConnect
    quantopian.algorithm.interface.BarData.current Slice[symbol]
    Returns the "current" value of the given fields for the given assets at the current simulation time.
    quantopian.algorithm.interface.BarData.history self.History(symbols, bar_count)
    Returns a trailing window of length bar_count containing data for the given assets, fields, and frequency.
    quantopian.algorithm.interface.BarData.can_trade self.Securities[symbol].IsTradable
    For the given asset or iterable of assets, returns True if all of the following are true:
    quantopian.algorithm.interface.BarData.is_stale not Slice[symbol].IsFillForward
    For the given asset or iterable of assets, returns True if the asset is alive and there is no trade data for the current simulation time.

    Pipeline

    The following table describes functions used to schedule and retrieve results of Universe selection. For more information on the Universe Selection API, see the Univeres API Reference.

    Quantopian QuantConnect
    quantopian.algorithm.attach_pipeline (...) universe = self.AddUniverse (...)
    name = universe.Configuration.Symbol
    Register a pipeline to be computed at the start of each day.
    quantopian.algorithm.pipeline_output (name) self.UniverseManager [name]
    Get results of the pipeline attached by with name .

    Scheduling Functions

    The following tables describes functions that can be used to schedule functions to run periodically during your algorithm.

    Quantopian QuantConnect
    quantopian.algorithm.schedule_function (func) self.Schedule.On(IDateRule, ITimeRule, func)
    Schedule a function to be called repeatedly in the future.

    Date Rules

    The following table contains functions that can be used with the date_rule parameter of schedule_function() .

    Quantopian QuantConnect
    quantopian.algorithm.date_rules.every_day () self.DateRules.EveryDay(symbol)
    Create a rule that triggers every day.
    quantopian.algorithm.date_rules.month_start ([...]) self.DateRules.MonthStart(symbol, daysOffset)
    Create a rule that triggers a fixed number of trading days after the start of each month.
    quantopian.algorithm.date_rules.month_end ([...]) self.DateRules.MonthEnd(symbol, daysOffset)
    Create a rule that triggers a fixed number of trading days before the end of each month.
    quantopian.algorithm.date_rules.week_start ([...]) self.DateRules.WeekStart(symbol, daysOffset)
    Create a rule that triggers a fixed number of trading days after the start of each week.
    quantopian.algorithm.date_rules.week_end ([...]) self.DateRules.WeekEnd(symbol, daysOffset)
    Create a rule that triggers a fixed number of trading days before the end of each week.

    Time Rules

    The following table contains functions that can be used with the time_rule parameter of schedule_function() .

    Quantopian QuantConnect
    quantopian.algorithm.time_rules.market_open ([...]) self.TimeRules.AfterMarketOpen(symbol, minutes_after_open = 0)
    Create a rule that triggers at a fixed offset from market open.
    quantopian.algorithm.time_rules.market_close ([...]) self.TimeRules.BeforeMarketClose(symbol, minutes_before_close = 0)
    Create a rule that triggers at a fixed offset from market close.

    Ordering

    There are several ways to place orders from an algorithm. For most use-cases, we recommend using SetHoldings method which correctly accounts the porfolio buying power model and fees. At the moment, there is no equivalent for order_optimal_portfolio() . However a similar behavior can be replicated with a Portfolio Construction Model.

    Algorithms that require explicit manual control of their orders can use the lower-level ordering functions.

    Placing Orders

    Quantopian QuantConnect
    quantopian.algorithm.order_optimal_portfolio (...) N/A
    Calculate an optimal portfolio and place orders toward that portfolio.
    quantopian.algorithm.order (asset, amount[, ...]) self.Order(symbol, amount)
    Place an order for a fixed number of shares.
    quantopian.algorithm.order_value (asset, value) N/A
    Place an order for a fixed amount of money.
    quantopian.algorithm.order_percent (asset, ...) self.SetHoldings(symbol, percent)
    Place an order in the specified asset corresponding to the given percent of the current portfolio value.
    quantopian.algorithm.order_target (asset, target) N/A
    Place an order to adjust a position to a target number of shares.
    quantopian.algorithm.order_target_value (...) N/A
    Place an order to adjust a position to a target value.
    quantopian.algorithm.order_target_percent (...) self.SetHoldings(symbol, percent)
    Place an order to adjust a position to a target percent of the current portfolio value.

    Controlling Order Execution

    Quantopian QuantConnect
    zipline.finance.execution.ExecutionStyle FillModel
    Base class for order execution styles.
    zipline.finance.execution.MarketOrder ([exchange]) self.MarketOrder (symbol, quantity)
    Execution style for orders to be filled at current market price.
    zipline.finance.execution.LimitOrder (limit_price) self.LimitOrder (symbol, quantity, limit_price)
    Execution style for orders to be filled at a price equal to or better than a specified limit price.
    zipline.finance.execution.StopOrder (stop_price) self.StopMarketOrder (symbol, quantity, stop_price)
    Execution style representing a market order to be placed if market price reaches a threshold.
    zipline.finance.execution.StopLimitOrder (...) self.StopLimitOrder (symbol, quantity, stop_price, limit_price)
    Execution style representing a limit order to be placed if market price reaches a threshold.

    Managing Existing Orders

    Quantopian QuantConnect
    quantopian.algorithm.get_order (order_id) self.Transactions.GetOrderById (order_id)
    Lookup an order based on the order Id returned from one of the order functions.
    quantopian.algorithm.get_open_orders ([asset]) self.Transactions.GetOpenOrders (symbol)
    Retrieve all of the current open orders.
    quantopian.algorithm.cancel_order (order_param) self.Transactions.CancelOpenOrders (symbol)
    Cancel an open order.

    Customizing the Simulation

    Slippage

    Algorithms can customize the simulation of order fills by calling SetSlippageModel() with a ISlippageModel which is any class that implements GetSlippageApproximation method. Unlike Quantopian, the slippage model is a security attribute, not a global attribute. Different securities can have different slippage models.

    The default slippage model on QuantConnect is a constant slippage model with zero slippage percent (no slippage).

    Quantopian QuantConnect
    quantopian.algorithm.set_slippage ([...]) self.Securities[symbol].SetSlippageModel(ISlippageModel)
    Set the slippage models for the simulation.
    zipline.finance.slippage.SlippageModel () N/A (class must implement GetSlippageApproximation method)
    Abstract base class for slippage models.
    zipline.finance.slippage.FixedBasisPointsSlippage ([...]) ConstantSlippageModel(slippage_percent)
    Model slippage as a fixed percentage difference from historical minutely close price, limiting the size of fills to a fixed percentage of historical minutely volume.
    zipline.finance.slippage.NoSlippage () ConstantSlippageModel(0)
    A slippage model where all orders fill immediately and completely at the current close price.
    zipline.finance.slippage.FixedSlippage ([spread]) N/A
    Simple model assuming a fixed-size spread for all assets.
    zipline.finance.slippage.VolumeShareSlippage ([...]) N/A
    Model slippage as a quadratic function of percentage of historical volume.

    Commissions

    Algorithms can customize the simulation of order fees by calling SetFeeModel() with a IFeeModel which is any class that implements GetOrderFee method. Unlike Quantopian, the fee model is a security attribute, not a global attribute. Different securities can have different fee models.

    The default fee model on QuantConnect depends on the security type and the brokerage. For instance, the default fee model for equity is the Interactive Brokers fee model.

    Quantopian QuantConnect
    quantopian.algorithm.set_commission ([...]) self.Securities[symbol].SetFeeModel(IFeeModel)
    Sets the commission models for the simulation.
    zipline.finance.commission.CommissionModel N/A (class must implement GetOrderFee method)
    Abstract base class for commission models.
    zipline.finance.commission.PerShare ([cost, ...]) N/A
    Calculates a commission for a transaction based on a per share cost with an optional minimum cost per trade.
    zipline.finance.commission.PerTrade ([cost]) N/A
    Calculates a commission for a transaction based on a per trade cost.
    zipline.finance.commission.PerDollar ([cost]) N/A
    Model commissions by applying a fixed cost per dollar transacted.
    zipline.finance.commission.NoCommission FeeModel()
    Model commissions as free.

    Benchmark

    The default benchmark is SPY.

    Quantopian QuantConnect
    quantopian.algorithm.set_benchmark (benchmark) self.SetBenchmark (benchmark)
    Set the benchmark asset.